Problem using cEgo.ChangeRoom

Started by Flappi282, Sat 26/12/2009 18:07:56

Previous topic - Next topic

Flappi282

For some reason, I can change the room from room 1 to room 2 using hotspots and this code:
Code: ags
    player.ChangeRoom(2, 31, 132);


But I cannot seem to get back:
Code: ags
    player.ChangeRoom(1, 289, 136);


What am I doing wrong?

Khris

Is the function containing the line properly linked in the events pane?

Crimson Wizard

Quote from: Flappi282 on Sat 26/12/2009 18:07:56
What am I doing wrong?
Your code you posted there is correct, so problem is something else.
There are various possibilities and unless you give more info, people may only guess.

Sayhello-hello

Hi, I'm having the same problem.

It only occurs when I add coordinates, otherwise if it is just the room number it works fine (but then the character stands in a weird place). How can I fix this? Thanks.

MrCheminee

Are the coordinates set on a walkable area?

Khris

Please also show us the line of code you're using. What resolution is your game, what size is the room?
And what exactly seems to be the problem? Do you get an error message?

Sayhello-hello

I feel real dumb now, I found the solution and it was something kind of obvious.

It was because the coordinates I put in made the character stand in the hotspot that transported him back to the room he came from, that's why he kept ending in the room he came. So I changed the coordinates to a place NOT on the hotspot, and this solved the problem.

Maybe this is the same problem as the original poster had?

Khris

Just for reference: using hotspots that way is obsolete and only supported for compatibility reasons.
It should be done using regions.

MrCheminee

Wouldnt regions also put you back in this same situation?

monkey0506

Well regions have events for "Walks onto" "Walks off of" and "While standing on" whereas the only comparable hotspot event is "Stands on"...So no, you wouldn't strictly have the same problem if you're using the correct events. ;)

Khris

Yeah, if you screw up, it doesn't make much of a difference ;)

MrCheminee


SMF spam blocked by CleanTalk