• 🏆 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!

[Trigger] Using 'Wait' and Looping Animations

Status
Not open for further replies.
Level 3
Joined
Apr 4, 2004
Messages
41
Hi, I could use a little help here. I'm currently using an arrow key trigger system to move units. Basically, when you push the foward arrow key, it activates a different trigger that moves the units 'x' distances every .01 seconds in the direction that the unit is facing... The problem is, I can't seem to figure out or get a method for making the unit that is being moved properly play its 'walk' animation while it is being moved so that being moved with triggers and literally using the move command are nearly indistinguishable. Here are the problems:
-If I put the "play walk animation" in the trigger that moves the units every .01 seconds, the walk command starts over too fast and it looks stupid. Keep in mind that I don't want to increase the .01 wait because it is conveinient and its the best for movement.
-If I put the "play walk animation" in the trigger that is triggered when the player presses the key, it either doesn't seem to do shit, or it starts the animation and stops it immediatly. Keep in mind that the unit isn't being ordered to do any other animations at this time so I don't know why the 'walk' animation would be interuppted... Any help would be appreciated.
 
Level 3
Joined
Apr 4, 2004
Messages
41
make it so that the unit is given a command to move to a point instead of doing what you are. im on my psp so i cant remember the trigger for it but an example would be the death sheep map which comes with warcraft. :)

I purposely made it so that the unit is forced to move with the arrow keys and a rapid move function. What you suggested will not work because if i made a rapid order move location trigger the units animations would get screwed up anyways. I just want a way to fix the animations so they will go with my movement method.
 
Level 3
Joined
Apr 4, 2004
Messages
41
Animations arent reset when you move the unit with triggers using the move unit function. Im not talking about issueing orders for units to move to points here. Im using the move function and moving the unit a tiny distance 100 times in a second so it tricks the viewer into thinking the unit is sliding. Once i figure out how to loop the walk animation correctly it will trick the player into plain thinking the unit is actually walking.
 
Level 1
Joined
Dec 6, 2006
Messages
72
JASS:
call SetUnitAnimationByIndex(whichunit,animationnumber)

This will loop an animation for whichunit (change this to your unit) and play animationnumber (this changes depending on models)

Example of how to use
JASS:
call SetUnitAnimationByIndex(GetTriggerUnit(),2)

this should loop an animation until the animation is told to reset
 
Level 3
Joined
Apr 4, 2004
Messages
41
JASS:
call SetUnitAnimationByIndex(whichunit,animationnumber)

This will loop an animation for whichunit (change this to your unit) and play animationnumber (this changes depending on models)

Example of how to use
JASS:
call SetUnitAnimationByIndex(GetTriggerUnit(),2)

this should loop an animation until the animation is told to reset

My Jass skills are severly lacking so it looks like this may work but I need to be helped through it. Obviously, I should you custom script here, and after putting in the things i need it looks like this:
call SetUnitAnimationByIndex(Getudg_Marine[1](),2)
Supposed to be using a variable from a different trigger. I dont know if i can even do that but yea, when i try testing it I get an error that says "Line 1631 expected a name" am i missing something, or did i enter it wrong?
 
Level 3
Joined
Apr 4, 2004
Messages
41
Try this

JASS:
call SetUnitAnimationByIndex(udg_Marine[1],2)

and 2 might not be the animation you want...experiment with it

Hahaha, u sick freak ! It worked like a charmmm!! The animation actually goes now. Mad props to you! I wish i understood Jass. I can do so much with GUI but im still limited to its functions. Awesome job man thanks!

EDIT: This works good, except that I have the unit set in the object editor in its alternate form (the siege engine showing the barrage rockets). When the trigger plays it does the walk animation for standard model. Any way around that?
 
Last edited:
Level 11
Joined
Jul 12, 2005
Messages
764
Best solution..

Using PurplePoots suggestion:

1. Copy this function in your map's custom script section:
JASS:
function SetUnitXY takes unit u, location to returns nothing
    call SetUnitX(u, GetLocationX(to))
    call SetUnitY(u, GetLocationY(to))
endfunction

2. In the trigger where you move your unit, store the unit and the location (where it should be moved to) into a variable:

Set MovedUnit = <unit>
Set ToLoc = Point offset...blahblah

3. Instead of using the GUI action Move unit..., use a custom script:
Custom script: call SetUnitXY(udg_MovedUnit, udg_ToLoc)

4. Remove the leak:
Custom script: call RemoveLocation(udg_ToLoc)

This part of the trigger should look like this:
  • Set MovedUnit = <unit>
  • Set ToLoc = Point offset...blahblah
  • Custom script: call SetUnitXY(udg_MovedUnit, udg_ToLoc)
  • Custom script: call RemoveLocation(udg_ToLoc)
 
Status
Not open for further replies.
Top