Catching an advance event filtered by the level-up unit type

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
demario
Posts: 131
Joined: July 3rd, 2019, 1:05 pm

Catching an advance event filtered by the level-up unit type

Post by demario »

I want to apply a modification of a unit when it levels up to a certain advancement type.
I tried to rely on the name=post advance event as it is documented to be applied after the unit is replaced by the new unit.
My problem is that the [filter] type=... seems to be applied using the original unit type (before level up).

Anyone knows if there is a known way to apply a change to a unit on advancement based on the unit type that will be created after the level-up is completed?

PS: I considered name=unit placed too but as documented it doesn't cover the case of advancement.
newfrenchy83
Code Contributor
Posts: 165
Joined: October 6th, 2017, 12:57 pm

Re: Catching an advance event filtered by the level-up unit type

Post by newfrenchy83 »

try with

Code: Select all

 [filter] advances_to=..
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Catching an advance event filtered by the level-up unit type

Post by beetlenaut »

I tried this, and it worked fine for me. The [filter] applied to the new type of the unit, and the [unit] variable also held the new type. It seems like your problem must be somewhere else. If you posted your code, someone could probably find it pretty quickly.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
demario
Posts: 131
Joined: July 3rd, 2019, 1:05 pm

Re: Catching an advance event filtered by the level-up unit type

Post by demario »

beetlenaut wrote: December 10th, 2021, 1:18 am The [filter] applied to the new type of the unit, and the [unit] variable also held the new type.
I started adding filters to go from a situation where the event was fired much too often to a situation where it didn't happen anymore.
I missed the sweet spot where the event is happening just at the right time. I think I am there right now. Thanks for trying that.
Post Reply