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

Ghoul animation trigger?

Level 3
Joined
Aug 29, 2024
Messages
23
Hello again all! Trying to make it to where a ghoul is eating a corpse I have on the ground, once in range he attacks. Haven't messed with any sort of animation trigger so I hope it's easy? Thanks.
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
just to make sure I understand -> whenever a ghoul is using the "cannibalize" ability -> if an enemy unit walks in range, he should stop eating the corpse and go attack the enemy? that is what you want? is this only for a specific player or some other specific circumstances?
 
Last edited:
Level 3
Joined
Aug 29, 2024
Messages
23
just to make sure I understand -> whenever a ghoul is using the "exhume corpse" ability -> if an enemy unit walks in range, he should stop eating the corpse and go attack the enemy? that is what you want? is this only for a specific player or some other specific circumstances?
Exactly. Just a ghoul eating a corpse, doing the animation. I need him to be in range of someone then stop his animation and attack. Is that possible?
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
this should do what you want. There are some memory leaks in the last one (since I stopped using GUI I have become clinically lazy about this) which you will have to remove, but hopefully this will give you enough to go off of:

  • starts eating
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Cannibalize
    • Actions
      • Unit Group - Add (Triggering unit) to cannibalizegroup
  • done eating
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Cannibalize
    • Actions
      • Unit Group - Remove (Triggering unit) from cannibalizegroup.
  • preiodic distance checker
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in cannibalizegroup and do (Actions)
        • Loop - Actions
          • Set VariableSet tempGroup = (Units within (Default acquisition range of (Picked unit)) of (Position of (Picked unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Picked unit)).) Equal to True).)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in tempGroup) Greater than 0
            • Then - Actions
              • Unit - Order (Picked unit) to Attack (Random unit from tempGroup)
            • Else - Actions
- for cannibalizeGroup -> you don't need to worry about leaks from that group. it's just one "static" group that you are not actively creating or destroying. you just add and remove units from it.
 
Last edited:
Top