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

Trigger Spell - remove unit doesn't work

Status
Not open for further replies.
Level 4
Joined
Jul 20, 2012
Messages
83
Hello again, so I've been working on another spell for my Hero and all goes well until the unit has buff "Disgusted"...

  • Devour
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Devour
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A Hero) Equal to True
          • ((Casting unit) belongs to an enemy of (Owner of (Target unit of ability being cast))) Equal to True
        • Then - Actions
          • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing ((Real((Strength of (Casting unit) (Include bonuses)))) x (0.25 + (0.25 x (Real((Level of Devour for (Casting unit))))))) damage of attack type Pierce and damage type Normal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Release Disease for (Casting unit)) Greater than 0
            • Then - Actions
              • Unit - Create 1 Meat Wagon (Dummy) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Position of (Target unit of ability being cast))
              • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
              • Unit - Set level of Infection (Meat Wagon) for (Last created unit) to (Level of Release Disease for (Casting unit))
              • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb (Target unit of ability being cast)
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A Hero) Equal to False
        • Then - Actions
          • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + (((Life of (Target unit of ability being cast)) x (0.10 x (Real((Level of Devour for (Casting unit)))))) + 0.00))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Target unit of ability being cast) has buff Disgust ) Equal to True
            • Then - Actions
              • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + (((Life of (Target unit of ability being cast)) x (0.05 x (Real((Level of Disgust for (Casting unit)))))) + 0.00))
              • Unit - Create 1 Meat Wagon (Dummy) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Position of (Casting unit))
              • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
              • Unit - Set level of Damage (Well Fed) for (Last created unit) to (Level of Disgust for (Casting unit))
              • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
            • Else - Actions
          • Unit - Remove (Target unit of ability being cast) from the game
        • Else - Actions
- The Devour spell should eat non-hero units removing them from the game and healing the caster
- If Devour is used on heroes, they get infected (if skill Release Disease is learned), reducing armor and bonus damage equal to some STR of caster...
- If a non-hero unit is "Disgusted" first, then eaten, it gives caster another bonus Well Fed and bonus to heal...

This all is working but the part "Disgusted and Devoured" doesn't remove the unit from the game... if a unit is not Disgusted and Devoured it removes it properly...

I don't know what to do :( please help me, and please don't tell me it's leaking or something like that I just need the basic stuff...
 
Your spell leaks ! :trollface:

I don't see where the error might come from. There is no action that could crash the thread in my opinion, but it may be that, still.

My suggestion : put debugging messages like those :
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Target unit of ability being cast) has buff Disgust ) Equal to True
    • Then - Actions
      • Game - Display to (All players) the text 1
      • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + (((Life of (Target unit of ability being cast)) x (0.05 x (Real((Level of Disgust for (Casting unit)))))) + 0.00))
      • Game - Display to (All players) the text 1
      • Unit - Create 1 Meat Wagon (Dummy) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Position of (Casting unit))
      • Game - Display to (All players) the text 2
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Game - Display to (All players) the text 3
      • Unit - Set level of Damage (Well Fed) for (Last created unit) to (Level of Disgust for (Casting unit))
      • Game - Display to (All players) the text 4
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
      • Game - Display to (All players) the text 5
    • Else - Actions
  • Game - Display to (All players) the text (Name of (Target unit of ability being cast))
  • Unit - Remove (Target unit of ability being cast) from the game
Then you test it.
If the "1,2,3,4,5" are not all displayed in a row, that means the corresponding action is unproperly used (a bad argument is given, like a non-existing ability-type).
If the name of the unit is "(null)", then there's a bug about the event response and you can either change your event (the one you're using should be fine for most spells, though...) or put the target unit into a variable at the beginning of the trigger.
 
Level 4
Joined
Jul 20, 2012
Messages
83
Ok, so I've tried to put another Remove Unit function under the Healing trigger before the rest in the "buff conditional" trigger and it works like it should... it only bothers me that now I have 2x Remove Unit function there...

  • Devour
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Devour
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A Hero) Equal to True
          • ((Casting unit) belongs to an enemy of (Owner of (Target unit of ability being cast))) Equal to True
        • Then - Actions
          • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing ((Real((Strength of (Casting unit) (Include bonuses)))) x (0.25 + (0.25 x (Real((Level of Devour for (Casting unit))))))) damage of attack type Pierce and damage type Normal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Release Disease for (Casting unit)) Greater than 0
            • Then - Actions
              • Unit - Create 1 Meat Wagon (Dummy) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Position of (Target unit of ability being cast))
              • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
              • Unit - Set level of Infection (Meat Wagon) for (Last created unit) to (Level of Release Disease for (Casting unit))
              • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb (Target unit of ability being cast)
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A Hero) Equal to False
        • Then - Actions
          • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + (((Life of (Target unit of ability being cast)) x (0.10 x (Real((Level of Devour for (Casting unit)))))) + 0.00))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Target unit of ability being cast) has buff Disgust ) Equal to True
            • Then - Actions
              • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + (((Life of (Target unit of ability being cast)) x (0.05 x (Real((Level of Disgust for (Casting unit)))))) + 0.00))
              • [U]Unit - Remove (Target unit of ability being cast) from the game[/U]
              • Unit - Create 1 Meat Wagon (Dummy) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Position of (Casting unit))
              • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
              • Unit - Set level of Damage (Well Fed) for (Last created unit) to (Level of Disgust for (Casting unit))
              • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
            • Else - Actions
          • Unit - Remove (Target unit of ability being cast) from the game
        • Else - Actions
Also, could you please exactly tell me what leaks and what's needed to be done? I've been trying to read the whole "What is leaking" thread and I'm a bit confused... :-/
 
Level 2
Joined
Dec 7, 2012
Messages
16
You are casting a spell in your trigger then referring to Target unit of ability being cast after that. It's a good job you used Roar as a base and not a single target spell, or the Hero using Devour would be removed...

The way to get around it is as Maker said, use a variable to hold Target unit of ability being cast right at the start of the trigger.

  • Unit - Create 1 Meat Wagon (Dummy) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Position of (Casting unit))
leaks the positions. I suggest using Unit - Create unit facing angle in general but since you are using the same position twice, that doesn't matter.
  • Set TempPoint = (Position of (Casting unit))
  • Unit - Create 1 Meat Wagon (Dummy) for (Owner of (Casting unit)) at (TempPoint) facing (TempPoint)
  • Custom script: call RemoveLocation(udg_TempPoint)
 
Status
Not open for further replies.
Top