How do I detect players ?

RedSword

New Member
Reaction score
4
Hi everyone,

I'm making a 4 forces map (1 user and 1 computer per forces) with pre-placed building.

I'm wondering, how can I detect if a player is IN the game, controlling a certain player X (because if no users / computers are choosed to be behind a player X, that player X will still be there, but he won't have a player name, even if a computer force will do few things with (like auto-attack)), and if he's not there, that I kill/remove his building (I know how to do this last part at least =S).

Thank you in advance, and I hope my question isn't stupid and understandable =S
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
Player Slot Status Comparison:

Code:
(Player 1 (Red) slot status) Equal to Is playing
 

Trollvottel

never aging title
Reaction score
262
well use the pick all players in loop and then make 2 conditions: piicked player plays and picked player controller = user and as else function to kill all units owned by picked player
 

Naminator

Coming Back To Life
Reaction score
76
also if you want check if that player is an User too. Player Controller Comparsion
 

velnias

New Member
Reaction score
13
well use the pick all players in loop and then make 2 conditions: piicked player plays and picked player controller = user and as else function to kill all units owned by picked player

Code:
Untitled Trigger 001
    Events
    Conditions
    Actions
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked player) slot status) Equal to Is playing
                        ((Picked player) controller) Equal to User
                    Then - Actions
                         (Your actions)
                    Else - Actions
 

Naminator

Coming Back To Life
Reaction score
76
Code:
Untitled Trigger 001
    Events
    Conditions
    Actions
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked player) slot status) Equal to Is playing
                        ((Picked player) controller) Equal to User
                    Then - Actions
                         (Your actions)
                    Else - Actions

Won't be better to set it to a Group Variable and Destroy them? Like this.
Code:
Group
    Acontecimientos
        Time - Elapsed game time is 1.00 seconds
    Condiciones
    Acciones
        Set Players_InGame = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to Use)))
        Player Group - Pick every player in Player_InGame and do (Actions)
            Bucle: Acciones
               <Your Actions Here>
        Custom script:   call DestroyForce (udg_Players_InGame)
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> Won't be better to set it to a Group Variable and Destroy them? Like this.

Not necessarily. If you're worried about leaks, don't. All Players is a global that does not leak.
 

RedSword

New Member
Reaction score
4
That doesn't work.... I don't know why... I tryed :

JASS:
TopLeftNoCreeps
    Events
        Time - Elapsed game time is 5.00 seconds
    Conditions
        (Player 1 (Red) controller) Not equal to User
        (Player 1 (Red) slot status) Not equal to Is playing
    Actions
        Unit - Kill Hideout 0015 &lt;gen&gt;
        Unit - Kill Research Center 0000 &lt;gen&gt;


With player 1 to 4, with their respective building (alias "Hideout and Research Center", and btw, the building aren't to the player 1-4 (they are to 5-8)

and I tryed Naminator' suggestion too, but none worked =S
 
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