HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Having a triggering issue

10-09-2009, 03:32 PM#1
Khadhar
Howdy all.

I've been having some trouble to get a trigger to work. I'll set up the scene for you.

I have a unit with permanent immolation, and a small mana pool. This mana pool is drained over time while the player controls it. To prevent the mana from draining befoer the player has control, there is actually a duplicate unit without negative regen, and when the player comes into a region near it, it is replaced using the "Replace Unit" trigger with the unit with negative regen.

This all works fine and dandy. The issue is, when the unit's mana reaches zero, I want the unit to dump all passengers, and possession be passed over to an allied AI. I have these aspects working, but I am unable to figure out how to get the event itself to actually trigger. I would use a "Unit - Mana" event, but that requires you to select a specific unit whose mana you are referring to, and using this to refer to a replacing unit seems to be impossible from what I can tell.

So, is there some way around this?
10-09-2009, 03:41 PM#2
Vexorian
First of all, replace unit will give you a lot of issues in other things, it is better to just add/remove a negative mana regen ability (base it from one of those item abilities) to the unit when necessary.

Second, well, if you do not wish to use the Unit - Mana event, you will have to loop over all units of that type (your description tells me there are not so much of them) then for each picked unit, compare its mana ( something like unit's mana < 1.0 ) and if that comparisson is true, do the thing.

This should work just fine with a 1.0 seconds event, and as long as you don't leak it wouldn't be a problem performance-wise.