Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Whelandrew on Thu 11/09/2003 06:54:52

Title: Room - To - Room
Post by: Whelandrew on Thu 11/09/2003 06:54:52
I looked through the manual and read through some of the forum, but can't find an answer.

I am trying to link two rooms together. But, when I walk the character over the hotspot it teleports to the next room but does not place the character or let him walk around.

I assume is has to do with the Edge+Offset Value but I don't know how to figure out what that value is.

Someone give me a hand?
Title: Re:Room - To - Room
Post by: Quintaros on Thu 11/09/2003 06:57:48
You can use a region with the interaction:  Player-Go to a different room (at specific coordinates).

Then pick your coordinates for the room  so that the player is on the appropriate walkable area.
Title: Re:Room - To - Room
Post by: Whelandrew on Thu 11/09/2003 07:05:57
That works to send it to a specific spot. But, what if I want them to pop up in the same side right across from where they came from?
Title: Re:Room - To - Room
Post by: Quintaros on Thu 11/09/2003 07:10:36
Quote from: Krominof on Thu 11/09/2003 07:05:57
... what if I want them to pop up in the same side right across from where they came from?

I'm not sure what you mean by this.  
Title: Re:Room - To - Room
Post by: Whelandrew on Thu 11/09/2003 07:15:32
I want them to go in to the room and arrive exactly where the last room left off. Almost as if it just scrolled to the next area, but changed rooms instead. If Ius coordinates, then it puts them in that exact same spot no matter where they enter the hotspot.
Title: Re:Room - To - Room
Post by: Quintaros on Thu 11/09/2003 07:24:41
Okay now I understand...unfortunately I don't know the answer.  Too bad, I was thinking I actually knew something useful. Sorry.
Title: Re:Room - To - Room
Post by: Whelandrew on Thu 11/09/2003 07:26:32
Heh. Well, thanks anyway.

Anybody else help me out?
Title: Re:Room - To - Room
Post by: Gilbert on Thu 11/09/2003 07:35:34
In that case, you have to use scripting.
Say if the player walks away from the right will arrive in room 22 and coordinate ( 10, same y coordinate as before), you can set the interaction to "runscript..." and just put the line:

NewRoomEx(22, 10, character[GetPlayerCharacter()].y);

there, save the script and compile the room.
Title: Re:Room - To - Room
Post by: Quintaros on Thu 11/09/2003 08:00:03
I tried out this code on my own game and got this error message:



---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x004D2B4A ; program pointer is +0, ACI version 2.56.623, gtags (0,0)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.



Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.
---------------------------
OK  
---------------------------


What's going on?

Title: Re:Room - To - Room
Post by: Gilbert on Thu 11/09/2003 08:05:53
Hmmm did you check you had entered the room number and coordinates information correctly?

If you have no clue, you may copy what you had typed into the script here in this thread.
Title: Re:Room - To - Room
Post by: Quintaros on Thu 11/09/2003 08:11:23
I tried to modify for movement up/down instead of left/right.  This is what I typed in:

// script for region2: Player walks onto region
NewRoomEx(22, character[GetPlayerCharacter()].x,190);  


You're right about the "no clue" part.  Even after removing the interaction my game still will not compile.  
Title: Re:Room - To - Room
Post by: Gilbert on Thu 11/09/2003 08:17:10
Is the new room number really 22? I put 22 there just as an example, you need to replace it by the appropiate room number.
Title: Re:Room - To - Room
Post by: Quintaros on Thu 11/09/2003 08:21:31
The right room number was 22.  Strange coincidence, eh?

The error message was apparently b/c of something other than my game.  I rebooted my computer and the game runs fine now.  Just happened to occur when I tried your code.

Sorry for Shanghai-ing your thread Krominof, but you have your answer.
Title: Re:Room - To - Room
Post by: Gilbert on Thu 11/09/2003 08:24:32
Nevermind. It's nice to hear that the problem got sorted out. ;)
Title: Re:Room - To - Room
Post by: Whelandrew on Thu 11/09/2003 08:44:05
Indeed I do. Thanks for usurping the thread!  :)
Title: Re:Room - To - Room
Post by: Whelandrew on Thu 11/09/2003 18:07:56
Okay! New problem. I finally was able to get to move to the new room, but the character doesn't show up.
I tried (movetowalkablearea) but it actually placed him in a non-walkable area.
Title: Re:Room - To - Room
Post by: Scummbuddy on Thu 11/09/2003 18:27:55
what code are you using to move the character?
Title: Re:Room - To - Room
Post by: Whelandrew on Thu 11/09/2003 18:50:13
I started with the suggested code above.

Then I tried new room and added movetowalkablearea.

Got the same results.
Title: Re:Room - To - Room
Post by: Scorpiorus on Thu 11/09/2003 21:32:11
Quote from: Krominof on Thu 11/09/2003 18:07:56I tried (movetowalkablearea) but it actually placed him in a non-walkable area.
Sorry, but are you sure it's a walkable area and not a hotspot, for example?

EDIT:

btw, you have to place MoveToWalkablearea() function in the new room, not like:
NewRoomEx(...);
MoveToWalkablearea();

but like...

this room's code:
NewRoomEx(...)


destination room's code:

on player enter screen (before fadein)
MoveToWalkablearea();


-Cheers
Title: Re:Room - To - Room
Post by: Scummbuddy on Thu 11/09/2003 21:37:25
Are you using the NewRoomEx(); code.  look it up in the manual