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

Need help with a Trigger

Status
Not open for further replies.
Level 11
Joined
Nov 13, 2010
Messages
211
i have try to make a trigger for a key so if you die then key will be move back but it do not wrok and i dont know why
  • key 1
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) is A Hero) Equal to (==) True
          • ((Dying unit) has Planet Key 0017 <gen>) Equal to (==) True
        • Then - Actions
          • Item - Move Planet Key 0017 <gen> to (Center of Key <gen>)
        • Else - Actions
can some one help me with this
 
Level 6
Joined
Oct 4, 2011
Messages
226
Try using an item variable Key_Item and then set the key to the variable at first and then if this trigger happens remove Key_Item and Create 1 item of type at center of Key. Then set variable, Set Key_Item Last created item. Then Change the Condition of Dying unit has Planet key 0017 to Dying unit has Key_Item = to true.
 
Level 11
Joined
Nov 13, 2010
Messages
211
Try using an item variable Key_Item and then set the key to the variable at first and then if this trigger happens remove Key_Item and Create 1 item of type at center of Key. Then set variable, Set Key_Item Last created item. Then Change the Condition of Dying unit has Planet key 0017 to Dying unit has Key_Item = to true.

can you try to make a trigger to show me how by useing [-TRIGGER] [/TRIGGER-]

more easy for me ;D
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
  • key 1
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Triggering unit) has an item of type Blood Key) Equal to True
    • Actions
      • Set TPoint = (Center of (Playable map area))
      • Item - Remove (Item carried by (Triggering unit) of type Blood Key)
      • Item - Create Blood Key at TPoint
      • Custom script: call RemoveLocation(udg_TPoint)
It's better if you work with "Item of Type" since is easier than messing an one and only item. Create a diferrent Item for each key. Blood Key is just an example, same as the value of TPoint.
 
Level 11
Joined
Nov 13, 2010
Messages
211
  • key 1
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Triggering unit) has an item of type Blood Key) Equal to True
    • Actions
      • Set TPoint = (Center of (Playable map area))
      • Item - Remove (Item carried by (Triggering unit) of type Blood Key)
      • Item - Create Blood Key at TPoint
      • Custom script: call RemoveLocation(udg_TPoint)
It's better if you work with "Item of Type" since is easier than messing an one and only item. Create a diferrent Item for each key. Blood Key is just an example, same as the value of TPoint.

it dit not wrok dont know why becrus i dit what you say ;D
  • level 1 key
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to (==) True
      • ((Triggering unit) has an item of type Planet Key) Equal to (==) True
    • Actions
      • Set TPoint = (Center of Key go back 1 <gen>)
      • Item - Remove (Item carried by (Triggering unit) of type Planet Key)
      • Item - Create Planet Key at TPoint
      • Custom script: call RemoveLocation(udg_TPoint)
 
Level 6
Joined
Oct 4, 2011
Messages
226
Should work I think. Um are the units non-hero units with an added inventory possibly? Im wondering why it doesnt do anything for you, maybe your conditions arn't the conditions you need?
 
Level 11
Joined
Nov 13, 2010
Messages
211
is a normal hero with Inventory(hero) the heros start like this
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across vis level 1 <gen>)
      • Game - Turn the day/night cycle Off
      • Game - Set the time of day to 12.00
      • Game - Display to (All players) for 7.00 seconds the text: tryp -zoom % betwee...
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • Set Players = (All players matching (((Matching player) slot status) Equal to (==) Is playing))
      • Player Group - Pick every player in Players and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Escaper for (Picked player) at ((Picked player) start location) facing Default building facing (270.0) degrees
          • Unit Group - Add (Last created unit) to Heroes
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Change the "Unit is a hero" condition for "Unit is in Heroes group".

The problem is that the unit is dead when you try to remove the key. Create the new key when the unit dies. And remove the key the hero holds when it revives.
 
Level 6
Joined
Oct 4, 2011
Messages
226
How do you remove the item when the hero revives? Would wait for condition work for that or maybe a loop trigger to check?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Should work

  • Melee Initialization
    • Events
      • Unit - A unit Finishes reviving
    • Conditions
    • Actions
      • Hero - Drop (Item carried by (Triggering unit) of type Planet Key) from (Triggering unit)
      • Item - Remove (Last dropped item)
If you have a trigger to revive the fallen hero, then do this actions in that trigger with the condition "The unit has item of type..."
 
Level 11
Joined
Nov 13, 2010
Messages
211
Should work

  • Melee Initialization
    • Events
      • Unit - A unit Finishes reviving
    • Conditions
    • Actions
      • Hero - Drop (Item carried by (Triggering unit) of type Planet Key) from (Triggering unit)
      • Item - Remove (Last dropped item)
If you have a trigger to revive the fallen hero, then do this actions in that trigger with the condition "The unit has item of type..."

if it like this
  • reviving
    • Events
      • Unit - A unit Finishes reviving
    • Conditions
      • ((Triggering unit) has an item of type Planet Key) Equal to (==) True
    • Actions
      • Hero - Drop (Item carried by (Triggering unit) of type Planet Key) from (Triggering unit)
      • Item - Remove (Last dropped item)
      • Item - Create Planet Key at (Center of Key go back 1 <gen>)
when it do not wrok
 
Level 11
Joined
Nov 13, 2010
Messages
211
... How do heroes revive in your map after they die?

  • Lose Life
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Wait 1.00 seconds
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of living Escaper units owned by Player 1 (Red)) Equal to (==) 0
            • (Number of living Escaper units owned by Player 2 (Blue)) Equal to (==) 0
            • (Number of living Escaper units owned by Player 3 (Teal)) Equal to (==) 0
            • (Number of living Escaper units owned by Player 4 (Purple)) Equal to (==) 0
            • (Number of living Escaper units owned by Player 5 (Yellow)) Equal to (==) 0
            • (Number of living Escaper units owned by Player 6 (Orange)) Equal to (==) 0
            • (Number of living Escaper units owned by Player 7 (Green)) Equal to (==) 0
            • (Number of living Escaper units owned by Player 8 (Pink)) Equal to (==) 0
          • Then - Actions
            • Set Lives = (Lives - 1)
            • Leaderboard - Change the value for Player 1 (Red) in (Last created leaderboard) to Lives
            • Unit Group - Pick every unit in Heroes and do (Hero - Instantly revive (Picked unit) at (Center of start <gen>), Hide revival graphics)
            • Player Group - Pick every player in (All players) and do (Camera - Pan camera for (Picked player) to (Center of start <gen>) over 0.00 seconds)
          • Else - Actions
            • Do nothing
      • If (Lives Equal to (==) 0) then do (Player Group - Pick every player in Players and do (Game - Defeat (Picked player) with the message: You Couldn't Escape...)) else do (Do nothing)
  • Go to lvl 2
    • Events
      • Unit - A unit enters start level 2 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Escaper
    • Actions
      • Player Group - Pick every player in (All players) and do (Camera - Pan camera for (Picked player) to (Center of start level 2 <gen>) over 0.00 seconds)
      • Game - Display to (All players) the text: Welcome to level 2
      • Trigger - Turn off player dies <gen>
      • Unit Group - Pick every unit in Heroes and do (Unit - Kill (Picked unit))
      • Unit Group - Pick every unit in Heroes and do (Hero - Instantly revive (Picked unit) at (Center of start level 2 <gen>), Show revival graphics)
      • Trigger - Turn on player dies <gen>
      • Unit - Remove Timber Wolf 0010 <gen> from the game
      • Unit - Remove Timber Wolf 0011 <gen> from the game
      • Unit - Remove Timber Wolf 0012 <gen> from the game
      • Unit - Remove Timber Wolf 0015 <gen> from the game
      • Unit - Remove Timber Wolf 0014 <gen> from the game
      • Unit - Remove Timber Wolf 0013 <gen> from the game
      • Unit - Remove Giant Wolf 0016 <gen> from the game
      • Unit - Remove Giant Wolf 0018 <gen> from the game
      • Unit - Remove Timber Wolf 0021 <gen> from the game
      • Unit - Remove Timber Wolf 0020 <gen> from the game
      • Unit - Remove Timber Wolf 0019 <gen> from the game
      • Unit - Remove Giant Wolf 0250 <gen> from the game
      • Trigger - Turn off Lose Life <gen>
      • Trigger - Turn on Lose Life level 2 <gen>
      • Trigger - Turn off (This trigger)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
  • Unit Group - Pick every unit in Heroes and do (Hero - Instantly revive (Picked unit) at (Center of start <gen>), Hide revival graphics)
Here, after reviving, remove the Key from the unit (doesn't matter if it's holding it or not. If it doesn't have it, the function will go "null" and do nothing, if it has the key, it will remove it).

You have some various leaks in your triggers that will make your game prone to lag.
 
Status
Not open for further replies.
Top