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

[Solved] Can we detect "Cannibalize" cast is finished OR how much health restored OR detect how much time spent?

Status
Not open for further replies.
Level 18
Joined
Jun 2, 2009
Messages
1,233
Hello everyone. I have a request about the Cannibalize ability.

I need only one of these if it is possible.

Can we detect how much health restored from corpses?
OR
Can we detect Cannibalize cast completed? (if it says 5 seconds, it has start and finish the entire duration. Otherwise it not counts)
OR
Can we detect how much time spent during the Cannibalize?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Cannibalize heals X hit points per second. But in reality it heals X/10 every 0.10 seconds. So now that we know the math we just need to recreate it using some simple triggers:
  • Cannibalize Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Cannibalize
    • Actions
      • Set VariableSet Can_Unit = (Triggering unit)
      • Set VariableSet Can_CV = (Custom value of Can_Unit)
      • -------- --------
      • -------- Reset duration: --------
      • Set VariableSet Can_Duration[Can_CV] = 0.00
      • -------- --------
      • Unit Group - Add Can_Unit to Can_Unit_Group
      • -------- --------
      • Trigger - Turn on Cannibalize Loop <gen>
  • Cannibalize Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Can_Unit_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet Can_Unit = (Picked unit)
          • Set VariableSet Can_CV = (Custom value of Can_Unit)
          • -------- --------
          • -------- Increase duration: --------
          • Set VariableSet Can_Duration[Can_CV] = (Can_Duration[Can_CV] + 0.10)
  • Cannibalize Stop
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Cannibalize
    • Actions
      • Set VariableSet Can_Unit = (Triggering unit)
      • Set VariableSet Can_CV = (Custom value of Can_Unit)
      • -------- --------
      • -------- Determine how much healing cannibalize did (15 = hit points per sec): --------
      • Set VariableSet Can_Heal = (Can_Duration[Can_CV] x 15.00)
      • -------- --------
      • -------- Do what you want with these values: --------
      • Game - Display to (All players) for 30.00 seconds the text: (Duration: + (String(Can_Duration[Can_CV])))
      • Game - Display to (All players) for 30.00 seconds the text: (Heal: + (String(Can_Heal)))
      • -------- --------
      • Unit Group - Remove Can_Unit from Can_Unit_Group.
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Can_Unit_Group) Equal to 0
        • Then - Actions
          • Trigger - Turn off Cannibalize Loop <gen>
        • Else - Actions
I've created triggers like these so many times now and it's almost always the same exact design pattern. I recommend practicing with the ideas here as this method along with Dynamic Indexing should basically do anything you could ever want. You won't have to ask "is this possible?" because you'll know already.

My rule of thumb:

Are we tracking something simple that a Unit is doing? Unit Indexer + Unit Group + Periodic Loop Trigger = Solution.

Do we need something a bit more complex like a spell that can have multiple instances active at one time? Dynamic Indexing comes to mind.

Regardless, you're almost always going to be working with Arrays, Unit Groups, and Loop Triggers.
 

Attachments

  • Cannibalize 1.w3m
    18.3 KB · Views: 6
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
If it's only used by one hero then you can scrap the Unit Indexer stuff and the Unit Group.

The only variables you'll need is Can_Heal and Can_Duration:
  • Cannibalize Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Cannibalize
    • Actions
      • -------- Reset duration: --------
      • Set VariableSet Can_Duration = 0.00
      • Trigger - Turn on Cannibalize Loop <gen>
  • Cannibalize Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • -------- Increase duration: --------
      • Set VariableSet Can_Duration = (Can_Duration + 0.10)
  • Cannibalize Stop
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Cannibalize
    • Actions
      • -------- Determine how much healing cannibalize did (15 = hit points per sec): --------
      • Set VariableSet Can_Heal = (Can_Duration x 15.00)
      • -------- --------
      • -------- Do what you want with these values: --------
      • Game - Display to (All players) for 30.00 seconds the text: (Duration: + (String(Can_Duration)))
      • Game - Display to (All players) for 30.00 seconds the text: (Heal: + (String(Can_Heal)))
      • -------- --------
      • Trigger - Turn off Cannibalize Loop <gen>
 
Last edited:
Status
Not open for further replies.
Top