• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] HELP arena leving trigger

Status
Not open for further replies.
Level 4
Joined
Jul 24, 2008
Messages
8
back to base t1
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Number of units in (Units in Region 483 <gen> owned by Player 12 (Brown))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 10 (Light Blue))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 9 (Gray))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 8 (Pink))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 7 (Green))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 6 (Orange))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 11 (Dark Green))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 5 (Yellow))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 4 (Purple))) Less than or equal to 0
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(Player 3 (Teal) is an enemy of Player 1 (Red)) Equal to True
(Player 1 (Red) is an enemy of Player 3 (Teal)) Equal to True
(Player 2 (Blue) is an enemy of Player 3 (Teal)) Equal to True
(Player 3 (Teal) is an enemy of Player 2 (Blue)) Equal to True
Then - Actions
Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in (Units in Region 483 <gen> owned by Player 1 (Red))) Equal to True
((Picked unit) is in (Units in Region 483 <gen> owned by Player 2 (Blue))) Equal to True
Then - Actions
Do nothing
Else - Actions
Unit - Move (Picked unit) instantly to ((Picked player) start location)
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(Player 2 (Blue) is an enemy of Player 1 (Red)) Equal to True
(Player 2 (Blue) is an enemy of Player 3 (Teal)) Equal to True
(Player 1 (Red) is an enemy of Player 2 (Blue)) Equal to True
(Player 3 (Teal) is an enemy of Player 2 (Blue)) Equal to True
Then - Actions
Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in (Units in Region 483 <gen> owned by Player 1 (Red))) Equal to True
((Picked unit) is in (Units in Region 483 <gen> owned by Player 3 (Teal))) Equal to True
Then - Actions
Do nothing
Else - Actions
Unit - Move (Picked unit) instantly to ((Picked player) start location)
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(Player 1 (Red) is an enemy of Player 2 (Blue)) Equal to True
(Player 1 (Red) is an enemy of Player 3 (Teal)) Equal to True
(Player 2 (Blue) is an enemy of Player 1 (Red)) Equal to True
(Player 3 (Teal) is an enemy of Player 1 (Red)) Equal to True
Then - Actions
Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in (Units in Region 483 <gen> owned by Player 2 (Blue))) Equal to True
((Picked unit) is in (Units in Region 483 <gen> owned by Player 3 (Teal))) Equal to True
Then - Actions
Do nothing
Else - Actions
Unit - Move (Picked unit) instantly to ((Picked player) start location)
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(Player 1 (Red) is an ally of Player 2 (Blue)) Equal to True
(Player 2 (Blue) is an ally of Player 1 (Red)) Equal to True
(Player 1 (Red) is an ally of Player 3 (Teal)) Equal to True
(Player 3 (Teal) is an ally of Player 1 (Red)) Equal to True
(Player 2 (Blue) is an ally of Player 3 (Teal)) Equal to True
(Player 3 (Teal) is an ally of Player 2 (Blue)) Equal to True
Then - Actions
Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
Loop - Actions
Unit - Move (Picked unit) instantly to ((Picked player) start location)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(Player 3 (Teal) is an ally of Player 2 (Blue)) Equal to True
(Player 2 (Blue) is an ally of Player 3 (Teal)) Equal to True
Then - Actions
Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in (Units in Region 483 <gen> owned by Player 1 (Red))) Equal to True
Then - Actions
Do nothing
Else - Actions
Unit - Move (Picked unit) instantly to ((Picked player) start location)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(Player 1 (Red) is an ally of Player 2 (Blue)) Equal to True
(Player 2 (Blue) is an ally of Player 1 (Red)) Equal to True
(Player 3 (Teal) is an enemy of Player 1 (Red)) Equal to True
(Player 1 (Red) is an enemy of Player 3 (Teal)) Equal to True
Then - Actions
Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in (Units in Region 483 <gen> owned by Player 3 (Teal))) Equal to True
Then - Actions
Do nothing
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
((Picked unit) is in (Units in Region 483 <gen> owned by Player 2 (Blue))) Equal to True
((Picked unit) is in (Units in Region 483 <gen> owned by Player 1 (Red))) Equal to True
Then - Actions
Unit - Move (Picked unit) instantly to ((Picked player) start location)
Else - Actions
Do nothing
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(Player 1 (Red) is an enemy of Player 2 (Blue)) Equal to True
(Player 2 (Blue) is an enemy of Player 1 (Red)) Equal to True
(Player 3 (Teal) is an ally of Player 1 (Red)) Equal to True
(Player 1 (Red) is an ally of Player 3 (Teal)) Equal to True
Then - Actions
Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in (Units in Region 483 <gen> owned by Player 2 (Blue))) Equal to True
Then - Actions
Do nothing
Else - Actions
Unit - Move (Picked unit) instantly to ((Picked player) start location)
Else - Actions
Do nothing
Else - Actions
Do nothing
 
Level 4
Joined
Jul 24, 2008
Messages
8
back to base t1 Copy
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Number of units in (Units in Region 483 <gen> owned by Player 12 (Brown))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 11 (Dark Green))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 10 (Light Blue))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 9 (Gray))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 8 (Pink))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 7 (Green))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 6 (Orange))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 5 (Yellow))) Less than or equal to 0
(Number of units in (Units in Region 483 <gen> owned by Player 4 (Purple))) Less than or equal to 0
Then - Actions
If ((Number of units in (Units in Region 483 <gen> owned by Player 1 (Red))) Greater than or equal to 1) then do (Unit - Move (Picked unit) instantly to ((Owner of (Picked unit)) start location)) else do (Do nothing)
If ((Number of units in (Units in Region 483 <gen> owned by Player 2 (Blue))) Greater than or equal to 1) then do (Unit - Move (Picked unit) instantly to ((Owner of (Picked unit)) start location)) else do (Do nothing)
If ((Number of units in (Units in Region 483 <gen> owned by Player 3 (Teal))) Greater than or equal to 1) then do (Unit - Move (Picked unit) instantly to ((Owner of (Picked unit)) start location)) else do (Do nothing)
Else - Actions
Do nothing



this works if they are all allyedand a player of 4- 12 is there
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
OK, first of all, use
  • tag, this is impossible to understand
  • Do both triggers work at the same time, or is the second one a fixed version of the first one?
  • In the second trigger, you use "Picked unit" without actually picking one (without any "pick units in" action")
  • The triggers leak a lot, look [URL="http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/basic-memory-leaks-5889/"]here[/URL]
  • Also, I quite don't understand what the triggers are supposed to do, they do trigger when at least one player (except players 1,2,3) has no units in the region.
  • And at last, improve your use of IFs, this is really bad: (not to mention it's logically wrong, unit can't be controlled by both player 1 and player 2
  • [TRIGGER]Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is in (Units in Region 483 <gen> owned by Player 1 (Red))) Equal to True
          • ((Picked unit) is in (Units in Region 483 <gen> owned by Player 2 (Blue))) Equal to True
It should be (leak fix included):
  • Custom Script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or
            • ((Picked unit) is owned by Player 1 (Red))) Equal to True
            • ((Picked unit) is owned by Player 2 (Blue))) Equal to True
 
Level 4
Joined
Jul 24, 2008
Messages
8
orig trig

the original trigger looked like this :
  • back to base t1
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Number of units in (Units in Region 483 <gen> owned by Player 12 (Brown))) Greater than or equal to 1
              • (Number of units in (Units in Region 483 <gen> owned by Player 11 (Dark Green))) Greater than or equal to 1
              • (Number of units in (Units in Region 483 <gen> owned by Player 10 (Light Blue))) Greater than or equal to 1
              • (Number of units in (Units in Region 483 <gen> owned by Player 9 (Gray))) Greater than or equal to 1
              • (Number of units in (Units in Region 483 <gen> owned by Player 8 (Pink))) Greater than or equal to 1
              • (Number of units in (Units in Region 483 <gen> owned by Player 7 (Green))) Greater than or equal to 1
              • (Number of units in (Units in Region 483 <gen> owned by Player 6 (Orange))) Greater than or equal to 1
              • (Number of units in (Units in Region 483 <gen> owned by Player 5 (Yellow))) Greater than or equal to 1
              • (Number of units in (Units in Region 483 <gen> owned by Player 4 (Purple))) Greater than or equal to 1
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Unit Group - Pick every unit in (Units in Region 483 <gen>) and do (Actions)
            • Loop - Actions
              • If ((Number of units in (Units in Region 483 <gen> owned by Player 1 (Red))) Greater than or equal to 1) then do (Unit - Move (Picked unit) instantly to ((Owner of (Picked unit)) start location)) else do (Do nothing)
              • If ((Number of units in (Units in Region 483 <gen> owned by Player 2 (Blue))) Greater than or equal to 1) then do (Unit - Move (Picked unit) instantly to ((Owner of (Picked unit)) start location)) else do (Do nothing)
              • If ((Number of units in (Units in Region 483 <gen> owned by Player 3 (Teal))) Greater than or equal to 1) then do (Unit - Move (Picked unit) instantly to ((Owner of (Picked unit)) start location)) else do (Do nothing)
and this works fine if red blue and teal are allied "originally you could not choice to not be on a teem" there are 3 more triggers the same as this for the other 9 color. but it is now optional to be allied or not. with the choice of red can ally blue or teal blue can ally red or teal..... etc so even if red and blue are enemy's this trigger will still send them both back to start location. do u know what i should do ??
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
Well what this trigger does is that, as long there is unit controlled by player 1, 2 or in the region, it will move units from there.
What exactly are you trying to do here? Move only units of winning players out if the region? Also, are player 4-12 also users, or computers? And can blue be allied to both red and teal, while red and teal still being enemies? Can they be allied with players 4-12?
IMHO you should certainly create a single trigger to do all the stuff, using 4 triggers that differ only in player numbers is generally not a good idea. (If you for example want to add some piece of code to the trigger, you need to add it 4 times)

Depending on my previous question (whether players form teams or ally with each other independently) I would suggest these two options:
Teams (all players are allied to each other, "the ally of my ally is also my ally"): From what I have seen, you don't use any variables to store teams, so I suggest this: create a new array, in which you store for each player the ID of the team he is in. Arena-ending trigger would be this:
  • Melee Initialization
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Arena Region <gen> contains (Triggering unit)) Equal to True
    • Actions
      • -------- null the values --------
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set Team_unitCount[(Integer A)] = 0
      • -------- count units --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Arena Region <gen>) and do (Actions)
        • Loop - Actions
          • Set Team_unitCount[Player_teamID[(Player number of (Owner of (Triggering unit)))]] = (Team_unitCount[Player_teamID[(Player number of (Owner of (Triggering unit)))]] + 1)
      • -------- count teams --------
      • Set AliveTeams = 0
      • Set Temp_lastTeam = 0
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Team_unitCount[(Integer A)] Greater than 0
            • Then - Actions
              • Set AliveTeams = (AliveTeams + 1)
              • Set Temp_lastTeam = (Integer A)
            • Else - Actions
      • -------- test victory --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AliveTeams Greater than or equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AliveTeams Equal to 0
            • Then - Actions
              • -------- ----------------------TIE---------------- --------
            • Else - Actions
              • -------- Victory for team ( Temp_lastTeam ) --------
        • Else - Actions
Again, I don't fully understand what exactly are you trying to do, but if you just want to teleport surving units out, then just do another "Unit Group - Pick every unit", that just moves them.
 
Level 4
Joined
Jul 24, 2008
Messages
8
okay. player 1-3 can ally as the chose to, same goes for 4-6, 7-9, 10-12. so player 1 can be allied with blue and not teal and or with teal and not blue. also its possible for red to be allied to teal and blue but blue and teal not to be allied. when a unit dies in arena it is also is sent back to players start location. this trigger if for the victorious for there is no way to leave arena it needs to check if there are enemies of a player there. the arena is for heroes only some heroes have summoning abilities.

maximum amount of Allys is 3 and u can only be an ally with a member of the same race witch races are locked same with colors so player 1-3 are human.

also say player blue and red are allies and player blue dies and is sent home that player may want to use his hero. so when player 1 win and is sent home if the trigger says for blue to be sent back to start location it should say he needs to have a hero
in arena region.

ya that is what i wanna do so ya ur trigger should work thx alot :) i jsut need to see and test

send surviving units home

how would i do the variables like what should they say
??
 
Last edited by a moderator:
Level 12
Joined
Apr 15, 2008
Messages
1,063
Well then you'll have to change the trigger a bit, test whether there are units of enemies in the Arena.
Replace --------count teams-----: (doing without WE, so it's not exactly word-to-word
  • For Loop Index A
    • If ( Team_unitCount[A]>0 )
      • For Loop Index B
        • If ( Team_unitCount[B]>0 and Player(A) is enemy of Player(B) )
          • Skip Remaining Actions
Team_unitCount is integer array, others are integers

Also, replace -------count units-------- with
  • Unit Group - Pick every unit in (Units in Arena Region <gen> matching (Matching unit is a Hero) ) and do (Actions)
    • Loop - Actions
      • Set Team_unitCount[(Player number of (Owner of (Triggering unit)))] = (Team_unitCount[(Player number of (Owner of (Triggering unit)))] + 1)
 
Level 4
Joined
Jul 24, 2008
Messages
8
well when u have a chance take a look and yes they can ally optionally whenever they want.

hmmm. well see the thing is all players can go to arena at same time 1-12

ill be back on l8ter i have to go for now sry
 
Last edited by a moderator:
Level 18
Joined
Mar 13, 2009
Messages
1,411
"Please do not double post in threads or make two of the same thread. We have an edit button for a reason, if you accidently double posted/threaded, please delete it before we do."
 
Status
Not open for further replies.
Top