Product Chat (Early Access) / [SOLVED] unlocking door ends the level : how ?

Author
Message
ericman
19
Years of Service
User Offline
Joined: 16th Feb 2005
Location:
Posted: 20th May 2022 17:53
Hello, I know the door-key mechanics to unlock a door. ( by the way it works but oddly enough the door does not move- you just walk through it when it is unlocked - bug ? )
My problem : can I set a no-code behaviour so that when the door is unlocked , the level ends and the game moves to the next level ?

I tried creating a connection between the door and a win zone, but whatever order I choose for the connection ( starting with the door or starting with the win zone ) the win zone just unlocks the door ( without the key ) and displays "game completed" : I would like this to happen only after the key has been recovered and after "E" has been pressed.
Can anyone help ? Thanks in advance.

The author of this post has marked a post as an answer.

Go to answer
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 21st May 2022 01:18
@ ericman
Quote: "by the way it works but oddly enough the door does not move- you just walk through it when it is unlocked - bug ?"

Stock door? if so, what door are you talking about?
Otherwise, if it is a custom door, then you have to create at least 2 animation slots and name them such as "open" and "close" in the mesh importer, you will have to state the animation frames as well.
The door.lua script does the trick as behavior.

1- Do you want to open the door, or unlock it only?
2- There are a lot of doors to be open or just only one?
3- The player should be close to the door in order to open it. or find the key and never may where the player is?

I'm afraid you are going to need a coded solution, to achieve it, in fact, you don't need the "winzone", just the "jumpToLevel(e, level name)"
LUA command; of course, the whole script depends on what you are going to need.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
ericman
19
Years of Service
User Offline
Joined: 16th Feb 2005
Location:
Posted: 21st May 2022 15:22 Edited at: 21st May 2022 15:23
Hello 3com,
thanks for your answer.

1) the door : stock door called blue door : I got it for this : it seems it is a non animating door.
By default, it is connected to the rotate door script which makes non animating doors rotate anyway. However, they cannot be " locked" ( no behaviour for that outside code ). So I had changed the script to just " door", which allows for the "locked" behaviour....but does not rotate the door. Ok this one is solved.

2)lua script : I am not familiar with lua, but I intend to learn enough to do little tweaks if possible, so thank you for putting me in the right direction. Actually the door works as a transition between the current level and the next, so only this door has this behaviour in the level.

The behaviour would be this :

a) player finds key
b) player goes back to the door and unlocks it.
c) next level is loaded

PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 21st May 2022 17:52
This post has been marked by the post author as the answer.
@ ericman

1- Go to the "\Documents\GameGuruApps\GameGuruMAX\Files\scriptbank\user" folder and place there, the script attached below.
2- Open the script with Notepad and search for the code line: " JumpToLevelIfUsed(e, "Your levelname goes here")" and type your level name there.
3- Attach that script to your door mesh.

https://youtu.be/w8hFq7pnKCY

HTH

Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

Attachments

Login to view attachments
PM
ericman
19
Years of Service
User Offline
Joined: 16th Feb 2005
Location:
Posted: 21st May 2022 20:21
Hello 3com,
first of all thanks a lot for your time ! That you took the time to write the script, instructions as well as a youtube video is much ( and rightfully so ) appreciated! And it WORKS VERY WELL.

I will do my best to follow your example when I'm skilled enough to help in this community. ( contrary to what my profile suggests, I haven't spent that much time on gamecreator apps, but I discovered their products a long time ago)

I will just report a few issues I had, in case it might help other basic users like me : ( steam version )
1) I did not find the "\Documents\GameGuruApps\GameGuruMAX\Files\scriptbank\user" folder ( I have "\Documents\GameGuruApps\GameGuruMAX\Files\ though, just not a scriptbank folder so I put the door.lua file in the scriptbank\user" folder located in program files.
==> so far it works
==> maybe I should have manually added the scriptbank folder in\Documents
2) I thought it was necessary to rename your file ( door.lua ) since there is a default door.lua behaviour but renaming causes the door to do nothing, so here are the steps :
==> in any case do not overwrite the original door.lua file in program files !!
a) after enabling the "developer settings" submenu in object tools : click on the "..." icon next to "door.lua"
b)in the behaviour type tree to the left, locate and click "user"
c) select the "door" behaviour ( this is 3com's lua file that you put in the "scriptbank\user" folder ) - and that's it.

Of course, as 3com said, don't forget to edit 3com's lua file by entering the name of the level you want the user to move to ( quotes included )

Thank you again!
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 21st May 2022 21:44 Edited at: 21st May 2022 21:45
Quote: "maybe I should have manually added the scriptbank folder in\Documents"

Yes, you'll have to create them, that way you prevent the file from being overwritten when updating GGMax.
The same script name is not an issue as well as you create those folders and store the script there.
Edit: fixing quotes.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
ericman
19
Years of Service
User Offline
Joined: 16th Feb 2005
Location:
Posted: 22nd May 2022 12:02
Hello, a question concerning the script : instead of typing the name of the level, is it possible to refer to the next level as defined by the storyboard editor ? Thanks.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd May 2022 18:31
FinishLevel() instead of JumpToLevel("") might do it
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
ericman
19
Years of Service
User Offline
Joined: 16th Feb 2005
Location:
Posted: 22nd May 2022 19:22 Edited at: 23rd May 2022 08:14
@smallg : it works ! Thanks a lot for your help.

Question about LUA : is the link to LUA basics at the bottom of your message relevant to GG MAX ? It refers to gameguru, so maybe there are differences in GG MAX. But it's a good starting point, so thank you.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 23rd May 2022 13:15
it was made for classic yes but the basic principles are the same for Max, just some of the commands in classic are different for Max
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
ericman
19
Years of Service
User Offline
Joined: 16th Feb 2005
Location:
Posted: 24th May 2022 05:57
Hello,
if anyone is interested, here's the lua file that allows for moving to the next level when a door is unlocked. Thanks to 3com and smallg.
PM
ericman
19
Years of Service
User Offline
Joined: 16th Feb 2005
Location:
Posted: 25th May 2022 07:08 Edited at: 27th May 2022 16:43
It seems I am not allowed to attach files. Tried twice; Maybe it has to go through a moderator first.

[EDIT] : thank you 3com, the file has been uploaded.

Attachments

Login to view attachments
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 26th May 2022 00:05
I have experienced something like that days ago, what I did was post and then edit the post, and try attaching the file again, and this time it works.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-04-20 13:57:16
Your offset time is: 2024-04-20 13:57:16