• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How can you make a 2v2 duel system?

Status
Not open for further replies.
Level 8
Joined
Aug 1, 2008
Messages
420
What i want to make it: Every 5 minutes there will be a 2v2 duel. 2 random people from team 1 and 2 random people from team 2. Teleport them in there, they fight, winner gets gold, then teleport them back to the places they were standing in. and also the other players standing at the side. (Like FoC?) Obviously im not asking for you to make it for me (I always try myself :cool:) But can you tell me the basics and what ill need to do etc? Just set me off in the right path. Thanks ;)
 
Level 8
Joined
Nov 9, 2008
Messages
502
You could use that function that pauses all units, then create 2 groups matching conditions (unit is hero and is on side a for grp1 and b for grp2) and randomly select 2 units from each group and do actions something like: move instantly to spot (save the place it was in before into variable), play some cool countdown or something, put the randomly selected units into grp3 and unpause all units in grp3).

When duel is over simple move them back to their respective places and use function unpause all units.
 
Level 8
Joined
Aug 1, 2008
Messages
420
I see. so when people choose their heroes, i will have to put team 1 into a variable, and team 2 in a seperate variable?
Im not sure how i would save the spot where they were standing, ill have to look into that, but how do i move the other heroes to be 'looking' at it, aka standing at the side of the duel? (Think FoC or Anime Fight)
Thanks so far :p
 
Level 8
Joined
Nov 9, 2008
Messages
502
You can make the 2 unit groups as and when you start the duel. It's just to differentiate between team 1 and 2 and thankfully there is a function to pick a random unit from group when you select an action.

OK I made a trigger for both our benefits ^^ I needed to understand also to do this:

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Unit - Pause all units
      • Set point_index = 1
      • Set group[1] = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True)))
      • Set group[2] = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True)))
      • -------- above you make 2 groups essentialy spliting the heroes into the 2 forces --------
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in group[(Integer A)] and do (Actions)
            • Loop - Actions
              • Set current_point[(Player number of (Owner of (Picked unit)))] = (Position of (Picked unit))
              • -------- -------------- --------
              • -------- this will save the position of every hero into an array, the array index corresponds to the number of the owner of unit. refer to this when u want to move them back --------
              • -------- -------------- --------
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to 2, do (Actions)
            • Loop - Actions
              • Set temp_unit = (Random unit from group[(Integer A)])
              • Unit - Move temp_unit instantly to battle_point[point_index], facing Default building facing degrees
              • Unit Group - Remove temp_unit from group[(Integer A)]
              • Unit Group - Add temp_unit to group[3]
              • -------- -------------- --------
              • -------- group[3] is for the purpose of unpausing the units who are about to battle --------
              • -------- -------------- --------
              • Set point_index = (point_index + 1)
              • -------- -------------- --------
              • -------- the point used is set by the integer "point_index" so it changes for each unit, creatong a better effect (you don't want to move them all to 1 point now do you ^^ --------
              • -------- -------------- --------
      • Set point_index = 1
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in group[(Integer A)] and do (Actions)
            • Loop - Actions
              • Unit - Move (Picked unit) instantly to spectator_point[point_index], facing arena_centre
              • Set point_index = (point_index + 1)
      • -------- -------------- --------
      • -------- here you could add a countdown or something, a little pause before the epic battle begins --------
      • -------- -------------- --------
      • Unit Group - Pick every unit in group[3] and do (Actions)
        • Loop - Actions
          • Unit - Unpause (Picked unit)
      • Custom script: call DestroyGroup(udg_group[1])
      • Custom script: call DestroyGroup(udg_group[2])
      • Custom script: call DestroyGroup(udg_group[3])
This trigger requires you set the battle_point[1-4] as the points u want the dueling heroes to appear and also the spectator_point[1-10] where you would like the spectator's heroes to be. All should be set at map init and they don't change so no leak.

I think it works but as the groups rely on player 1 to find whether they are ally or enemy I'm curious whether it will work if player1 isn't in game. I assumed you have max 12 players, if you are using a computer controlled player on each team you can change the "ally/enemy of player" player in function "set group[1-2]" to one of those players.

NOTE: It's not complete. You need event when your duel starts and also when ends to move units back u will need another trigger.
 
Level 8
Joined
Aug 1, 2008
Messages
420
LOL. Ok.. i didnt know it would be as complicated as that.
I thought that you could just teleport the spectators into regions..
And the variables - what would they be? point_index and current_point would be Point - Array?(Because you said so? I think >.>) presumebly, and group[1] and group[2] would be Player Group?
Ah, would that group variable be an Array? Size: 2? Im not quite sure what arrays are, but..
AND - can that arena_centre just be a region? I see that it would make it easier..
ugh - just looking back now, and i think pretty much every variable needs to be an array? I think... :/
What i just made was battle_point - Point Array (4), then did this trigger:
Events - Map initialization
Conditions -
Actions - Set battle_point[1] = (Center of duel 1 <gen>)
- Set battle_point[2] = (Center of duel 2 <gen>)
- Set battle_point[3] = (Center of duel 3 <gen>)
- Set battle_point[4] = (Center of duel 4 <gen>)
Is that right?..
duel 1,2,3,4 are all regions in the duel arena
and now ive done the same with the spec points, its a 4v4 map.
and how do i set point_index = 1 if its a point variable? Im not sure. Nvm point_index is an integer isnt it?

{EDIT}
Making a new post so the one above isnt so cluttered, (Sorry for double posting, but...)
What is that question mark trigger? For each (Integer A) from 1 to 2, do (Actions)? What is that under? Nvm, i got that. But i cant find that Loop - Actions bit.
 
Last edited by a moderator:
Level 8
Joined
Nov 9, 2008
Messages
502
You are pretty much right.

NameTypeArray?/SizeDefault Value

point_index
IntegerNo1

group
Unit GroupYes/3Empty

battle_point
PointYes/4N/A

spectator_point
PointYes/Max players - dueling playersN/A

Yes you can use regions :) The reason I don't use "centre of region" in triggers is because that leaks. Must put that to a variable then you are able to destroy the point it creates.
Arrays are there because you can dynamically refer to them.

I take it you found the "set group = (units matching condition)" :thumbs_up:

EDIT
For each Integer A do multiple actions
Its an action near the top when you view all available actions.
If you choose the multiple actions one you will get a loop thingy
 
Last edited:
Level 8
Joined
Aug 1, 2008
Messages
420
Thanks, just got back on the computer, ill try it now. Ive already +repped you, and if i could again, i would :p
Edit: Haha! I got all the variables right! YAYAYA (Sorry im just so happy, this is a huge step for me)
But.. whats that about the spectator_point? Yes/Max players - dueling players? If you could explain, that would be great.
Is it like: I have 8 people in my map, so it would be size 8? or size 4? Because 4 players will be taken every duel into the arena to fight, so i dont see why you should need max players in the game
Edit 2: What about the current_point? You didnt list that, and i think i got that wrong. current_point Array Size 8?

{EDIT}
What ive got so far...
  • Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set arena_centre = (Center of duel center <gen>)
      • Set battle_point[1] = (Center of duel 1 <gen>)
      • Set battle_point[2] = (Center of duel 2 <gen>)
      • Set battle_point[3] = (Center of duel 3 <gen>)
      • Set battle_point[4] = (Center of duel 4 <gen>)
      • Set spectator_point[1] = (Center of spec 1 <gen>)
      • Set spectator_point[2] = (Center of spec 2 <gen>)
      • Set spectator_point[3] = (Center of spec 3 <gen>)
      • Set spectator_point[4] = (Center of spec 4 <gen>)
  • Duel start
    • Events
      • Time - duel_timer expires
    • Conditions
    • Actions
      • Unit - Pause all units
      • Set point_index = 1
      • Set group[1] = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True)))
      • Set group[2] = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True)))
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in group[(Integer A)] and do (Actions)
            • Loop - Actions
              • Set current_point[(Player number of (Owner of (Picked unit)))] = (Position of (Picked unit))
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to 2, do (Actions)
            • Loop - Actions
              • Set temp_unit = (Random unit from group[(Integer A)])
              • Unit - Move temp_unit instantly to battle_point[point_index], facing Default building facing degrees
              • Unit Group - Remove temp_unit from group[(Integer A)]
              • Unit Group - Add temp_unit to group[3]
              • Set point_index = (point_index + 1)
      • Set point_index = 1
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in group[(Integer A)] and do (Actions)
            • Loop - Actions
              • Unit - Move (Picked unit) instantly to spectator_point[point_index], facing arena_centre
              • Set point_index = (point_index + 1)
      • Game - Display to (All players) for 3.00 seconds the text: Fight begins in |CF...
      • Wait 1.00 seconds
      • Game - Display to (All players) for 2.00 seconds the text: |CFFF265222|r
      • Wait 1.00 seconds
      • Game - Display to (All players) for 1.00 seconds the text: |CFF00FF001|r
      • Wait 0.50 seconds
      • Game - Display to (All players) for 4.00 seconds the text: |CFF00FF00F|CFF33CC...
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Unpause (Picked unit))
      • Set group[4] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True))
      • Trigger - Turn on Duel End <gen>
Arena is the region covering the whole duel arena... I think that leaks, tell me if it does please? xD I just think its because i didnt put Arena in a variable. Ok, i changed it to a variable, (lol i just decided to) I dont think it leaks now.

  • Duel End
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (All units of group[4] are dead) Equal to True
        • Then - Actions
          • Unit - Pause all units
          • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Well done...
        • Else - Actions
          • Unit - Pause all units
          • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Game - Display to (All players) for 9.00 seconds the text: |CFF00FF00Nicely do...
      • Trigger - Turn off (This trigger)
But you see in the last one, i used
  • If - Conditions
    • (All units of group[1] are dead) Equal to True
And then i realised, the people spectating are still in group2, so i will have to make a group[4] and put only the people, who are allied to Player 1 (red) are dead. Is this possible? Again, sorry for the double post, but again, its getting a bit big, plus with the triggers.
Edit: I think ive done it, now ive just got to replace the units in their original spots once duel is over, just add a few touches, clean up leaks, and i think that should be it.
Edit 2: Nooo! It majorly bugs. After the timer expires, teleports units into all the right places, but then as soon as they unpause, it instantly says a team wins (Forgot which 1) and occures 3 times, (message pops up saying they win) and then they dont get teleported back to their original places. Anyway im going to bed, thx for all the help, and keep it coming! xD
 
Last edited by a moderator:
Level 8
Joined
Nov 9, 2008
Messages
502
What I meant by 'Max players - dueling players' was max number of players minus number of dueling players. If the map is 4v4 then it's 4.

It bugs because in your second trigger you need to put a second IF into the first ELSE otherwise it will play the ELSE as long as group[4] are alive. You need to set group[5] as units in arena matching ally of player1 = false and copy the first IF condition in the second trigger and replace with group[5].
And you need to move the turn off trigger function into the IFs otherwise it will play regardless and turn the trigger of straight away.
This is where I'd set group[4+5] too.

  • Duel End
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set group[4] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True))
      • Set group[5] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to False))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (All units of group[4] are dead) Equal to True
        • Then - Actions
          • Unit - Pause all units
          • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Well done...
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (All units of group[5] are dead) Equal to True
            • Then - Actions
              • Unit - Pause all units
              • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Game - Display to (All players) for 9.00 seconds the text: |CFF00FF00Nicely do...
              • Trigger - Turn off (This trigger)
              • Else - Actions
      • Custom script: call DestroyGroup(udg_group[4])
      • Custom script: call DestroyGroup(udg_group[5])
Also, in your first trigger:
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Unpause (Picked unit))
This will unpause the spectators as well. Change it to group[3].

And the leaks are coming from the groups. You need to make a custom script for each group you made and enter the text "call DestroyGroup(udg_group[x])" without "" and replace x with the array number.
Do this only when you have finished using a group. So at the end of your first trigger you can destroy group[1,2,3] because you don't need them after that and if you make set group[4+5] in duel end you can remove the leaks at the end of that trigger.

Try contain leaks into the trigger you create them, then they are easier to remove. There is a sticky on leaks in the Triggers and Scripts board if you wan't to find out more.
Most common are groups and points. As your points in this don't change there is no need to remove them, just the groups.

To be honest, you could set group 1 and 2 on map init and there would be no need to destroy it because they won't change as long as teams dont change whereas groups 3, 4 and 5 change depending on who is dueling you will need to destroy them after you use them to remove leaks.
 
Level 8
Joined
Aug 1, 2008
Messages
420
Gonna try that now.
I just noticed, you cant set it at map initializiation, because people dont have their heroes yet. So it wouldnt work :p (unless im wrong)
 
Level 8
Joined
Aug 1, 2008
Messages
420
Now the only thing i have left to do is to return the units back to their original positions - which i dont have a clue, because i have a few of those current_points (etc 1,2,3,4, ya know..) so will a need a huge trigger for every hero?
 
Level 8
Joined
Nov 9, 2008
Messages
502
The array of the point to send them back corresponds to the player number. So player 1's hero goes to current_point[1].

Do something like
set temp_group = units in (playable map) matching (matching unit is a hero = true)
pick every unit in temp_group and do actions
move (picked unit) instantly to current_point[(player number of (owner of picked unit))]
 
Level 8
Joined
Aug 1, 2008
Messages
420
Sorry i havnt posted for a while, ive been away. Ive done it all, but it this trigger fires 3 times if a team win, why is that?
  • Duel End
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set group[4] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True))
      • Set group[5] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to False))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (All units of group[4] are dead) Equal to True
        • Then - Actions
          • Unit - Pause all units
          • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Well done...
          • Wait 2.00 seconds
          • Unit - Move (Matching unit) instantly to current_point[1]
          • Set temp_group = (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True))
          • Unit Group - Pick every unit in temp_group and do (Actions)
            • Loop - Actions
              • Unit - Move (Picked unit) instantly to current_point[(Player number of (Owner of (Picked unit)))]
          • Unit - Unpause all units
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (All units of group[5] are dead) Equal to True
            • Then - Actions
              • Unit - Pause all units
              • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Well done...
              • Wait 2.00 seconds
              • Unit - Move (Matching unit) instantly to current_point[1]
              • Set temp_group = (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True))
              • Unit Group - Pick every unit in temp_group and do (Actions)
                • Loop - Actions
                  • Unit - Move (Picked unit) instantly to current_point[(Player number of (Owner of (Picked unit)))]
              • Unit - Unpause all units
              • Trigger - Turn off (This trigger)
            • Else - Actions
      • Custom script: call DestroyGroup(udg_group[4])
      • Custom script: call DestroyGroup(udg_group[5])
      • Custom script: call DestroyGroup(udg_temp_group)
Edit: Just noticed, is it because it triggers every 1.00 seconds?
 
Level 8
Joined
Nov 9, 2008
Messages
502
It plays every 1 second and you got a 2 second wait in the middle. That would make 3 runs before it gets turned off.
Try turning the trigger off at the very beginning? I'm not sure if that affects the rest of the trigger but worth a shot.

EDIT: If that doesn't work what you can do is split the trigger. So this trigger checks only whether they are all dead and if so then play another trigger that has all the other actions.

Whats the line 'move matching unit to current_point[1]' for?
 
Level 8
Joined
Aug 1, 2008
Messages
420
Whats the line 'move matching unit to current_point[1]' for?
Lol.. i didnt even notice that was in there... thanks for pointing that out.
Ill try the stuff you said. Oh and it is off at the start, i think i will need to split it.
Edit: I put it into 3 triggers, but now neither of the triggers that move the units back work. I will post them.

  • Duel start
    • Events
      • Time - duel_timer expires
    • Conditions
    • Actions
      • Unit - Pause all units
      • Game - Display to (All players) for 3.00 seconds the text: Duel Time!
      • Wait 2.00 seconds
      • Set point_index = 1
      • Set group[1] = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True)))
      • Set group[2] = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an ally of Player 5 (Yellow)) Equal to True)))
      • -------- ------------------------------------------- --------
      • -------- -------- Above is a trigger where you make 2 groups essentialy spliting the heroes into the 2 forces (Different groups)-------- --------
      • -------- ------------------------------------------- --------
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in group[(Integer A)] and do (Actions)
            • Loop - Actions
              • Set current_point[(Player number of (Owner of (Picked unit)))] = (Position of (Picked unit))
              • -------- ------------------------------------------- --------
              • -------- This saves the position of every hero in the variable --------
              • -------- ------------------------------------------- --------
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to 2, do (Actions)
            • Loop - Actions
              • Set temp_unit = (Random unit from group[(Integer A)])
              • Unit - Move temp_unit instantly to battle_point[point_index], facing Default building facing degrees
              • Unit Group - Remove temp_unit from group[(Integer A)]
              • Unit Group - Add temp_unit to group[3]
              • -------- ------------------------------------------- --------
              • -------- group[3] is for the purpose of unpausing the units who are dueling. --------
              • -------- ------------------------------------------- --------
              • Set point_index = (point_index + 1)
      • Set point_index = 1
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in group[(Integer A)] and do (Actions)
            • Loop - Actions
              • Unit - Move (Picked unit) instantly to spectator_point[point_index], facing arena_centre
              • Set point_index = (point_index + 1)
              • -------- ------------------------------------------- --------
              • -------- This is for the spectators --------
              • -------- ------------------------------------------- --------
      • Wait 3.00 seconds
      • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Player((Number of players in (All players))))
      • Camera - Pan camera for (Player((Number of players in (All players)))) to arena_centre over 2.00 seconds
      • Game - Display to (All players) for 3.00 seconds the text: Fight begins in |CF...
      • Wait 1.00 seconds
      • Game - Display to (All players) for 2.00 seconds the text: |CFFF265222|r
      • Wait 1.00 seconds
      • Game - Display to (All players) for 1.00 seconds the text: |CFF00FF001|r
      • Wait 0.50 seconds
      • Game - Display to (All players) for 4.00 seconds the text: |CFF00FF00F|CFF33CC...
      • Unit Group - Pick every unit in group[3] and do (Unit - Unpause (Picked unit))
      • Trigger - Turn on Duel Check <gen>
  • Duel Check
    • Events
    • Conditions
    • Actions
      • Set group[4] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True))
      • Set group[5] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to False))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (All units of group[4] are dead) Equal to True
        • Then - Actions
          • Trigger - Turn on Duel end Team 2 win <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (All units of group[5] are dead) Equal to True
            • Then - Actions
              • Trigger - Turn on Duel End Team 1 win <gen>
            • Else - Actions
  • Duel End Team 1 win
    • Events
    • Conditions
    • Actions
      • Unit - Pause all units
      • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Congratul...
      • Wait 2.00 seconds
      • Set temp_group = (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to current_point[(Player number of (Owner of (Picked unit)))]
      • Unit - Unpause all units
      • Trigger - Turn off (This trigger)
      • Custom script: call DestroyGroup(udg_group[4])
      • Custom script: call DestroyGroup(udg_temp_group)
Duel End Team 1 win
Events
Conditions
Actions
Unit - Pause all units
Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
Special Effect - Destroy (Last created special effect)
Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Congratul...
Wait 2.00 seconds
Set temp_group = (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True))
Unit Group - Pick every unit in temp_group and do (Actions)
Loop - Actions
Unit - Move (Picked unit) instantly to current_point[(Player number of (Owner of (Picked unit)))]
Unit - Unpause all units
Trigger - Turn off (This trigger)
Custom script: call DestroyGroup(udg_group[4])
Custom script: call DestroyGroup(udg_temp_group)


I dont know what wrong :/
 
Last edited:
Level 8
Joined
Nov 9, 2008
Messages
502
You need to use 'Run Trigger' not 'Turn on Trigger' in Duel Check and turn it off when it runs the End Duel triggers.

Also add destroy group[4] and group[5] into both Duel End triggers.
 
Level 8
Joined
Aug 1, 2008
Messages
420
  • Duel Check
    • Events
    • Conditions
    • Actions
      • Set group[4] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True))
      • Set group[5] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to False))
      • Trigger - Run Duel End Team 1 win <gen> (checking conditions)
      • Trigger - Run Duel end Team 2 win <gen> (checking conditions)
  • Duel End Team 1 win
    • Events
    • Conditions
      • (All units of group[4] are dead) Equal to True
    • Actions
      • Unit - Pause all units
      • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Congratul...
      • Player - Add 350 to (Player((Number of players in (All allies of Player 5 (Yellow))))) Current gold
      • Wait 2.00 seconds
      • Set temp_group = (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to current_point[(Player number of (Owner of (Picked unit)))]
      • Unit - Unpause all units
      • Trigger - Turn off (This trigger)
      • Custom script: call DestroyGroup(udg_group[4])
      • Custom script: call DestroyGroup(udg_group[5])
      • Custom script: call DestroyGroup(udg_temp_group)
  • Duel end Team 2 win
    • Events
    • Conditions
      • (All units of group[5] are dead) Equal to True
    • Actions
      • Unit - Pause all units
      • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Congratul...
      • Player - Add 350 to (Player((Number of players in (All allies of Player 1 (Red))))) Current gold
      • Wait 2.00 seconds
      • Set temp_group = (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to current_point[(Player number of (Owner of (Picked unit)))]
      • Unit - Unpause all units
      • Trigger - Turn off (This trigger)
      • Custom script: call DestroyGroup(udg_group[5])
      • Custom script: call DestroyGroup(udg_group[4])
      • Custom script: call DestroyGroup(udg_temp_group)
What i did before was: an if/then/else like this:
  • Events
  • Conditions
  • Actions
    • Set group[4] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True))
    • Set group[5] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to False))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (All units of group[4] are dead) Equal to True
      • Then - Actions
        • Trigger - Run Duel end Team 2 win <gen> (ignoring conditions)
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (All units of group[5] are dead) Equal to True
          • Then - Actions
            • Trigger - Run Duel End Team 1 win <gen> (ignoring conditions)
          • Else - Actions
  • [/HIDDEN]
 
Level 8
Joined
Nov 9, 2008
Messages
502
Somewhere you have deleted the periodic timers (every x seconds of gametime).

I suggest using the triggers you have now you need to do 2 things;

-put a periodic timer into the duel check trigger
-remove the 'turn off this trigger' from both duel end triggers and instead what you need is to turn off the duel check trigger. Put that at the very beginning of both duel end triggers.

Because what happened when you took out the periodic timer is you broke the link. The check need is good now just needs to run every second or something.

This should work hopefully :thumbs_up:
EDIT: I have a feeling it leeks due to the fact group[4] and [5] would constantly be being reset and not removed. You can fix that by setting the 2 groups in the previous trigger, about the time you turn on duel check.
 
Level 8
Joined
Aug 1, 2008
Messages
420
Oh i didnt think i needed the events because i told it to run the trigger. (i thought would actually do the trigger once, if you know what i mean) Ill try it in a sec.
Edit: Works for team 1. Doesnt work for team 2. Closes WC3 and comes up with fatal error message. im sure you know what i mean(everyones had it at least once lol xD) but i took a screenshot anyway.

122kldf.jpg


Both of the triggers are exactly the same except for
  • Player - Add 350 to (Player((Number of players in (All allies of Player 1 (Red))))) Current gold
And
  • Player - Add 350 to (Player((Number of players in (All allies of Player 5 (Yellow))))) Current gold
And a different text message saying they won. Oh and the condition.
 
Last edited:
Level 8
Joined
Aug 1, 2008
Messages
420
Blagh. The error happens as soon as team 2 kills team 1's last hero. (aka they win)

Triggers:

  • Duel Check
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set group[4] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True))
      • Set group[5] = (Units in arena matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to False))
      • Trigger - Run Duel End Team 1 win <gen> (checking conditions)
      • Trigger - Run Duel end Team 2 win <gen> (checking conditions)
  • Duel End Team 2 win
    • Events
    • Conditions
      • (All units of group[4] are dead) Equal to True
    • Actions
      • Trigger - Turn off Duel Check <gen>
      • Unit - Pause all units
      • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Congratul...
      • Player - Add 350 to (Player((Number of players in (All allies of Player 5 (Yellow))))) Current gold
      • Wait 2.00 seconds
      • Set temp_group = (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to current_point[(Player number of (Owner of (Picked unit)))]
      • Unit - Unpause all units
      • Custom script: call DestroyGroup(udg_group[4])
      • Custom script: call DestroyGroup(udg_group[5])
      • Custom script: call DestroyGroup(udg_temp_group)
  • Duel end Team 1 win
    • Events
    • Conditions
      • (All units of group[5] are dead) Equal to True
    • Actions
      • Trigger - Turn off Duel Check <gen>
      • Unit - Pause all units
      • Special Effect - Create a special effect at arena_centre using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Game - Display to (All players) for 9.00 seconds the text: |CFFFB7406Congratul...
      • Player - Add 350 to (Player((Number of players in (All allies of Player 1 (Red))))) Current gold
      • Wait 2.00 seconds
      • Set temp_group = (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to current_point[(Player number of (Owner of (Picked unit)))]
      • Unit - Unpause all units
      • Custom script: call DestroyGroup(udg_group[4])
      • Custom script: call DestroyGroup(udg_group[5])
      • Custom script: call DestroyGroup(udg_temp_group)
I seriously cant even take a guess at what is making it freeze :razz:

Edit: I just tried it again, and yeah, Team 1 win is fine, Team 2 win still closes WC3 :(

Edit 2: I just took out the
  • Player - Add 350 to (Player((Number of players in (All allies of Player 5 (Yellow))))) Current gold
and it worked fine. Maybe it crashes because im using the computer for Blue, Yellow and Orange for testing my duel? So it cant give yellow the gold? I dunno but its weird >.>

Edit 3!: Yeah i tried it again without that trigger and it worked, Im just gonna try it with the trigger.

Edit 4: I put it back in and it freezes :razz: Its weird. Tonight im gonna try it with one of my friends being yellow.

Edit 5: Weird, it works with a human being yellow >.>
 
Last edited:
Level 8
Joined
Nov 9, 2008
Messages
502
If you are trying to give gold to all the players in the winning team I suggest you make a player group and do:
  • Actions
    • Player Group - Pick every player in playergroup and do (Actions)
      • Loop - Actions
        • Player - Add 350 to (Picked player) Current gold
    • Custom script: call DestroyForce(udg_playergroup)
 
Level 8
Joined
Aug 1, 2008
Messages
420
I just did Add 350 gold to player 1 (red)
and then blue, teal, purple. and did the same for yellow etc.
will that still work?
 
Status
Not open for further replies.
Top