• 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.

Duel Trigger Event

Status
Not open for further replies.
Level 2
Joined
Jun 9, 2013
Messages
18
Hey All,

Currently creating a two-player co-op RPG map. I want the players to be able to duel eachother. I have figured out how to get the duel started with text and everything but I am having trouble getting the two players back on the same team after the duel.

Is there a event/condition where a "Unit dies in (XXX Region)" ? I could use this so that if a unit dies in the duel region, then it would move the winning player back to town and return both players allied status back to allied instead of Hostile.

Let me know if you know anything I can do to make this happen. Thanks.
 
Level 2
Joined
Jun 9, 2013
Messages
18
Hey All.

Mr Bean was of great help and his idea worked perfectly. I have one other issue I would like to see if I can get help with. I would like text to be displayed to the winner and to the loser, different for each - One text that says "You have won, etc." and another that says "You have lost, etc."

How can I make a trigger where the game knows which players unit died and which one survived? Below are my triggers I currently have for the duel, they work perfectly so far.

  • Duel
    • Events
      • Player - Player 1 (Red) types a chat message containing -duel as An exact match
      • Player - Player 2 (Blue) types a chat message containing -duel as An exact match
    • Conditions
    • Actions
      • Unit - Move (Random unit from (Units owned by Player 1 (Red) matching (((Matching unit) is A Hero) Equal to True))) instantly to (Center of Duel Player 1 <gen>)
      • Camera - Pan camera for Player 1 (Red) to (Center of Duel Player 1 <gen>) over 0.00 seconds
      • Unit - Move (Random unit from (Units owned by Player 2 (Blue) matching (((Matching unit) is A Hero) Equal to True))) instantly to (Center of Duel Player 2 <gen>)
      • Camera - Pan camera for Player 2 (Blue) to (Center of Duel Player 2 <gen>) over 0.00 seconds
      • Game - Display to (All players) for 1.00 seconds the text: Duel Begins in
      • Wait 0.30 seconds
      • Game - Display to (All players) for 1.00 seconds the text: 3.....
      • Wait 1.00 seconds
      • Game - Display to (All players) for 1.00 seconds the text: 2.....
      • Wait 1.00 seconds
      • Game - Display to (All players) for 1.00 seconds the text: 1......
      • Wait 0.30 seconds
      • Game - Display to (All players) for 1.00 seconds the text: Fight!
      • Player - Make Player 1 (Red) treat Player 2 (Blue) as an Enemy with shared vision
      • Player - Make Player 2 (Blue) treat Player 1 (Red) as an Enemy with shared vision
  • Duel End
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
      • Unit - A unit owned by Player 2 (Blue) Dies
    • Conditions
      • ((Duel <gen> contains (Triggering unit)) Equal to True) and (((Triggering unit) is A Hero) Equal to True)
    • Actions
      • Wait 2.00 seconds
      • Unit - Move (Random unit from (Units owned by Player 1 (Red) matching (((Matching unit) is A Hero) Equal to True))) instantly to (Center of Starting Area <gen>)
      • Unit - Move (Random unit from (Units owned by Player 2 (Blue) matching (((Matching unit) is A Hero) Equal to True))) instantly to (Center of Starting Area <gen>)
      • Player - Make Player 1 (Red) treat Player 2 (Blue) as an Ally with shared vision
      • Player - Make Player 2 (Blue) treat Player 1 (Red) as an Ally with shared vision
 
Level 13
Joined
Jan 30, 2012
Messages
1,298
Duel End
Events
Unit - A unit owned by Player 1 (Red) Dies
Unit - A unit owned by Player 2 (Blue) Dies
Conditions
((Duel <gen> contains (Triggering unit)) Equal to True) and (((Triggering unit) is A Hero) Equal to True)
Actions
Wait 2.00 seconds
Unit - Move (Random unit from (Units owned by Player 1 (Red) matching (((Matching unit) is A Hero) Equal to True))) instantly to (Center of Starting Area <gen>)
Unit - Move (Random unit from (Units owned by Player 2 (Blue) matching (((Matching unit) is A Hero) Equal to True))) instantly to (Center of Starting Area <gen>)
Player - Make Player 1 (Red) treat Player 2 (Blue) as an Ally with shared vision
Player - Make Player 2 (Blue) treat Player 1 (Red) as an Ally with shared vision

you should do this instead
Events
Unit - A unit Dies
Conditions
(Owner of (Triggering unit)) Equal to Player 1 (Red)
(Owner of (Triggering unit)) Equal to Player 2 (Blue)
((Duel <gen> contains (Triggering unit)) Equal to True) and (((Triggering unit) is A Hero) Equal to True)

Actions
set Group = (Random 1 units from (Units in (Playable map area) matching (((Owner of (Triggering unit)) Equal to Player 1 (Red)) and (((Triggering unit) is A Hero) Equal to True))))
set Group1 = (Random 1 units from (Units in (Playable map area) matching (((Owner of (Triggering unit)) Equal to Player 2 (Blue)) and (((Triggering unit) is A Hero) Equal to True))))
Wait 2.00 seconds
Unit Group - Pick every unit in Group and do (Unit - Move picked unit instantly to (Center of Starting Area <gen>))
Unit Group - Pick every unit in Group and do (Unit - Move picked unit instantly to (Center of Starting Area <gen>))
Player - Make Player 1 (Red) treat Player 2 (Blue) as an Ally with shared vision
Player - Make Player 2 (Blue) treat Player 1 (Red) as an Ally with shared vision


check this out! :goblin_good_job:
View attachment MapDuelTest.w3x

This is the Trigger (if you're too lazy to download it)

  • DuelGroup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in THISMAPONLY1 <gen>) and do (Unit Group - Add (Picked unit) to Team1VAR)
      • Unit Group - Pick every unit in (Units in THISMAPONLY2 <gen>) and do (Unit Group - Add (Picked unit) to Team2VAR)

  • DuelInit
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- below you can set the time for often you want duels --------
      • -------- but you MUST set the same time in the DuelTime trigger --------
      • -------- or else it will not work correctly --------
      • Countdown Timer - Start HeroDuelVAR as a Repeating timer that will expire in 15.00 seconds
      • -------- below you can set the name of the timer window --------
      • Countdown Timer - Create a timer window for HeroDuelVAR with title Duel In:
      • -------- if you want to only have duels start after a certain time period, or have them off for a time period, just use the below function --------
      • Countdown Timer - Pause HeroDuelVAR
      • -------- and then resume it with resume action. could be useful fr hero selection or some other event --------
      • Countdown Timer - Resume HeroDuelVAR
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across CameraPan <gen>
  • DuelSystem
    • Events
      • Time - HeroDuelVAR expires
    • Conditions
    • Actions
      • Countdown Timer - Pause HeroDuelVAR
      • Countdown Timer - Destroy (Last created timer window)
      • Set DuelHeroesVAR[1] = (Random unit from Team1VAR)
      • Set DuelHeroesVAR[2] = (Random unit from Team2VAR)
      • -------- the next four triggers are optional, but could be useful as they essentially heal the duelists --------
      • Unit - Set life of DuelHeroesVAR[1] to 100.00%
      • Unit - Set life of DuelHeroesVAR[2] to 100.00%
      • Unit - Set mana of DuelHeroesVAR[1] to 100.00%
      • Unit - Set mana of DuelHeroesVAR[2] to 100.00%
      • -------- ofc you can add any sound you want by using the sound editor --------
      • Sound - Play GateEpicBash <gen>
      • -------- this tells the players who is fighting, and so is useful, but remove or change if you want --------
      • Game - Display to (All players) the text: ((Name of (Owner of DuelHeroesVAR[1])) + ( versus + (Name of (Owner of DuelHeroesVAR[2]))))
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
      • -------- if you want to have the heroes go to different places, you must define them here --------
      • Set ReturnLocVAR[1] = (Position of DuelHeroesVAR[1])
      • Set ReturnLocVAR[2] = (Position of DuelHeroesVAR[2])
      • Unit - Move DuelHeroesVAR[1] instantly to (Center of DuelTeam1 <gen>), facing 0.00 degrees
      • Unit - Move DuelHeroesVAR[2] instantly to (Center of DuelTeam2 <gen>), facing 180.00 degrees
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • -------- you can change how fast you want the camera to move in the below trigger --------
          • Camera - Pan camera for (Picked player) to (Center of CameraPan <gen>) over 1.00 seconds
      • Wait 1.00 seconds
      • -------- ofc you can add any music you want by using the sound editor --------
      • Sound - Play Credits <gen>
      • Trigger - Turn on DuelTime <gen>
      • Wait 4.00 seconds
      • Unit - Unpause DuelHeroesVAR[1]
      • Unit - Unpause DuelHeroesVAR[2]
  • DuelTime
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Sound - Stop music After fading
      • Sound - Play Music
      • Unit - Pause DuelHeroesVAR[1]
      • Unit - Pause DuelHeroesVAR[2]
      • -------- you can use a wait action to delay the respawn, or use a hero respawn system like the one below --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Dying unit) Equal to DuelHeroesVAR[1]
        • Then - Actions
          • -------- any place you want could work --------
          • Hero - Instantly revive (Triggering unit) at ReturnLocVAR[1], Show revival graphics
          • Unit - Move (Killing unit) instantly to ReturnLocVAR[2]
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Dying unit) Equal to DuelHeroesVAR[2]
        • Then - Actions
          • -------- any place you want could work --------
          • Hero - Instantly revive (Triggering unit) at ReturnLocVAR[2], Show revival graphics
          • Unit - Move (Killing unit) instantly to ReturnLocVAR[1]
        • Else - Actions
      • -------- you can then add any rewards to the victorious player through this --------
      • -------- also you could use text to show reward maybe --------
      • Player - Add 1000 to (Owner of (Killing unit)) Current gold
      • Wait 2.00 seconds
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Unit - Unpause (Picked unit)
      • Countdown Timer - Start HeroDuelVAR as a Repeating timer that will expire in 15.00 seconds
      • Countdown Timer - Create a timer window for HeroDuelVAR with title Duel In:
      • Trigger - Turn off (This trigger)
one more thing if you want to ask about trigger please post in this Section not here
 
Status
Not open for further replies.
Top