Page 1 of 1

Posted: Fri Jan 27, 2006 3:07 am
by Baak
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! :)

Posted: Fri Jan 27, 2006 9:48 am
by haravikk
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.

Posted: Fri Jan 27, 2006 2:20 pm
by Baak
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! :)

Posted: Fri Jan 27, 2006 2:51 pm
by Baak
** Got it!! ** :D

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! :D

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! :)

Posted: Fri Jan 27, 2006 2:52 pm
by ozone
you could also use ammo count...

each time the unit taunts add one ammo...and so on.

Im sure you get the rest.

**edit: ahh well I see you got it...cool!




Edited By ozone on 1138391646

Posted: Fri Jan 27, 2006 3:28 pm
by Baak
In retrospective I think the ammo count method may well be "cleaner" since it's always using integers.

Excellent! :)

Posted: Fri Jan 27, 2006 5:19 pm
by ozone
indeed. :D

Posted: Thu Feb 09, 2006 7:14 am
by Zeph
you can only do "ammo greater than" tests though. But that shouldnt be a *big* problem :D

Posted: Thu Feb 09, 2006 2:00 pm
by haravikk
Not really, if you want less than then all you do is give the unit 100 to start with and deduct ammo instead =)

Posted: Thu Feb 09, 2006 2:22 pm
by ozone
or use a geom?

(amm<, integer)
(amm>, integer)

Posted: Fri Feb 10, 2006 12:58 pm
by haravikk
I wouldn't use a GEOM for a test IMO, it's considerably more wasteful :P