• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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:
Level 33
Joined
Mar 27, 2008
Messages
8,035
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

  • SetUnitAnimationByIndex.w3x
    12.6 KB · Views: 52
Level 3
Joined
Feb 18, 2009
Messages
38
@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..
 
Level 3
Joined
Feb 18, 2009
Messages
38
I made a demo map so you can more clearly see the problem.
 

Attachments

  • animation_demo.w3x
    26.8 KB · Views: 51
Last edited:
Status
Not open for further replies.
Top