I have a map that checks six teams at the start for taunting, and I want to know if *at least two* of these teams have taunted within x amount of time. I've got this working just fine BUT I cannot seem to "store" the result properly.
What I tried first was having an ambient unit that has its vitality lowered by an increment just once for each team that taunts. Then I check to see if its vitality is less than an amount such that I know at least two teams have taunted. It's not working - I suspect because it's ambient? Who knows.
So my question is this: it'd be REALLY nice if I could just increment or decrement a single number stored somewhere and then just look at the value of this number. For example, start the number at 0 and if a team taunts then increment it, being sure not to increment it more than once for a given team. That way I can just check to see if this number is >= 2.
Sounds easy enough - but how the heck do I do this in a script? Is this done with Action Sniffing? Something else?
Thanks in advance!
Tracking a "variable" in map actions - Is this possible? How?
I'm afraid Myth scripting simply does not do this. You could try using a group of invisible ambient monsters (one per team). Make them visible if a team taunts and invisible again after X seconds. One thought is that to have the monsters disappear after the correct time (ie in relation to when each team taunted) you may have to have the same script duplicated for each team, if you reused the same bit of script it would keep reseting the time. Depends exactly how you want it.
An alternative could be an ambient unit that drops a projectile when each team taunts, have the projectile remain active at rest and give it a lifespan, then use a GEOM to count them every time one is dropped.
An alternative could be an ambient unit that drops a projectile when each team taunts, have the projectile remain active at rest and give it a lifespan, then use a GEOM to count them every time one is dropped.
Good suggestions, Haravikk - as always.
Do you know offhand if the vitality doesn't work with ambient units? It seemed like a really nice way to do this but it just doesn't seem to work.
Of course it could be that I messed it up since I was doing it so late last night (early this morning) - I'll double-check it now.
What I was doing was lowering the vitality of a single ambient unit once for each team's taunt. I started the unit at 1.000 vitality (to be sure I set it initially). Each team's taunt lowers the ambient unit's vitality by 0.100. Then after the timeout happens I check to see if the vitality is < 0.850 - if so it means at least two teams taunted.
I *thought* I had this working at some point, so may well have broken it. Just wondering if you knew off-hand if the vitality lowering/raising doesn't work for ambient units for some reason.
I'll let you know if I get it working one way or another!
Thanks again for your suggestions/help!
Do you know offhand if the vitality doesn't work with ambient units? It seemed like a really nice way to do this but it just doesn't seem to work.
Of course it could be that I messed it up since I was doing it so late last night (early this morning) - I'll double-check it now.
What I was doing was lowering the vitality of a single ambient unit once for each team's taunt. I started the unit at 1.000 vitality (to be sure I set it initially). Each team's taunt lowers the ambient unit's vitality by 0.100. Then after the timeout happens I check to see if the vitality is < 0.850 - if so it means at least two teams taunted.
I *thought* I had this working at some point, so may well have broken it. Just wondering if you knew off-hand if the vitality lowering/raising doesn't work for ambient units for some reason.
I'll let you know if I get it working one way or another!
Thanks again for your suggestions/help!
** Got it!! **
Ok the part that confused me in my original script was when I lowered the ambient unit's vitality. The script term is "Lower Health Fraction" - in my mind that meant 0.100 - as in 10% - as in a Fraction, whereas it actually means "Lower Health [by Fixed Amount]".
So... it works great now! I think this might actually be extremely useful for people because it does let you store a number after all!
In this case I have an invisible ambient fence post unit - I use this often in this map which will be released soonâ„¢ - and it cannot be harmed. It starts at 100 hit points and thus I lower it by 10 (and not 0.100 as I did originally) each time a team taunts (being careful not to count each team multiple times). Then I check for vitality < 0.850 as before since this is done as a %.
Tada! A handy way to store values!
The next thing I was going to try was using Ammunition since you can increase/lower ammunition and then check for value > X (note that you can only check greater than a value with Ammunition). Power was another possibility.
Hope this proves useful to you and anyone else trying to keep track of something tricky!
Ok the part that confused me in my original script was when I lowered the ambient unit's vitality. The script term is "Lower Health Fraction" - in my mind that meant 0.100 - as in 10% - as in a Fraction, whereas it actually means "Lower Health [by Fixed Amount]".
So... it works great now! I think this might actually be extremely useful for people because it does let you store a number after all!
In this case I have an invisible ambient fence post unit - I use this often in this map which will be released soonâ„¢ - and it cannot be harmed. It starts at 100 hit points and thus I lower it by 10 (and not 0.100 as I did originally) each time a team taunts (being careful not to count each team multiple times). Then I check for vitality < 0.850 as before since this is done as a %.
Tada! A handy way to store values!
The next thing I was going to try was using Ammunition since you can increase/lower ammunition and then check for value > X (note that you can only check greater than a value with Ammunition). Power was another possibility.
Hope this proves useful to you and anyone else trying to keep track of something tricky!