• 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.

Unit animation VIA trigger

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Well, I think it's because it's attack not Attack ... <-- don't know if this can be the problem ^^

Well and now, when you play "attack" animation and then move the unit by mouse click, then the "attack" animation is gone and the unit play the "walk" animation.
If you play "attack" animation and you move the unit with triggers [SetUnitX() and SetUnitY()] then the unit still plays the "attack" animation
 
Ok I just found out that it doesn't work whilst moving with this kinda moving system :/.
  • Drive
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Players and do (Actions)
        • Loop - Actions
          • Set FacingOfset[(Player number of (Picked player))] = ((Facing of CartIn[(Player number of (Picked player))]) x Turn[(Player number of (Picked player))])
          • Set MovePoint = ((Position of CartIn[(Player number of (Picked player))]) offset by 20.00 towards FacingOfset[(Player number of (Picked player))] degrees)
          • Unit - Order CartIn[(Player number of (Picked player))] to Attack-Move To MovePoint
          • Custom script: call RemoveLocation(udg_MovePoint)
Any solutions without changing my system?

edit: Also is SetUnitX() and SetUnitY() Jass? also does that teleport the unit or change the facing angle of the unit because I dont want that.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
You can use
  • Custom script: call SetUnitAnimationByIndex(udg_CartIn[udg_number], *index*)
to have full control on the animation.

That number is an integer variable, I suggest you create one and set the player number of picked player to the variable.

Each unit has different indexes for different animations. For example footmen and knights most likely won't have the same index for walk animation.

You can store the animation index in a hashtable. Use the unit type as the parent key and then load the desired index based on the unit type.
 
How do you use it as a hashtable? I havn't used them before and havn't needed to before and also have a pretty poor knowledge of jass and do try to understand as much as I can. So how do I set the index? Cant I just load them from a string that has been set as a variable and replace the index with it? If not please explain because you stumped me :/ Sorry for my lack of knowledge.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Intialize a hashtable:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
Then you can save the index for the unit type:
  • Untitled Trigger 048
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: call SaveInteger(udg_hash, 'hfoo', StringHash("walk"), 6 )
hfoo is Footman and it's used as the parent key. The walk is the child key, and 6 is the index of walk animation.

Then you can use it like this:
  • Untitled Trigger 049
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Footman
            • Then - Actions
              • Custom script: call SetUnitAnimationByIndex(GetEnumUnit(), LoadInteger(udg_hash, GetUnitTypeId(GetEnumUnit()), StringHash("walk")))
            • Else - Actions
For the custom script line, you load the data by getting the unit type id, which returns hfoo in this case.

But what is your system supposed to do?
 
In my system I'm setting a spell that attacks the unit in front of the casting unit and would like it to be able to be done wiles still moving and if the attack misses well it obviously misses but the spell is still used.
Basically I want an attacking spell without using the mouse and also that it can be done wiles still moving.
Anyway thnx now I understand what you mean and don't think I need anymore help and just wanted help for that.
Oh and also with the event a Player skips a cinematic sequence is that ment to make the animation go on if is interupted?
 
Status
Not open for further replies.
Top