Scripts / Help needed : move between levels from different position

Author
Message
reyandekcire
8
Years of Service
User Offline
Joined: 18th Feb 2016
Location:
Posted: 5th Dec 2018 19:27
Good evening

Is it somehow possible to move beteween levels from a position different than the level's start postion ? ( I explain myself : I have made a level - say level 1 - with a non enterable inn in a small town . I have made the inn's interior with EBE in a separate level - say level 2. Start position in level 1 is far outside the town. When the player faces the fake inn's door, a scipt allow the player to enter the inn by pressing E and using the JumpToLevelIfUsed(e) command, the player is "teleported" inside the inn by loading the level 2. A similar script allows the player to exit the inn but the player spawn on level 1 Start position - far away from the town.... I wish he could spawn just outisde the inn )
I know I could have the inn's interior in a hidden and non accessible area of level 1 and use the transportinzone command but my goal is to avoid having hundreds of entities in level 1 ( wich is already quiet a big level ) and use seperate levels for some interiors ( like a cave that the player can access in a large forest area).
Does anyone knows if this can be achieved in GG ?
Thanks for your help
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Dec 2018 10:37
Yes place a script that stores which location to spawn at in your levels that gets updated when the player enters/exits the inn etc (should be a global variable - i.e. g_ ), then you can use this variable to teleport the player to the related location when the level is loaded.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
reyandekcire
8
Years of Service
User Offline
Joined: 18th Feb 2016
Location:
Posted: 10th Dec 2018 19:58
Hi Smallg

Thank you for your answer. That's roughly what I had in mind but for some reason I can't make it work properly... What I have done so far is to place a trigger zone on level 1 start position. The script attached to this trigger should teleport the player to a specified location just outside the inn when activated by the variable but it looks like it is never activated. The variable is set to 1 (active by the script that makes the player exiting level 2 , ie the inn)but it looks like variables are not stored from one level to another or am i doing something wrong ( which is certainly most likely) ?
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Dec 2018 09:37
Oh that's right, they're only loaded from a save file and not on level change, you can do it yourself though by creating your own file (this is lua specific and not a GG command), there's some examples of how to work with files around already.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-12-22 14:46:01
Your offset time is: 2024-12-22 14:46:01