• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Trigger] Open-Chest Trigger

Status
Not open for further replies.
Level 10
Joined
Jun 10, 2007
Messages
557
Well, a while ago I made a thread on a similar topic, but I ditched the method I was inquiring about there for a more clunky method that I hoped would work. However...

Here is my trigger. What I am trying to accomplish is when the hero uses a spell called Open Chest, the chest will play it's Morph Animation (ie it will appear to open), it will get two random level 1 items, it will get a special effect attached to it, and have a 25% chance to be trapped, and if it is trapped, a random trap will be picked and used on the opening hero. And finally, it will give the chest to the opening hero so that they can do with it's contents as they wish. I'm making it vulnerable but giving it godly hp regeneration so it cannot be targeted by the spell again.

  • Chests
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Target unit of ability being cast)) Equal to Chest
      • (Ability being cast) Equal to Open Chest (Neutral Hostile)
    • Actions
      • Set ChestUnit = (Target unit of ability being cast)
      • Set TempCaster = (Casting unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 4) Equal to 1
        • Then - Actions
          • Set TrapNumber = (Random integer number between 1 and 4)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TrapNumber Equal to 1
            • Then - Actions
              • Unit - Order ChestUnit to Neutral - Firebolt TempCaster
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TrapNumber Equal to 2
                • Then - Actions
                  • Unit - Order ChestUnit to Neutral Dark Ranger - Silence TempLoc
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TrapNumber Equal to 3
                    • Then - Actions
                      • Unit - Order ChestUnit to Undead Necromancer - Unholy Frenzy TempCaster
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • TrapNumber Equal to 4
                        • Then - Actions
                          • Unit - Order ChestUnit to Neutral Alchemist - Acid Bomb TempCaster
                        • Else - Actions
        • Else - Actions
      • Animation - Play ChestUnit's morph animation
      • Special Effect - Create a special effect attached to the origin of ChestUnit using Doodads\Dungeon\Props\TreasurePile\TreasurePile0.mdl
      • Unit - Change ownership of ChestUnit to (Owner of (Casting unit)) and Retain color
      • Unit - Make ChestUnit Vulnerable
      • Unit - Remove Curse Trap (Neutral Hostile) from (Triggering unit)
      • Unit - Remove Fire Trap (Neutral Hostile) from (Triggering unit)
      • Unit - Remove Mute Trap (Neutral Hostile) from (Triggering unit)
      • Unit - Remove Senility Trap from (Triggering unit)
What happens is that the Mountain King, who I am using as a tester, plays his morph animation, has the special effect attached to him, and the chest does nothing at all. Also, no items appear. I think it has something to do early on in the trigger. Can anybody tell me what I'm doing wrong?
 
Last edited:
Level 14
Joined
Nov 18, 2007
Messages
1,084
Also, no items appear
I think that's because you didn't trigger any items to be created if there wasn't a trap...Unless you made a trigger that checks if a unit changes ownership and the unit-type was a Chest and so on...

What is TempLoc? You didn't set TempLoc to anything...like the Hero's position...

I'm not sure about the Hero playing his morph animation though...
 
Level 10
Joined
Jun 10, 2007
Messages
557
*sigh* Fine, removed them from the trigger. Now watch somebody jump on me for not using locals...

And I did indeed forget to set TempLoc to a value, it is supposed to be TempCaster's location. But... if somebody could find an answer to this I would really, really appreciate it.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
Do your traps work when it's activated? (You could tell if it was activated by putting a debug message when the random integer is 1)
If they don't then something is weird with your Open Chest ability...It targets a unit, right?

Also, when you remove the abilities from the chest, I think you should use "Target unit of ability being cast" instead of "Triggering Unit" since the triggering unit would be the unit that started the effect of the spell and so the abilities would be removed from the Hero...
 
Level 10
Joined
Jun 10, 2007
Messages
557
Apparently not, I just tried it again after fixing some things. Now, the spell casts, and the message comes up if the random integer procs, but nothing happens whatsoever with the chest.

The spell's target is Invulnerable, and the effect only goes off if it targets a chest... does that have anything to do with it? Since the Chests are Invulnerable.
 
Status
Not open for further replies.
Top