Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: eri0o on Thu 12/10/2017 13:28:51

Title: Get ShowPlayerCharacter property from Scripts?
Post by: eri0o on Thu 12/10/2017 13:28:51
Hey,

Rooms have a property called ShowPlayerCharacter in the editor, that can be either true or false. How do I get that specific property value for the current room the player is, in the scripts?
Title: Re: Get ShowPlayerCharacter property from Scripts?
Post by: Crimson Wizard on Thu 12/10/2017 13:57:50
I don't think you can, this is one of the missing abilities. I may suggest to duplicate this flag as room's custom property and check that.
Title: Re: Get ShowPlayerCharacter property from Scripts?
Post by: Khris on Thu 12/10/2017 14:06:32
Or not use it at all, turn the player invisible in room_Load instead and check that.
Title: Re: Get ShowPlayerCharacter property from Scripts?
Post by: eri0o on Thu 12/10/2017 15:46:11
Guess I am going to use Room_Load to set transparency to 100 and Room_Leave to set it back to 0. :O
Title: Re: Get ShowPlayerCharacter property from Scripts?
Post by: Khris on Fri 13/10/2017 11:03:06
Thinking about this some more, it's probably better to move the player out of the screen instead, using player.y = -1; or something like that.
Mostly because a completely transparent but clickable character might still catch clicks.

As for using room_Load / room_Leave, you can also do this instead:
int playerY;
function on_event(EventType event, int data) {
  if (event == eEventEnterRoomBeforeFadein) {
    if (room == 2 || room == 7) {
      playerY = player.y;
      player.y = -1;
    }
    else if (player.y == -1) player.y = playerY;
  }
}


This will remove the player for room 2 and 7, and restore them to their previous coords for other rooms, but only if they were hidden upon entering the previous room.