Hello,
It's been a while i was not stuck but this time i need your help
In order to create a map i use a room with a GUI on it
There's a button on the GUI to exit the map (a basic cross)
to go back to the previous position when the player exit the map i use:
player.ChangeRoom(player.PreviousRoom);
The problem is that the player comes back to the previous position but in the middle of the room
I need to find a way to go back to the previous room with the same coordinates (x,y) the player was before he opened the map
I tried different things without success
I believe there must be a way to do that can you please help me 😀
I wish you all a great day, thank you very much
Is the player character supposed to be visible in the map room? Because if not, simply remove the coordinates and just call player.ChangeRoom(map_room_number); when the user opens the map.
This way the player will retain their position.
Also, why use a separate room and also a GUI for the map? If you use just the GUI, the problem also disappears.
Hello Khris,
The player is not visible in the map room, it's just clickable points so i will try your solution as soon as i get home:
player.ChangeRoom(map_room_number);
This is a really good question, you are asking why i used a specific room with a GUI and not just a GUI, this is what i did at first but i wanted to add animated objetcs on the map such as waves and little things moving and i didn't find how to animate objects on a GUI
I hope you are not going to tell me that it was possible to animate things on a GUI haha 😃 ?
Thanks again for your precious help and il will let you know if i managed to do it.
Alternatively, if you do need to store player's coordinates (because, say, you need the player to teleport to a specific point in the new room and THEN return them to the coords they were at in the previous room), you can use a custom room change function with two integer variables:
function RoomChange(int roomnumber, int x, int y)
{
playerx = player.x;
playery = player.y;
player.ChangeRoom(roomnumber, x, y);
}
and then, when returning the player to the previous room:
player.ChangeRoom(player.PreviousRoom, playerx, playery);
Hello Kastchey,
Thanks a lot for your help, this is a great way to solve the problem, this is what i had in mind but i didn't know how to do it with 2 varibales integers.
I'll try both solutions as soon as possible.
Thanks again for your time.
Quote from: actaria on Wed 06/03/2024 15:53:55I hope you are not going to tell me that it was possible to animate things on a GUI haha 😃 ?
Certainly it is. You use a GUI Button and call Button.Animate().
Quote from: Snarky on Wed 06/03/2024 18:09:00Quote from: actaria on Wed 06/03/2024 15:53:55I hope you are not going to tell me that it was possible to animate things on a GUI haha 😃 ?
Certainly it is. You use a GUI Button and call Button.Animate().
Nooooo :shocked: well this is a great lesson for the next time i will use a GUI 😉 Snarky
I redone the whole map because of this ! now i know about the Button.Animate()
Thank you 👍
Since i am a lazy girl i picked the shortest way to do it and it works like a charm.
player.ChangeRoom(map_room_number);
I keep Kastchey way to do it in my personnal guide.
And now i know that button can be animated on a GUI 😉 Snarky
Thanks again to all of you have a good night