Room transitions don't work with function hHotspot[n]_AnyClick()

Started by RustyBucket, Tue 16/03/2021 04:39:02

Previous topic - Next topic

RustyBucket

Hello there!  I'm sorry to have my first post on the AGS forums be over such a basic coding question, but even after going through the onsite tutorial and SpaceQuestHistorian's tutorial, I'm finding myself stumped at this simple problem; the engine doesn't allow me to do room transitions!



Here is the room layout (Room number 5)

And below is the complicated and lengthy room script!  :wink:

Code: ags

// room script file

function hHotspot1_AnyClick()
{
  player.ChangeRoom(4, 54, 155, eDirectionUp);
}


I thought that this would work, but to my surprise, the script won't trigger!



Room 4 exists, and that coordinate is within the walkable area, so I can't for the life of me figure out why this room specifically is causing problems; it's a real pickle!

Gilbert

Are you sure the function is properly linked to the "Any click on hotspot" event in the interaction (the 'lightning' icon) tab of the Hotspot's properties?

RustyBucket

Quote from: Gilbert on Tue 16/03/2021 05:18:45
Are you sure the function is properly linked to the "Any click on hotspot" event in the interaction (the 'lightning' icon) tab of the Hotspot's properties?

Yes, that was it, thank you! Looks like I still have a lot to learn about the UI and scripting in general...

Khris

Can you tell us (link us to) which tutorials exactly?
Because the one in the manual explains this clearly in section 3 so any tutorial that is missing this crucial step should probably be fixed, given how many people don't realize the functions have to be linked to events.

Also, welcome to the forums :)

spooey

Hello, I am having a similar issue - I thought I should post in this thread rather than make my own so any solutions are in one place. Please correct me if this isn't ideal.

My version of the issue is that using the 'hHotspot_AnyClick' function only works if the setting 'ShowPlayerCharacter' is set to True - otherwise, it seems to break the game (after clicking the hotspot, nothing else is clickable - even the UI, which also changes visually). Here is a demonstration:





Any help would be greatly appreciated - sorry if the solution is staring me in the face  :sealed:

Khris

I cannot replicate this; for me it works as supposed to.
What happens if you put a Display() command in the function instead of the room change? Also, does the room change work if triggered by the room leave event?

One thing that comes to mind: is it possible there's another room change event in room 2 which sends the character back immediately?

SMF spam blocked by CleanTalk