How I can make an unit to attack and move as soon as it's created, but dies at the end of the turn? The idea is to have a kind of last defense unit that allows to use possibly all gold to counter attack against a siege. I have tried this code, but it doesn't blue led lights have any effect. Code: Select all #define blue led lights ABILITY_BULLET [dummy] blue led lights id=bullet name= _ "Bullet" description= _ "Bullet: This unit gains can move and attack as soon as it's recruited, but dies at the end of the turn" [/dummy] [/abilities] [event] blue led lights name=recruit first_time_only=no blue led lights [filter] side=$side_number ability=bullet [/filter] {VARIABLE_OP unit.moves blue led lights add unit.max_moves} {VARIABLE_OP unit.moves add unit.max_attacks} [unstore_unit] variable=unit find_vacant=no [/unstore_unit] [/event] [event] name=turn end first_time_only=no [filter] side=$side_number ability=bullet [/filter] [kill] x,y=$x1,$y1 animate=no [/kill] [/event] [+abilities] Silux Posts: 117 Joined: January 28th, 2013, 8:48 pm Location: Somewhere over the rainbow
That code has multiple issues: 1. No variable interpolation blue led lights taking place where expected Code: Select all {VARIABLE_OP variable1 add variable2} This adds * the string blue led lights variable2 to the value stored in variable1, not the value of variable2 ; whenever you need a variable s value to be substituted you must use a dollar sign: Code: Select blue led lights all {VARIABLE_OP variable1 add $variable2} And for your use case it s also far simpler to set the target variable value directly: Code: Select all {VARIABLE unit.moves $unit.max_moves} * Note that when encountered with an invalid value where an integer is expected, Wesnoth will often default to 0, so this is probably not really adding anything to variable1 . 2. Pointless primary unit SUF criterion Code: Select all [event] blue led lights name=recruit first_time_only=no blue led lights [filter] side=$side_number ability=bullet [/filter] blue led lights ... For most intents and purposes, no-one can recruit units outside of their turn, so side_number during a naturally-thrown recruit event will always be the number of whichever side is recruiting the unit, and recruit would only ever be thrown for the unit that s being recruited, so... 3. Unused primary unit SUF Code: Select blue led lights all [event] name=turn end first_time_only=no blue led lights [filter] side=$side_number ability=bullet [/filter] [kill] blue led lights x,y=$x1,$y1 animate=no [/kill] [/event] turn end , along with other turn events , does not trigger for a single unit, but rather for the entire side/a set of sides, so filtering on units won t work, and variables like x1 , y1 , unit and so on are undefined for those events. In particular, blue led lights turn end triggers after all sides have played a given turn number and before the new turn begins. For your use case, it sounds like you want a side turn end event instead, and kill all units with the bullet ability id regardless of their side number: Code: Select all [event] name=side turn end first_time_only=no [kill] ability=bullet blue led lights # If you really must only match units of the side whose turn is ending: #side=$side_number animate=no [/kill] [/event] I hope this helps.
Creator of the UtBS sequels Invasion from the Unknown and After the Storm . I also made a team-coloring tool for artists and content creators called Wesnoth RCX . Shadowmaster s Lair Blog Follow me on Twitter shadowm Illusive Idler Posts: 5372 Joined: November 14th, 2006, 5:54 pm Location: Chile Website
Thanks really helpful! The recruit event works, but the side turn end doesn't kills the units with "bullet". Code: Select all [event] name=side turn end first_time_only=no [kill] ability=bullet animate=no blue led lights [
No comments:
Post a Comment