1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Simple trigger and explanation

Discussion in 'Requests' started by Lee_Go, Mar 18, 2010.

  1. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    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.

    My Trigger
    • 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>

     
  2. GregerTheGreat

    GregerTheGreat

    Joined:
    Sep 21, 2008
    Messages:
    42
    Resources:
    0
    Resources:
    0
    What exact part of this trigger doesn't work?
     
  3. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,127
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    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/
     
  4. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
  5. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,127
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Well, one thing went wrong on the triggers: The condition in the Open Closet trigger should be "(Triggering unit) Equal to Villager (Male 2) 0011 <gen>", not "(Triggering unit) Equal to Closet 0015 <gen>".
    I tested it and it works.
     
  6. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    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...
     
  7. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,127
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Of course, although your system is not flexible enough, since it requires an ability for every item-type you have, it can be done.