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

[General] Trigger wont work

Status
Not open for further replies.
Level 6
Joined
Jan 31, 2014
Messages
67
I created a trigger

  • Strange meat
    • Events
      • Unit - Farmer 0003 <gen> Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to StrangeMeatItem
    • Actions
      • Set StrangeBuff = (Random integer number between 1 and 7)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StrangeBuff Equal to 1
        • Then - Actions
          • Special Effect - Create a special effect attached to the chest of (Triggering unit) using Abilities\Spells\Human\Heal\HealTarget.mdl
          • Set StrangeEffect = (Last created special effect)
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 5.00)
          • Wait 1.00 seconds
          • Special Effect - Destroy StrangeEffect
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 5.00)
          • Wait 1.00 seconds
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 5.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StrangeBuff Equal to 2
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Set StrangeEffect = (Last created special effect)
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - (Random real number between 5.00 and 10.00))
          • Wait 1.00 seconds
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - (Random real number between 5.00 and 10.00))
          • Special Effect - Destroy StrangeEffect
          • Wait 1.00 seconds
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - (Random real number between 5.00 and 10.00))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StrangeBuff Equal to 3
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
          • Set StrangeEffect = (Last created special effect)
          • Unit - Reset ability cooldowns for (Triggering unit)
          • Wait 1.00 seconds
          • Special Effect - Destroy StrangeEffect
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StrangeBuff Equal to 4
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Undead\DeathPact\DeathPactTarget.mdl
          • Set StrangeEffect = (Last created special effect)
          • Hero - Add (Random integer number between 100 and 200) experience to (Triggering unit), Hide level-up graphics
          • Wait 1.00 seconds
          • Special Effect - Destroy StrangeEffect
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StrangeBuff Equal to 5
        • Then - Actions
          • Special Effect - Create a special effect attached to the chest of (Triggering unit) using Abilities\Weapons\ZigguratFrostMissile\ZigguratFrostMissile.mdl
          • Set StrangeEffect = (Last created special effect)
          • Unit - Set (Triggering unit) movement speed to 100.00
          • Wait 10.00 seconds
          • Unit - Set (Triggering unit) movement speed to (Default movement speed of (Triggering unit))
          • Special Effect - Destroy StrangeEffect
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StrangeBuff Equal to 6
        • Then - Actions
          • Special Effect - Create a special effect attached to the Origin of (Triggering unit) using Abilities\Weapons\SteamTank\SteamTankImpact.mdl
          • Set StrangeEffect = (Last created special effect)
          • Set StrangeGroup = (Units within 320.00 of (Position of (Triggering unit)))
          • Set StrangePoint = (Position of (Triggering unit))
          • Unit Group - Pick every unit in StrangeGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 320.00 at StrangePoint, dealing 40.00 damage of attack type Spells and damage type Normal
          • Wait 1.00 seconds
          • Special Effect - Destroy StrangeEffect
          • Custom script: call DestroyGroup(udg_StrangeGroup)
          • Custom script: call RemoveLocation(udg_StrangePoint)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StrangeBuff Equal to 7
        • Then - Actions
          • Special Effect - Create a special effect attached to the Origin of (Triggering unit) using Abilities\Spells\Items\AItb\AItbTarget.mdl
          • Set StrangeEffect = (Last created special effect)
          • Wait 1.00 seconds
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 1.00)
          • Wait 1.00 seconds
          • Special Effect - Destroy StrangeEffect
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 1.00)
          • Wait 1.00 seconds
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 1.00)
        • Else - Actions

Its quite simple compared to others , but for some reason it wont work , I tried more then 10 times and nothing .Could someone who actually know this stuff (more then basic) help me out?
 
Level 10
Joined
Feb 22, 2008
Messages
619
Which part of it isn't working? When the item is consumed, does it do nothing? Does it make an animation but no other effect? Does it have an effect but no animation? Is there some other issue? Please give more details.

First of all, I noticed that all of your special effects are target ones. Because of this, you can remove them as soon as they're created (not after a wait function). This will still play the full animation.

Second, put these If/Then conditions within each other, like Russian dolls. That way if it lands on the way through, it won't have to check the rest of the list for no reason.
 
Level 6
Joined
Jan 31, 2014
Messages
67
Which part of it isn't working? When the item is consumed, does it do nothing? Does it make an animation but no other effect? Does it have an effect but no animation? Is there some other issue? Please give more details.

When it consumed it only does the second Effect , that's it...Today I tried few times more ,but still nothing , the same thing...

I tried to make an item with unknown 7 effects , but it only does second one, others don't even exist ... And I don't know why...
 
Level 10
Joined
Feb 22, 2008
Messages
619
It may have something to do with the wait functions.
Instead of recycling the same variables for each If/Then function, make enough copies for each different effect. If the wait functions are the problem, this should fix it. If this doesn't fix it, create 7 different triggers, one for each effect (make sure you still use different variables in each trigger, because of the wait functions). (Obviously you'll have to keep the StrangeBuff variable the same).

I would also try instead of referring to 'triggering unit', use 'hero manipulating item' or just refer to the specific unit since only that one unit can use the item according to this trigger.

By the way, in my last post I mentioned that you can delete the special effects immediately after they're created and still have them show up. You don't have to set them to a variable when you do this, either, just remove the last created special effect.

If none of this fixes your problem, would you please post the map here? (Or just the parts of it that relate to this trigger). It'll make it much easier to test and edit. (You can use the pastebin to do this).
 
Level 6
Joined
Jan 31, 2014
Messages
67
It may have something to do with the wait functions.
Instead of recycling the same variables for each If/Then function, make enough copies for each different effect. If the wait functions are the problem, this should fix it. If this doesn't fix it, create 7 different triggers, one for each effect (make sure you still use different variables in each trigger, because of the wait functions). (Obviously you'll have to keep the StrangeBuff variable the same).

I would also try instead of referring to 'triggering unit', use 'hero manipulating item' or just refer to the specific unit since only that one unit can use the item according to this trigger.

By the way, in my last post I mentioned that you can delete the special effects immediately after they're created and still have them show up. You don't have to set them to a variable when you do this, either, just remove the last created special effect.

If none of this fixes your problem, would you please post the map here? (Or just the parts of it that relate to this trigger). It'll make it much easier to test and edit. (You can use the pastebin to do this).

Thank you for help , I fixed the problem by setting to specific unit. +rep for help
 
Status
Not open for further replies.
Top