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

Simple trigger and explanation

Status
Not open for further replies.
Level 6
Joined
May 1, 2009
Messages
156
Trigger so when your Unit, "Villager" is holding his "Pistol" item he can walk up to his "Closet". When in the region I've made he gains a new ability "Open Closet". When the ability is used he locks selection onto a unit named "Closet". This closet can store and withdraw your "Pistol" with 2 abilities, "Store Pistol" and "Withdraw Pistol" which is triggered to remove the Pistol and add it while removing and adding store and withdraw Pistol ability to the "closet" unit. When I try this trigger, whichever store or withdraw is used first, the second time using the ability is basically has null effect (the trigger doesnt run a second time).

My trigger doesn't work, if I could get one that works i'd be happy to give rep.

  • Open Closet
    • Events
      • Unit - Villager (Male 2) 0011 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Open Closet (Channel)
    • Actions
      • Unit - Change ownership of Closet 0015 <gen> to Player 1 (Red) and Change color
      • Selection - Select Closet 0015 <gen>
      • Unit - Order Villager (Male 2) 0011 <gen> to Stop
      • Unit - Move Villager (Male 2) 0011 <gen> instantly to (Center of Equipment stance <gen>)
      • Unit - Make Villager (Male 2) 0011 <gen> face 1.00 over 0.00 seconds
      • Unit - Change ownership of Villager (Male 2) 0011 <gen> to Player 2 (Blue) and Retain color
      • Camera - Apply Closet Cam <gen> for Player 1 (Red) over 0.00 seconds
      • Trigger - Turn on Open Closet Extras <gen>
  • Open Closet Extras
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Camera - Apply Closet Cam <gen> for Player 1 (Red) over 0.00 seconds
      • Selection - Select Closet 0015 <gen>
  • Close Closet
    • Events
      • Unit - Closet 0015 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Close Closet (Channel)
    • Actions
      • Trigger - Turn off Open Closet Extras <gen>
      • Selection - Select Villager (Male 2) 0011 <gen>
      • Unit - Change ownership of Closet 0015 <gen> to Player 2 (Blue) and Change color
      • Unit - Change ownership of Villager (Male 2) 0011 <gen> to Player 1 (Red) and Retain color
      • Unit - Make Villager (Male 2) 0011 <gen> face 270.00 over 0.50 seconds
      • Camera - Apply cam reset <gen> for Player 1 (Red) over 1.00 seconds
  • Withdraw Pistol
    • Events
      • Unit - Closet 0015 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Pistolwith
    • Actions
      • Hero - Create pistolitem and give it to Villager (Male 2) 0011 <gen>
      • Unit - Remove Pistolwith from Closet 0015 <gen>
      • Unit - Add Pistolsto to Closet 0015 <gen>
  • Store Pistol
    • Events
      • Unit - Closet 0015 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Pistolsto
    • Actions
      • Item - Remove (Item carried by Villager (Male 2) 0011 <gen> of type pistolitem)
      • Unit - Remove Pistolsto from Closet 0015 <gen>
      • Unit - Add Pistolwith to Closet 0015 <gen>
 
I'd use these triggers:
  • Open Closet
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Triggering unit) Equal to Villager (Male 2) 0011 <gen> //This is a Unit comparison
    • (Ability being cast) Equal to Open Closet (Channel)
  • Actions
    • Unit - Change ownership of Closet 0015 <gen> to Player 1 (Red) and Change color
    • Selection - Clear selection for (Player 1 (Red))
    • Selection - Select (Closet 0015 <gen>) for Player 1 (Red)
    • Unit - Order Villager (Male 2) 0011 <gen> to Stop
    • Set Point1 = (Center of Equipment stance <gen>)
    • Unit - Move Villager (Male 2) 0011 <gen> instantly to (Point1)
    • Unit - Make Villager (Male 2) 0011 <gen> face 1.00 over 0.00 seconds
    • Unit - Change ownership of Villager (Male 2) 0011 <gen> to Player 2 (Blue) and Retain color
    • Camera - Apply Closet Cam <gen> for Player 1 (Red) over 0.00 seconds
    • Set Closet = (Closet 0015 <gen>) //This is a Unit variable
    • Player Group - Add Player 1 (Red) to TempForce //TempForce is a Player Group variable
    • Camera - Apply Closet Cam <gen> for Player 1 (Red) over 0.00 seconds
    • Custom script: call RemoveLocation (udg_Point1)
  • Open Closet Extras
  • Events
    • Player - Player 1 (Red) deselects a unit
  • Conditions
    • (Player 1 (Red) is in TempForce) Equal to True
    • (Triggering unit) Equal to Closet
  • Actions
    • Selection - Clear selection for Player 1 (Red)
    • Selection - Select Closet for Player 1 (Red)
  • Close Closet
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Triggering unit) Equal to Closet 0015 <gen>
    • (Ability being cast) Equal to Close Closet (Channel)
  • Actions
    • Player Group - Remove Player 1 (Red) from TempForce
    • Selection - Select Villager (Male 2) 0011 <gen> for Player 1 (Red)
    • Unit - Change ownership of Closet 0015 <gen> to Player 2 (Blue) and Change color
    • Unit - Change ownership of Villager (Male 2) 0011 <gen> to Player 1 (Red) and Retain color
    • Unit - Make Villager (Male 2) 0011 <gen> face 270.00 over 0.50 seconds
    • Camera - Apply cam reset <gen> for Player 1 (Red) over 1.00 seconds
  • Withdraw Pistol
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Triggering unit) Equal to Closet 0015 <gen>
    • (Ability being cast) Equal to Pistolwith
  • Actions
    • Hero - Create pistolitem and give it to Villager (Male 2) 0011 <gen>
    • Unit - Remove Pistolwith from Closet 0015 <gen>
    • Unit - Add Pistolsto to Closet 0015 <gen>
  • Store Pistol
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Triggering unit) Equal to Closet 0015 <gen>
    • (Ability being cast) Equal to Pistolsto
  • Actions
    • Item - Remove (Item carried by Villager (Male 2) 0011 <gen> of type pistolitem)
    • Unit - Remove Pistolsto from Closet 0015 <gen>
    • Unit - Add Pistolwith to Closet 0015 <gen>
A small reference to give you a heads up: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 
Level 6
Joined
May 1, 2009
Messages
156
I'm such an idiot, I'm sorry for making you look at it, I was just getting annoyed with it so I didn't want to review it.

Last question, can this be used for various items like, Store/Withdraw Pistol, and Store/Withdraw Belt, and Store/Withdraw Torch...
 
Status
Not open for further replies.
Top