Burningicce9
Cool Member
- Reaction score
- 1
I'm currently writing a duel system for my Hero Arena. There are teamed duels every 7 minutes, and I need a way to detect when the duels have ended. This happens when all the Hero-type units left in the duel arena belong to one team. I can't think of a way to write a trigger (GUI, i can't do JASS) that will do this. Here is the trigger i have so far. I also made some notes in red about other problems i'm having.
Feel free to point out any other flaws (I'm sure there are plenty, I'm pretty new at triggering).
Yes i know it also will have crazy leaks, i wont worry about plugging those until last (although if anyone wants to do it for me, I'd be okay with that ^_^, since i've never done that before)
Thank you in advance for any help
Code:
Starting the Duel
Events
Time - dueltimer expires
Conditions
Actions
Countdown Timer - Destroy dueltimerwindow
Trigger - Turn off North Revive <gen>
Trigger - Turn off South Revive <gen>
Trigger - Turn off North Arena Revive <gen>
Trigger - Turn on South Arena Revive <gen>
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(PlayerHeros[(Player number of (Triggering player))] is dead) Equal to True
Then - Actions
Hero - Instantly revive (Triggering unit) at (Random point in Arena Middle <gen>), Show revival graphics
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of (Dying unit)) is an ally of Player 1 (Red)) Equal to True
Then - Actions
Hero - Instantly revive (Triggering unit) at (Center of North Revive <gen>), Show revival graphics
Else - Actions
Hero - Instantly revive (Triggering unit) at (Center of South Revive <gen>), Show revival graphics
Else - Actions
Unit - Pause all units
Unit Group - Pick every unit in Champions and do (Unit - Remove All buffs from (Picked unit))
Unit Group - Pick every unit in Champions and do (Actions)
Loop - Actions
Set HeroPostarray[(Player number of (Picked player))] = (Position of PlayerHeros[(Player number of (Picked player))])
Set HeroLife[(Player number of (Picked player))] = (Life of (Picked unit))
Set HeroMana[(Player number of (Triggering player))] = (Mana of (Picked unit))
Unit Group - Pick every unit in Champions and do (Unit - Set life of (Picked unit) to 100.00%)
Unit Group - Pick every unit in Champions and do (Unit - Set mana of (Picked unit) to 100.00%)
Player Group - Pick every player in (All players controlled by a User player) and do (Camera - Pan camera for (Picked player) to (Center of Duel <gen>) over 0.00 seconds)
Unit Group - Pick every unit in (Units owned by Player 1 (Red) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of Norht 1 <gen>), facing (Center of Arena Middle <gen>))
Unit Group - Pick every unit in (Units owned by Player 2 (Blue) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of North 2 <gen>), facing (Center of Arena Middle <gen>))
Unit Group - Pick every unit in (Units owned by Player 3 (Teal) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of North 3 <gen>), facing (Center of Arena Middle <gen>))
Unit Group - Pick every unit in (Units owned by Player 4 (Purple) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of North 4 <gen>), facing (Center of Arena Middle <gen>))
Unit Group - Pick every unit in (Units owned by Player 5 (Yellow) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of north 5 leader <gen>), facing (Center of Arena Middle <gen>))
Unit Group - Pick every unit in (Units owned by Player 6 (Orange) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of south 1 <gen>), facing (Center of Arena Middle <gen>))
Unit Group - Pick every unit in (Units owned by Player 7 (Green) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of South 2 <gen>), facing (Center of Arena Middle <gen>))
Unit Group - Pick every unit in (Units owned by Player 8 (Pink) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of South 5 <gen>), facing (Center of Arena Middle <gen>))
Unit Group - Pick every unit in (Units owned by Player 9 (Gray) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of south 1 leader <gen>), facing (Center of Arena Middle <gen>))
Unit Group - Pick every unit in (Units owned by Player 10 (Light Blue) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Move (Picked unit) instantly to (Center of south 4 <gen>), facing (Center of Arena Middle <gen>))
Game - Display to (All players) the text: The duel has begun!...
Unit Group - Pick every unit in Champions and do (Unit - Unpause (Triggering unit))
Wait until [COLOR="Red"] All the Heroes on one side belong to one team. [/COLOR]
Unit Group - Pick every unit in (Units in Duel <gen> matching (((Matching unit) is A Hero) Equal to True)) and do (Unit Group - Add (Triggering unit) to Winner)
Unit Group - Pick every unit in Winner and do (Actions)
Loop - Actions [COLOR="Red"]This currently doesn't work since winners is just an empty unit group, and i dont have a way to store all the winning units .[/COLOR]
Game - Display to (All players) the text: (The Duel is over + ((Name of (Random player from Winners)) + 's team is victorious! They will be rewarded with bonus gold, and +2 to all stats)) [COLOR="Red"]This also doesn't work, i want ot make it display the player name of a random unit from Winners)[/COLOR]
Unit Group - Pick every unit in Winner and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) belongs to an ally of Player 1 (Red)) Equal to True
Then - Actions
Hero - Modify Strength of (Picked unit): Add 2
Hero - Modify Agility of (Picked unit): Add 2
Hero - Modify Intelligence of (Picked unit): Add 2
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) belongs to an ally of Player 6 (Orange)) Equal to True
Then - Actions
Hero - Modify Strength of (Picked unit): Add 2
Hero - Modify Agility of (Picked unit): Add 2
Hero - Modify Intelligence of (Picked unit): Add 2
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is A Hero) Equal to True
(PlayerHeros[(Player number of (Triggering player))] is dead) Equal to True
Then - Actions
Hero - Instantly revive (Matching unit) at (Center of Duel <gen>), Hide revival graphics
Else - Actions
Unit Group - Pick every unit in Champions and do (Actions)
Loop - Actions
Unit - Set life of (Picked unit) to HeroLife[(Player number of (Picked player))]
Unit - Set life of (Picked unit) to HeroMana[(Player number of (Picked player))]
Unit - Unpause all units
Countdown Timer - Start dueltimer as a One-shot timer that will expire in 420.00 seconds
Countdown Timer - Create a timer window for dueltimer with title Time until next due...
Set dueltimerwindow = (Last created timer window)
Countdown Timer - Show (Last created timer window)
Trigger - Turn off South Arena Revive <gen>
Trigger - Turn off South Arena Revive <gen>
Trigger - Turn on North Revive <gen>
Trigger - Turn on South Revive <gen>
Wait until ((Owner of (Triggering unit)) Equal to Player 1 (Red)), checking every 1.00 seconds
Feel free to point out any other flaws (I'm sure there are plenty, I'm pretty new at triggering).
Yes i know it also will have crazy leaks, i wont worry about plugging those until last (although if anyone wants to do it for me, I'd be okay with that ^_^, since i've never done that before)
Thank you in advance for any help