Help with Player Leaving Trigger

Stormahawk

New Member
Reaction score
2
In this game, if a solo player leaves, the base remains. I want to edit this trigger or make a new one where if a solo player leaves his/her base is destroyed. How do I make this trigger work with solo players?
Code:
Players Leaves
    Events
        Player - Player 1 (Red) leaves the game
        Player - Player 2 (Blue) leaves the game
        Player - Player 3 (Teal) leaves the game
        Player - Player 4 (Purple) leaves the game
        Player - Player 5 (Yellow) leaves the game
        Player - Player 6 (Orange) leaves the game
        Player - Player 7 (Green) leaves the game
        Player - Player 8 (Pink) leaves the game
        Player - Player 9 (Gray) leaves the game
        Player - Player 10 (Light Blue) leaves the game
        Player - Player 11 (Dark Green) leaves the game
        Player - Player 12 (Brown) leaves the game
    Conditions
    Actions
        Set xpl = (Triggering player)
        -------- Compensation --------
        Set TempForce = (All players matching ((((xpl is in PlayersPlaying) Equal to True) and ((Matching player) Not equal to xpl)) and (((Matching player) is an ally of xpl) Equal to True)))
        Set xi = ((((Hero level of Hero[(Player number of xpl)]) x 300) + (((Supply provided by Base[(Player number of xpl)]) x 100) + (xpl Current gold))) / (Number of players in TempForce))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of players in TempForce) Equal to 0
            Then - Actions
            Else - Actions
                Player Group - Pick every player in TempForce and do (Actions)
                    Loop - Actions
                        Player - Add xi to (Picked player) Current gold
                        Game - Display to TempForce for 30.00 seconds the text: (You have recieved |cffffcc00 + ((String(xi)) + (|r as compensation for your ally quitting,  + (PlayerName[(Player number of xpl)] + , please do not leave also, it ruins the game.))))
        Custom script:    call DestroyForce (udg_TempForce)
        -------- -- --------
        Game - Display to PlayersPlaying the text: (PlayerName[(Player number of (Triggering player))] + |cffff0000 has run away in fear!|r)
        Trigger - Turn off Building Destroyed <gen>
        Set TempGroup = (Units owned by xpl)
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Unit - Kill (Picked unit)
        Custom script:    call DestroyGroup (udg_TempGroup)
        Trigger - Turn on Building Destroyed <gen>
        Player Group - Remove xpl from PlayersPlaying
        Player Group - Pick every player in PlayersPlaying and do (Actions)
            Loop - Actions
                Set TempForce = (All players matching ((((Matching player) is an enemy of (Picked player)) Equal to True) and (((Matching player) is in PlayersPlaying) Equal to True)))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Number of players in TempForce) Equal to 0
                    Then - Actions
                        Game - Display to PlayersPlaying for 30.00 seconds the text: Game Victory in 60 ...
                        Wait 60.00 seconds
                        Player Group - Pick every player in (All allies of (Picked player)) and do (Actions)
                            Loop - Actions
                                Game - Victory (Picked player) (Show dialogs, Show scores)
                    Else - Actions
                Custom script:    call DestroyForce (udg_TempForce)
        Custom script:   set udg_TempForce = null
        Custom script:   set udg_TempForce2 = null
 

Vestras

Retired
Reaction score
249
Make another trigger, in which you register when <your unit-type> enters the game. Then, have a global array unit, and set it to the entering unit.

Trigger:
  • Set Unit[Player number of (Owner of Triggering Unit)] = Entering Unit


Then remove it when a player leaves.

Only works if there is only one of these units in the game at all times.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top