Returning to Previous room ot provious coordinants

Started by Akumayo, Tue 29/06/2004 00:51:49

Previous topic - Next topic

Akumayo

I need a code that will allow me to do the following function.

Main character steps on hotspot 1, the hotspot sends the character to another room.  Shortly afterwards, the character needs to be returned to his previous room at his previous coodinates.  This is because the room he is transported to can be accesed anywhere in the world.  I need to know some way in which the character can go to previous room, at previous coordinates.

I have thought of two ways, both need work...

1.  Store roomnumber as a GlobalInt (which I don't know how to do) and store x and y coordinates as globalInt's (which I don't know how to do) then use the GetGlobalInt function to return the character to his proper place...

2.  Mabye there is an/some easy function/functions that could acclomplish this task???


help....
"Power is not a means - it is an end."

TerranRich

A very easy way: to transport to previous room, use the character[EGO].prevroom variable.

And to go to the same coordinates as when the player left, simply make a script upon Entering Room (Before Fade-in) that will detect which room the player came from (again using prevroom) and set the coordinates.

For example, if Room 1 leads to Room 2, which is the transporter room, then in the Enters Screen (Before Fade-in) event, if the prevroom is greater than 2 then go to the coordinates on the pad or whatever the player should be on. Otherwise, walk in from the left/right/bottom/etc.

Got it?
Status: Trying to come up with some ideas...

Akumayo

nununununoooo, I should have been more clear.  the room you are transported to is a battle room(battle system complete 8) ) and I need the character to be able to return to his previous room and coordinates after the battle.  Anyways, the previous room is solved, but I still need to know how to do the previous coordinates.

PS- if this is to hard, or impossible, please note that I can easily get around this by changing the player character to a new character in the battle room, but I would rather do the previous thing, because (if the previouse thing is easy) then I don't have to make another character.  (My game should soon border 130 characters.........)
"Power is not a means - it is an end."

LordHart

If you do want to use GlobalInts to do it, you could try when you go to the battle room:

SetGlobalInt(1, character[EGO].x);
SetGlobalInt(2, character[EGO].y);
NewRoomEx(room, x coords, y coords);

And then when returning to the previous room from where the player came:

NewRoomEx(character[EGO].prevroom, GetGlobalInt(1), GetGlobalInt(2));

I'm not entirely sure if this would work, but I suppose its worth a shot.

Akumayo

Sounds good, I will try it, if it works, good, if not....hello character number 131
"Power is not a means - it is an end."

SMF spam blocked by CleanTalk