Problem with Hotspot enable/disable

Started by santitassara, Mon 22/06/2020 23:23:01

Previous topic - Next topic

santitassara

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

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

thanks!!!

arj0n

#1
Code: ags

if ((event == eEventEnterRoomBeforeFadein) && (player.previousroom != <Roomnumber>))
{ 
    hotspot[3].Enabled = false;
}

santitassara

YES ! Thank you so much!
it worked!

Khris

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
function room_FirstLoad()
{
  hDoor.Enabled = false;
}


Using that event already takes care of the "player hasn't been in room previously" check.

arj0n

Khris' solution is better indeed, I should have thought of that one.

SMF spam blocked by CleanTalk