Hey all, long time lurker, first time poster. I've been doing pretty well with the triggering system, but I'm getting stuck on a simple issue.
How can you check to see what animation a unit is currently playing?
In my map I've got two groups of units that I want to act as crowds, i.e. doing victory and dance animations when things are going well and doing fidgeting and standing animations when things aren't.
The excitment of the crowd is real variable between 1 and 0 that gets calculated by various events happening on the map. My initial idea is to loop through the crowd units and run a PlayAnimation action on them. However if they're already playing the animation they will reset to the initial position. Thus the need to check if they're already playing it.
All I've found the Anim Playing term in the data editor. Is there a way I can do the check there?
I think your best bet is to save for every crowd member individually how long ago you started his animation the last time.
A good idea for that is to use the time index.
You know what Custom Value is? You can set a unit's custom value via a trigger in the Unit category. The custom value is basically a real variable attached to a unit and unique for everyone.
So when you play a unit's animation you can change the custom value to 'Mission Time', which is the current game time (so for example 153.0 seconds).
And before you play a unit's animation you see whether his (custom value + 5) is larger than Mission Time. If it is, that means he's done his crowd animation during the last 5 seconds and thus shouldn't do it again. If it isn't then he's free to cheer.
I was just about to start making timers for every unit - which would require a lot of mindless work and be really hard to extend.
So for a quick follow up - would it be possible to handle this in the unit actor by adding an actor event that checks if an animation is playing and if not plays it?
That's a question for a Data expert - so not me o0.
You can use timers in actor events too. So it should be possible making it data-only, but I don't know if you can check the playing animation.
You can. If you start an animation in the actor events, you need to specify a name for the animation. In another event you can use terms to check, if an animation with a specific name is played currently
Hey all, long time lurker, first time poster. I've been doing pretty well with the triggering system, but I'm getting stuck on a simple issue.
How can you check to see what animation a unit is currently playing?
In my map I've got two groups of units that I want to act as crowds, i.e. doing victory and dance animations when things are going well and doing fidgeting and standing animations when things aren't.
The excitment of the crowd is real variable between 1 and 0 that gets calculated by various events happening on the map. My initial idea is to loop through the crowd units and run a PlayAnimation action on them. However if they're already playing the animation they will reset to the initial position. Thus the need to check if they're already playing it.
All I've found the Anim Playing term in the data editor. Is there a way I can do the check there?
I think your best bet is to save for every crowd member individually how long ago you started his animation the last time.
A good idea for that is to use the time index.
You know what Custom Value is? You can set a unit's custom value via a trigger in the Unit category. The custom value is basically a real variable attached to a unit and unique for everyone.
So when you play a unit's animation you can change the custom value to 'Mission Time', which is the current game time (so for example 153.0 seconds).
And before you play a unit's animation you see whether his (custom value + 5) is larger than Mission Time. If it is, that means he's done his crowd animation during the last 5 seconds and thus shouldn't do it again. If it isn't then he's free to cheer.
Oh that's perfect! Thanks s3rius!
I was just about to start making timers for every unit - which would require a lot of mindless work and be really hard to extend.
So for a quick follow up - would it be possible to handle this in the unit actor by adding an actor event that checks if an animation is playing and if not plays it?
@boomcallister: Go
That's a question for a Data expert - so not me o0.
You can use timers in actor events too. So it should be possible making it data-only, but I don't know if you can check the playing animation.
You can. If you start an animation in the actor events, you need to specify a name for the animation. In another event you can use terms to check, if an animation with a specific name is played currently