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 / OK this is not fair SetVar=X Y -- Sets variable X's value to Y Lies

Author
Message
Meows
7
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 1st Aug 2014 21:30
I have spent 3 days on this, Now to be fair I did figure out a external fix at
http://forum.thegamecreators.com/?m=forum_view&t=211737&b=23

But i really want a internal fix to compare 2 variables so I thought this was it,,


But I found out there is dishonesty among variables. Who Knew?
See for your self, 2 lvl game attached.
and here is the dishonest Variable
:state=0:varequal=gold 1,State=1:State=2,SetVar=armourwon 0 ;SetVar=X Y -- Sets variable X's value to Y
I told it to SetVar=armourwon 0 yet it actually starts armour 2,, I am so confused..

Any advice?

Attachments

Login to view attachments
BlackFox
FPSC Master
11
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 2nd Aug 2014 02:08 Edited at: 2nd Aug 2014 02:12
** I bet you just knew I'd be lurking about and jump in **

The command setvar=x y works exactly as it should. Using my traversing levels demo I constructed as an example, I do use the command with the key in level 3. The player enters level 2, which is a hub and has doors to level 3,4,5. Level 5 has the door that is locked and needs the key (from level 3). The pickup key script for the key sitting in level 3 is as follows...



As you can see from the script above, I call the variable key and when the key is picked up, it sets the variable key to a value of 1.

Here is the appear script for the key...



In the script above, the key appear script will run each time level 3 gets loaded. So you can enter level 3 10 times, and this script will run 10 times. As the level loads, the script checks the variable key, and if the value is 1 it will not spawn the key; if the value is 0, the key will spawn.

Now jump to level 5 where the locked door is. The door script is as follows...



As you can see from the script above, the player approaches the door. When they are in a range of 60 units, they press the key to unlock the door and the variable value of key equals 1, the door unlocks and opens. If the player enters level 5 right from 2 without the key, they can't unlock the door. It all hindges on the key pickup script which uses the setvar=x y command. I believe the video I did even showed the player entering 2, going to 5, then back to 2, then 3, pickup key, and make their way to 5.

The point is when it comes to the variable system, your scripts have to be spot on for everything to work how you want it at the right moment. Not to say the engine can't throw a hissy at times when we try to script complex stuff, the commands do work (unless something got broke or jumbled during all the beta's and unofficial builds).

There's no problem that can't be solved without applying a little scripting.
Meows
7
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 2nd Aug 2014 03:39
*hugs* BlackFox
Thank you. I will redo all this tomorrow as
your way is far superior than what I finally came up with to do it internally for better control.

I used a really old script I think came with the FPSC DVD i got in 2011 when I purchased it.

Then mangled it with 2 crates and a zombie.
zombie appear script. the old 2011 reinvented


the main is runfpidefault=1 Ricks armour script that runs if they choose 100 armour+2 regen
the crate is called with the activateifused and runs armour+1 regen,

I had to come up with something to burn 3 dvd's with the game. Now I will redo with your advice.. tomorrow with a new brain that is working,,

Oh yea. pick the tough guy option and you die..

ncmako
7
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 2nd Aug 2014 04:45
Quote: "Then mangled it with 2 crates and a zombie appear script. The old 2011 reinvented "

Yeah, there is nothing quite like mangling 2 crate scripts with a
zombie appear script....wow!
That is too funny, thanks Meows

My games never have bugs. They just develop random features..

Login to post a reply

Server time is: 2019-09-19 01:59:11
Your offset time is: 2019-09-19 01:59:11