Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: kampfkaese on Tue 22/07/2014 19:57:27

Title: Scripting Problem: Rommchange don't work Correctly
Post by: kampfkaese on Tue 22/07/2014 19:57:27
Hello!

I realised a roomchange using this Method:

Quote
Remove all text from the field next to "walks off right edge".
Then click on "walks off right edge", then click the little ...-button.

This will open the room script and add this function to its end:
Code: Adventure Game Studio

    function room_LeaveRight()
    {
     
    }


Now put the line (player.ChangeRoom(2, ...); ) in between { and }.

But it wont work corectly. When my Player Character Switches the Room, just the Room is loaded but the Character is not Visible or Movable. I Tried different starting coordinates in Room 2 but it wont make a difference. I Use the Verb Coins Template.

Then i tried deleting Room2 and making a new one but no change.
Title: Re: Scripting Problem: Rommchange don't work Correctly
Post by: Khris on Wed 23/07/2014 01:16:26
If room 2 is loaded, then the room change works fine. AGS will always show the player's current room, so the player character is definitely in room 2.

Open the room and check its properties:
In the Settings category, there's an option called "ShowPlayerCharacter". Make sure it is set to true.

You can also press Ctrl-D in the game to see where the player character is. What does it say?

What coordinates did you try?

Walkable areas have a setting called AreaSpecificView. Make sure it isn't set to an empty view (0 is the default).

Did you change the player's transparency? Check the room script (though it should be empty if you deleted the room and created it anew).
Title: Re: Scripting Problem: Rommchange don't work Correctly
Post by: kampfkaese on Thu 24/07/2014 08:36:15
Quote from: Khris on Wed 23/07/2014 01:16:26
If room 2 is loaded, then the room change works fine. AGS will always show the player's current room, so the player character is definitely in room 2.

Open the room and check its properties:
In the Settings category, there's an option called "ShowPlayerCharacter". Make sure it is set to true.

You can also press Ctrl-D in the game to see where the player character is. What does it say?

What coordinates did you try?

Walkable areas have a setting called AreaSpecificView. Make sure it isn't set to an empty view (0 is the default).

Did you change the player's transparency? Check the room script (though it should be empty if you deleted the room and created it anew).

Hello!

Thanks for your help.

I made a screenshot of What the Game Says when pressing CTRL+D.

Screenshot 1 (http://i.imgur.com/v8Bxezk.png)
Screenshot 2 (http://i.imgur.com/sq93Jkt.png)

I Tried severalcoordinates within the Walkable Areas Area, exactly in the Middle etc.

I Tried setting AreaspecificView from 0 to 1 (Which is the Players View) but no change.. I did this in the Walkable Are Settings menu and the Room Setting. Nothing happens or differs.

Where do i find Player Transparency? But i dont think that thats the problem because i tried moving, but CTRL+D shows me that he has not.
Title: Re: Scripting Problem: Rommchange don't work Correctly
Post by: Khris on Thu 24/07/2014 10:53:17
I just remembered what is most likely going on; my guess is you drew a walkbehind instead of a walkable area. This will prevent moving and hide the player.
Title: Re: Scripting Problem: Rommchange don't work Correctly
Post by: chucklas on Thu 24/07/2014 12:42:33
Actually the first image says there are no walk behinds.  Look at the player's coordinates.  It says (570,405).  I seriously doubt this is anywhere in the visible room.  I would try player.ChangeRoom(2,20,20). See if he doesn't show up there.  The coordinates you are using appear to be way out of the range of the actual screen.
Title: Re: Scripting Problem: Rommchange don't work Correctly
Post by: Khris on Thu 24/07/2014 13:39:05
True, I completely missed that. I found the reason though.

(http://i.imgur.com/qFV0qMU.png)

Judging from the size of the pixels, this is a 640x480 game upscaled by 2.
The objects use 320 coords though, because they don't line up and are too close together.
Doubling them works, but it's still completely off somehow. The origin isn't at the top left, and the sizes have doubled now.

Bottom line: your character's coords need to be lower than 320/240, but you should never mix resolutions like that. AGS still supports it for legacy reasons, but there's no reason to use it in a new game.
Title: Re: Scripting Problem: Rommchange don't work Correctly
Post by: kampfkaese on Thu 24/07/2014 14:29:38
I dont really understand!

I just used the verbcoin template and room 1 has same resolution. Nothing is upscaled, i drawed in paint in that resolution. It looks a bit streched because i stitched it a bit but room1 is 640&480 and works fine.

The coordinates 20, 20 work! How can i get the game to use 640&480 in the second room, too? I want to use every coordinates i mean...

Here is room1:
Screenshot 1 (http://i.imgur.com/8qmJF3e.png)
Screenshot 2 (http://i.imgur.com/dporFQb.png)
Title: Re: Scripting Problem: Rommchange don't work Correctly
Post by: Khris on Thu 24/07/2014 14:53:45
By upscaled I meant you're playing the game using the x2 filter.
Just look at the player's coordinates on room1 though, they are in the proper range for 320x240, given the player's position. Again, your game is set to use low res coordinates.

Edit: I just started a new VerbCoin game, and indeed that's the template's setting. Go to General settings -> Backwards Compatibility and set "Use low-resolution co-ordiates in script" back to "False".
Title: Re: Scripting Problem: Rommchange don't work Correctly
Post by: kampfkaese on Thu 24/07/2014 15:04:53
Yay!!! It works!!!

Thank your very very much!!!
Title: Re: Scripting Problem: Rommchange don't work Correctly
Post by: Crimson Wizard on Thu 24/07/2014 15:26:09
BTW, if anyone is using AGS 3.3.0, there's a newer VerbCoin template, recently uploaded by Elektroshokker:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=32745.0

It does not have this setting.