Back to previous room script?

Started by obe, Sat 26/03/2005 22:37:47

Previous topic - Next topic

obe

I was wondering if what i have planned for a save/load menu is possible.
I'm trying to make a seperate screen with hotspots for save/load/new/return and my bro and i are
having problems figuring out if the "return" part is even possible to script.
We will be having several "save rooms" with the character hidden and eliminating the save option until you reach these rooms.

I guess what i'm getting at is making a return to previous room script or will we have to make a seperate save room for each save point?



Ashen

Sounds like you want the character[CHARID].prevroom variable. (Character.PreviousRoom in 2.7) E.g.:
Code: ags

NewRoom (character[EGO].prevroom);
I know what you're thinking ... Don't think that.

obe

awsome thanks.
now after fiddling with it for a while, how can i set the co-ords for my return?

Ashen

Best way to do it would be to store them in a couple of ints, or GlobalInts, before the room change:

Code: ags

SetGlobalInt (1, player.x);
SetGlobalInt (2, player.y);
NewRoom (SAVEROOM);


Then, when you leave the save room:
Code: ags

NewRoomEx (player.prevroom, GetGlobalInt (1), getGloablInt (2));
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk