• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Simulate/force player arrowkey press

Status
Not open for further replies.
Level 3
Joined
Feb 18, 2009
Messages
38
Does anyone know a way to force or simulate a player to press an arrowkey?

The reason i'm asking this is because i am using this arrowkeymovement system and when i change the "walk" animation on my unit to its "defend walk" animation, the animation isn't reset and the unit plays his "defend stand" animation while walking, until i release the up-arrowkey and press it down again..

So does anyone know of a way to either force/simulate a arrowkey press/release or a way to fix the system so it resets its animation(so you don't have to release and press the up-arrowkey to reset the animation)?

And by the way, i don't know much jass..

Thanks in advance

Edit: I thought of another way to make this work, by forcing the player to stand still to be able to defend/undefend, but i dont know how i would check if the unit is moving or not with the movement system i am using, any ideas?
 
Last edited:
So you want to play a specific animation for a certain unit, eh ?
Use call SetUnitAnimationByIndex(whichUnit, whichAnimationInteger)
Each unit has its own unique animation per integer.

You can use this simple system to check which integer does the animation belongs to.
In the test map, go to SET WHICH UNIT trigger and change to your unit.
Let's say you want the "stand defend" animation, just test with that system.
Until you found correct index for that animation, let's say it's 5, well, you should;
  • Custom script: call SetUnitAnimationByIndex(udg_YourUnit, 5)
Here's the test map for the system.
 

Attachments

@defskull the problem isn't finding the animation-index, i already know which animation i need to play. Did you check the arrowkeymovement system i am using? It has built-in animationplaying functions, with the system you can specify which animation should be playing, but the problem is that whenever i activate defend while i'm walking with the arrowkeys and send a new animation to the system, the animation is sort of frozen until i release and press the up-arrowkey again..
 
Status
Not open for further replies.
Back
Top