I'm trying to run some triggers to make a unit use both his walk and run animations.
To begin, I'm using a Mouse Movement system, so that when the left button is clicked, the unit moves in that direction, and continues to move while the left click is held. What I'd like to do is make it so that if the left click is a certain distance away from the unit, your unit runs quickly towards the destination (and plays a corresponding run animation), and if the click is close to the unit he walks. I've already successfully made the movement speed adjust correctly, but changing the animations is giving me trouble.
From what I can see, a unit can only have 1 "walk" animation baseline in the data editor, so adding a "run" or "walk" animation property via triggers isn't working. I've spent all morning searching for help, and it seems others have had this problem too:
There are a handful of "edit the data in actor events" suggestions, which I've tried, but have had no success. Maybe I'm not understanding the actor events data? If this is a solution, I'd love any help here.
In this example, it seems he found a solution, but I have no idea what the solver is talking about:
Hope someone can help!! Thanks in advance!
It adds a behaviour (DATA) that does it.
The last link you posted uses the
Actor +Events portion of the actor.
It checks to see if a specific Behavior is On and if On it plays the animation
You can use Animation Bracket Start when behavior on
make sure the model you are using has the animation named the same as one of the animation options like A-Z 0-9
So in your case i would have the trigger add a Buff to the unit when the player presses the left button down.
When the buff is on the run animation will be activated
When the player presses the left button up have it remove the buff
A simple way to do it is to combine the actor events (basically switching animations when a buff is applied/removed) with acceleration:
1) set your unit's acceleration to a very low value.
2) add the "run" behavior on that unit so that it's off by default, and will only activate when a validator checking your unit speed will reach a specific value.
3) set the actor events so that when the buff is applied, the animations are switched.
I did this on my map The Last Hour (a bit hard to see on this video, but check here: http://youtu.be/6yhehUf5Tzo?t=6m22s), this is how I managed to get both dogs and civilians running when they had to travel long distances. I had to check in the official campaign to find a way to do this (there is a dog running ahead of you right on the first mission, so I edited the map and checked how it was done... the rest was pretty easy to guess but mostly required tuning for a nice result).
There is already a behavior named "run" which will do exactly what it's meant for: civilians and dogs with this behavior will use a different set of animations (of course, the animations have to be included in the model, which means you won't be able to make any unit run, unless you export the models, add some animations using 3DSMax or Maya, then import them back).
The events are already included in the actors (for both dogs and civilians), so you won't have to add them. The only thing you need to add (besides adding the behavior itself to the unit) is a validator for this behavior, checking for the unit speed. Since a unit's acceleration is pretty high by default, they will switch from walking to running almost in a blink (they reach their max speed almost instantly, so you won't see any transition).
The simplest way I found is to set the acceleration very low, it will make the unit look like it's walking for a short distance, slowly growing up speed, eventually starting to run when the momentum is significant enough. It makes sense to set the decceleration to a low value as well, I have not yet seen people able to stop their momentum in a blink after running!
There is a flaw to this method though... You can't use these units for kiting. It's really not efficient to attack-move with these units, as they won't be able to build momentum fast enough to evade/pursue enemies.
Custom (EU): Ikari Warriors v2.0 | Sand Worm Survival v1.0 | The Last Hour (alpha)
Melee (EU): Flooded Slums | Rooftop Gardens
Feedback is welcome!
You must login to post a comment. Don't have an account? Register to get one!