Forum rules - please read before posting.

How to check which player is on scene by script

Good afternoon, fellow adventurers
Quick question. Is there a way to check by script which player is palying? Reason why? I have two players now, and there's a bunch of stuff that affects one or the other, so understanding if it's "Player 0" or "Player 1" either by index or name, will be super grateful. I haven't found anything on the manual regarding how to call it.

Thanks a lot.
AC 1.75.2

Comments

  • The Player component's ID property represents their unique identifier when a game has multiple Players.

    The active Player's ID can be read with:

    AC.KickStarter.player.ID;
    
  • You are the best. Thanks!
    Is there a way to check if Index 0 or 1 is active? We got two characters and depending on who is on screen some code needs to run. I want to call it on Start() if it's 0 or 1.

  • if (AC.KickStarter.player.ID == 0) { // Player 0 is active }
    

    Alternatively, the Player: Check Action can be used to determine the active Player.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.