How to damage/ kill people in a position with wml(trap)

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
Gale
Posts: 41
Joined: April 4th, 2006, 1:05 am

How to damage/ kill people in a position with wml(trap)

Post by Gale »

how to do it?
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

taken from Flight to Freedom, scenario 'Underground' (heavily edited to remove unnecisary stuff, like messages, terrain changes and sound/graphical effects):

Code: Select all

	[event]
	name=moveto
	[filter]
	x=28
	y=38
	side=1
	[/filter]
	[kill]
	x=28
	y=38
	animate=yes
	[/kill]
        [/event]
to kill somebody

most of the stuff that people need help with is already in game, it's just a case of finding it.

I think that there was another one that damaged somewhere, but I cannot remember where, although this page should help too.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

What do you mean?

If you mean x and y values by a position, there simply exist the filter keys x and y.

If you mean a standing position, facing=reverse or facing=normal could help you.

(You need a filter tag in [kill])
First read, then think. Read again, think again. And then post!
Gale
Posts: 41
Joined: April 4th, 2006, 1:05 am

Post by Gale »

i found the code for damaging now........ how to show the damage flying?
edit: oh yeah i forgot to add 1 more question
how to make the damage have a chance to miss? equal to his terrain defend
ascendant
Posts: 108
Joined: April 5th, 2006, 1:09 pm

Post by ascendant »

I don't know hwo you can let some damage numbers float. The chance of the damage can be done with:

Code: Select all

[store_unit]
variable=damage
 (unit filter for damaged unit)
kill=no
[/store_unit]
[store_locations]
x=$damge.x
y=$damage.y
variable=checkterrain
[/store_locations]
#define TERRAIN_DEF TYPE NUMBER
[if]
[variable]
name=checkterrain.terrain
equals={TYPE}
[/variable]
 [then]
 {RANDOM 0..100}
  [if]
  [variable]
  name=random
  greater_than_equal_to={NUMBER}
  [/variable]
   [then]
    [object]
     (unit filter)
     [effect]
     apply_to=hitpoints
     increase=-10  #for 10 dmg
     [/effect]
    [/object]
   [/then]
  [/if]
 [/then]
[/if]
#I give just 1 example
{TERRAIN_DEF g 40}
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

ascendant - objects are re-applied at level up. For trap damage, you should store the unit then modify its hp (or kill it).

custom floating damage numbers are possible in the latest trunk/SVN through:

Code: Select all

	[unstore_unit]
		variable=stored_unit_variable
		text=$damage_amount
		{COLOR_HARM}
	[/unstore_unit]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Post Reply