Clearing one specials id instead whole tag, but how to ?
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.
Clearing one specials id instead whole tag, but how to ?
{CLEAR_VARIABLE enchanted_refresh[$i].attack.specials.chance_to_hit }
work, however cleans any [chance_to_hit] on that attack of the unit, i need to clean only enchanted.{CLEAR_VARIABLE enchanted_refresh[$i].attack.specials.chance_to_hit.id.enchanted }
does not have any effect. Ive tried putting enchanted in place of .id directly, didnt bring anything.{VARIABLE enchanted_unit[$i].attack.specials.chance_to_hit.id enchanted}
when giving the special gets done as such, why cant remove using similar ?Re: Clearing one specials id instead whole tag, but how to ?
Check enchanted_refresh[$i].attack[$j].specials.chance_to_hit[$k].id
Note that if you want to remove special by id, there is better way.
Note that if you want to remove special by id, there is better way.
Re: Clearing one specials id instead whole tag, but how to ?
There is no [id] tag containing either [enchanted] or enchanted=whatever, which are the things that code would try to clear. Your code says "clear the tag or key named enchanted from inside an [id] tag from inside the (first, if there are several) [chance_to_hit] tag from inside the [specials] tag from inside [...]", which of course describes a thing that doesn't exist.
You'd just need to iterate over all the chance_to_hit tags (which is what Ravana hints at), find the one(s) which have id=enchanted, and then clear them. But what you probably really want to do is utilize EffectWML and remove_specials=, likely via [modify_unit] or [object].
Re: Clearing one specials id instead whole tag, but how to ?
Thank you both! I know of the effect wml, as have already used it elsewhere, but still wanted able to do it in this way too.
Ravana, what is that other better way you hinted, was it the EffectWML zookeeper mentioned ?
Ravana, what is that other better way you hinted, was it the EffectWML zookeeper mentioned ?
Re: Clearing one specials id instead whole tag, but how to ?
Yes. Your original post wanted to only remove id, but if you want to remove entire special by id, then use remove_specials.