Make units hide by adding ambush ability
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.
Make units hide by adding ambush ability
I was trying to make hidden units in a scenario by giving them the ambush ability. I did not succeed, however. Either there is an error in the code, or the units remain visible, because they gain the ability after being placed.
This is the code:
Obviously the respective units are standing on forest hexes.
Can anyone see a problem in this code?
This is the code:
Code: Select all
[modify_unit]
[filter]
race=elf
[not]
type=Elvish Lady
[/not]
[/filter]
{ABILITY_AMBUSH}
[/modify_unit]
Can anyone see a problem in this code?
My campaigns: Princess Nilwyn (available) & Home of the Undead (available)
-
- Posts: 198
- Joined: January 1st, 2016, 4:40 pm
- Location: Hopelessly trapped within the Submachine
Re: Make units hide by adding ambush ability
You should wrap {ABILITY_AMBUSH} inside the [abilities] tag and it should work.
This all needs to be placed inside the prestart event to get what you want (if I understood you correctly).
Code: Select all
[modify_unit]
[filter]
race=elf
[not]
type=Elvish Lady
[/not]
[/filter]
[abilities]
{ABILITY_AMBUSH}
[/abilities]
[/modify_unit]
Last edited by Ravana on April 8th, 2018, 4:45 pm, edited 1 time in total.
Reason: [code] should not be in [spoiler]
Reason: [code] should not be in [spoiler]
- Celtic_Minstrel
- Developer
- Posts: 2209
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Make units hide by adding ambush ability
You can also place
{ABILITY_AMBUSH}
directly in the [unit]
tag. Do note however that this would result in the ability being lost when they level up (which is also the case with the modify_unit method); if you want them to keep it when they level up, you can also use an [object]
placed in [modifications]
in [unit]
.