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

SHOW IN BBCODE - How to make the Last one win?

Status
Not open for further replies.

old

old

Level 6
Joined
May 8, 2016
Messages
112
  • Dead P1
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • Set Lives[1] = (Lives[1] - 1)
  • Dead Global
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
      • Lives[(Player number of (Owner of (Dying unit)))] Equal to 0
    • Actions
      • Game - Defeat (Owner of (Dying unit)) with the message: Defeat!
      • Unit - Remove (Dying unit) from the game
This mode is last man stand, heroes have a X number of lives and if they lost they are removed with defeat... Ok.
But how can i make to the last one win? All are defeated but the last one still in game alone without any "GG WP"...
Give me step by step with BBCode please (Example: You must create an XXXXXX and add an YYYYY to do ......... etc)
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
If you set the map's victory conditions right, it will probably display a victory message for the only remaining player since you've actually called the "defeat player" function. Otherwise add this after you defeat whomever just died:
  • Set PlayingPlayers = 0
  • Loop - For each (integer a) from 1 to 12 do (actions)
    • Loop - Actions
      • If (conditions) then do (actions) else do (else actions)
        • If - Conditions
          • ((Player((Integer A))) slot status) Equal to Is playing
        • Then - Actions
          • Set PlayingPlayers = PlayingPlayers + 1
          • Set WinPlayer = Player((Integer A))
        • Else - Actions
  • If (All conditions are true) then do (actions) else do (else actions)
    • If - Conditions
      • PlayingPlayers equal to 1
    • Then - Actions
      • Game - Victory WinPlayer (Show dialogs, Show scores)
    • Else - Actions
Read through to understand why this is the way it is. It checks how many players are still playing (I'm fairly certain that won't count computer players) and if it's only 1 then that player must have won. WinPlayer can safely be set whenever we find a playing player because we only care about when there's 1 un-defeated player left.
 
Status
Not open for further replies.
Top