• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Help... my "Replace trigger" doesnt work properly

Status
Not open for further replies.
Level 8
Joined
Nov 21, 2008
Messages
316
(not the problem)This is the trigger which replaces the unit the first time. the second trigger is the problem. when the unit loses the item another unit is born from it and the item it was suppose to drop stays in inventory. thus making 2 troll survivors.
  • Troll Axethrower
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffff8c00Battle Axe|r
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set Items[(Integer A)] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
      • Unit - Replace (Triggering unit) with a Troll Axe Thrower using The old unit's relative life and mana
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Create Items[(Integer A)] and give it to (Last replaced unit)
      • Selection - Select (Last replaced unit) for (Owner of (Last replaced unit))
The Bad Trigger
  • Axe Drop
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Unit-type of (Hero manipulating item)) Equal to Troll Axe Thrower
      • And - All (Conditions) are true
        • Conditions
          • (Item being manipulated) Equal to (Item carried by (Triggering unit) of type |cffff8c00Battle Axe|r)
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set Items[(Integer A)] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
      • Unit - Replace (Triggering unit) with a Troll Survivor using The old unit's relative life and mana
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Create Items[(Integer A)] and give it to (Last replaced unit)
      • Selection - Select (Last replaced unit) for (Owner of (Last replaced unit))
I need several things done. Why does it create another unit when axe is droped. Why do the troll survivors both have axes in inventory(it should have dropd) and can some1 write the new trigger so the axe can b removed and the unit turns back to normal
 
It might be a bug. Try this:
  • Axe Drop
  • Events
    • Unit - A unit Loses an item
  • Conditions
    • (Unit-type of (Hero manipulating item)) Equal to Troll Axe Thrower
    • (Item being manipulated) Equal to (|cffff8c00Battle Axe|r)
  • Actions
    • For each (Integer A) from 1 to 6, do (Actions)
      • Loop - Actions
        • If (All Conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Item-type of (Item carried by (Triggering) in slot (IntegerA))) Not Equal to |cffff8c00Battle Axe|r
          • Then - Actions
            • Set Items[(Integer A)] = (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
          • Else - Actions
    • Unit - Replace (Triggering unit) with a Troll Survivor using The old unit's relative life and mana
    • For each (Integer B) from 1 to 6, do (Actions)
      • Loop - Actions
        • Hero - Create Items[(Integer B)] and give it to (Last replaced unit)
    • Selection - Select (Last replaced unit) for (Owner of (Last replaced unit))
 
Last edited:
Status
Not open for further replies.
Top