Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Help with Dim var and a key please

Author
Message
Meows
13
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 26th Jul 2012 10:17
What I am trying to do is have the player pick up a key in one level and use it in the second level. The Variables seem to carry over to level 2 but I can't figure out how to use them the right way. Help please.

cut section, I set the Variables here

now the key is picked up in level ONE and the Variables set as such


This seems to be the issue, in Level Two as the key is never there or available in the second level


Life is a short trip to another world
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 26th Jul 2012 20:18
@ Meows,

I took some time out of my schedule to help you out. First, I have a small video that shows our "traversing levels" and key/locked door. I realize that you may not be doing something like this, but the principle is still the same. The player needs to get a key from one level and bring into another.

In this video, the player starts out and makes his/her way to a blue room with three doors (level 2). The player goes into level 5 (red room) and discovers two doors- one locked and requires a key; the other has a winzone and the door is open via switch on the other side of the locked door needing the key. The player will return back to level 2, then go into level 3 (green room). Upon entering level 3, the player picks up the key, then returns to level 2. Turning around, the player re-enters level 3 and the key is not there, then leaves again. The player then enters level 5, where the door can be unlocked and the switch activated to access the winzone. Here is the video:



Now, as far as the scripts I used, here is how I designed it. In level 3, I have the key placed and used the following script for the key's appear:

Key appear script


In the appear script, notice how I call the variable key, then have it checking the value of key. if the value is equal to 1, that means the player has picked it up already; if not then it loops and checks again until picked up. This is used when player comes and goes into that level multiple times and we only need the key to appear once until picked up.

The next script is the key's main script.

Key main script


Pretty straight forward. The player picks up the key, and the value of key is set to 1. So if the player leaves level 3 to go back to level 2, then returns to 3, the key appear script will check the variable key and since the value is already 1, the key is destroyed and therefore is not visible to be picked up.

Here is the door script in level 5 that requires the key:

Door main script


Again, the door script checks the variable key and will continue to unlock and open if the variable value is set to 1. If the player does not have the key, the door will not unlock and open when the player presses the key to unlock.

So you have to ensure a few things:

1. make sure the key's appear script calls your variable first (my key appear script using "dimvar=key") and is setup according to prevent multiple keys appearing (if using traversing levels).

2. make sure the key main script sets that variable value to what it needs when the key is picked up (my key main script). This value should be the same value as the door value. If the variable value is set to 1 when the key is picked up, then the door would require that same value of 1.

3. ensure the door script checks for the correct value of the variable.

It can get quite confusing at times and complicated, but as I have shown using v1.17, it can be done.


Twitter: @NFoxMedia
Meows
13
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 30th Jul 2012 19:11
BlackFox
Quote: "I took some time out of my schedule to help you out."

Please do not tell your wife but you are my HEROMany thanks and many more thanks.

So sorry for the delay, I am putting the finishing touches on My creation Trouble in Heaven.

Making the self installer for download was more challanging than I had figured.
Making the DVD Install version was comparatively easy.

Now thanks to you, I can Add my bonus levels for those players of superior skill.

Now to figure out how to sell it beyond our local gamestop outlet.

Life is a short trip to another world

Login to post a reply

Server time is: 2024-11-23 21:50:32
Your offset time is: 2024-11-23 21:50:32