Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: santitassara on Mon 22/06/2020 23:23:01

Title: Problem with Hotspot enable/disable
Post by: santitassara on Mon 22/06/2020 23:23:01
i have a problem with hotspots.
the thing is that i want my character to start in the room and the hotspot at the door to be disable but when he clicks a star play a video and the hotspot get enabled. ok everything fine .
the player is available to leave the room but when he enters the room again the hotspot it's disabled again .
How can i do to block the disable of the hotspot.
here's my code :

Code (ags) Select

if ( event == eEventEnterRoomBeforeFadein)
  {
    hotspot[3].Enabled = false;
  }
 
 

thanks!!!
Title: Re: Problem with Hotspot enable/disable
Post by: arj0n on Mon 22/06/2020 23:42:41
Code (ags) Select

if ((event == eEventEnterRoomBeforeFadein) && (player.previousroom != <Roomnumber>))
{
    hotspot[3].Enabled = false;
}
Title: Re: Problem with Hotspot enable/disable
Post by: santitassara on Tue 23/06/2020 01:10:07
YES ! Thank you so much!
it worked!
Title: Re: Problem with Hotspot enable/disable
Post by: Khris on Tue 23/06/2020 05:31:36
You should use the room's "first time enters room" event for that, not the on_event function. Without also checking the current room that code will disable hotspot #3 in almost every room.

After properly adding & linking the event, AGS will add the  room_FirstLoad  function to your room script, and you'll also be able to use the actual scriptname:
Code (ags) Select
function room_FirstLoad()
{
  hDoor.Enabled = false;
}


Using that event already takes care of the "player hasn't been in room previously" check.
Title: Re: Problem with Hotspot enable/disable
Post by: arj0n on Tue 23/06/2020 07:46:45
Khris' solution is better indeed, I should have thought of that one.