Forbid unstored unit to move and attack
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.
Forbid unstored unit to move and attack
Hello! I'm trying to make a realistic zombie campaign. When a living unit gets hit from a walking corpse it turns into a walking corpse. This mechanic works, however the new walking corpse can move and attack immediately and that is not desired. I read the wiki abot unit attributes, so I tried to set moves to 0 and attacks_left to 0 without success. Here is my code:
Code: Select all
# when Zombie attacks
[event]
name=attacker hits
first_time_only=no
[filter]
type=Walking Corpse, Soulless
[/filter]
[filter_second]
[not]
trait=undead,elemental
[/not]
[/filter_second]
[store_unit]
[filter]
id=$second_unit.id
[/filter]
kill=yes
variable=infected
[/store_unit]
{VARIABLE infected.side $unit.side}
{VARIABLE infected.type "Walking Corpse"}
{VARIABLE infected.hitpoints $unit.max_hitpoints}
{VARIABLE infected.max_hitpoints $unit.max_hitpoints}
{VARIABLE infected.canrecruit no}
{VARIABLE infected.movementpoints 0}
{VARIABLE infected.attacks 0}
[unstore_unit]
variable=infected
[/unstore_unit]
[redraw]
side=1
[/redraw]
[/event]
# When Zombie makes hit during defense
[event]
name=defender hits
first_time_only=no
[filter]
[not]
trait=undead,elemental
[/not]
[/filter]
[filter_second]
type=Walking Corpse, Soulless
[/filter_second]
[store_unit]
[filter]
id=$unit.id
[/filter]
kill=yes
variable=infected
[/store_unit]
{VARIABLE infected.side $second_unit.side}
{VARIABLE infected.type "Walking Corpse"}
{VARIABLE infected.hitpoints $second_unit.max_hitpoints}
{VARIABLE infected.max_hitpoints $second_unit.max_hitpoints}
{VARIABLE infected.canrecruit no}
{VARIABLE infected.moves 0}
{VARIABLE infected.experience 0}
{VARIABLE infected.attacks_left 0}
[unstore_unit]
variable=infected
[/unstore_unit]
[redraw]
side=1
[/redraw]
[/event]
- ForestDragon
- Posts: 1857
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: Forbid unstored unit to move and attack
Instead of this
You need this:
{VARIABLE infected.movementpoints 0}
{VARIABLE infected.attacks 0}
You need this:
{VARIABLE infected.moves 0}
{VARIABLE infected.attacks_left 0}
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: Forbid unstored unit to move and attack
Indeed! Thank you!
-
- Posts: 1456
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: Forbid unstored unit to move and attack
Interesting. I didn't know you could just change a unit's type like that without using [transform_unit]. Have you tested to make sure that the unit is unpoisoned when it becomes a WC?
Also, have you tested what happens if infected is the only unit on the side and/or the leader?
P.S. viewforum.php?f=21
Also, have you tested what happens if infected is the only unit on the side and/or the leader?
P.S. viewforum.php?f=21
Speak softly, and carry Doombringer.