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 / How do I add a hunger and a thirst variable?

Author
Message
Deine Mutter
9
Years of Service
User Offline
Joined: 13th Jan 2015
Location:
Posted: 19th Jan 2015 19:59
I want to make a hardcore survival game, but i Need a hunger and a thirst variable. How do I add this?
BlackFox
FPSC Master
15
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 20th Jan 2015 19:01
Quote: "I want to make a hardcore survival game, but i Need a hunger and a thirst variable. How do I add this? "


You need to have the following command in a script...



Then you can add/subtract/set the variable as needed with other scripts using the "incvar=VARIABLENAME VALUE", "decvar=VARIABLENAME VALUE", "setvar=VARIABLENAME VALUE".

For example:

incvar=hunger 1
decvar=thirst 2
setvar=hunger 5

When you "initialize" the variable using "dimvar", the value is set to zero by default (ex: dimvar=hunger).

Further information on variables can be found here.

There's no problem that can't be solved without applying a little scripting.
Sinister Spoon
15
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 9th Mar 2015 18:16
Hmm Sorry about resurrecting this thread but I have a pertinent question that has been bothering me for some time.

I use variables a lot and its causing me a bit of a head ache because I think I MAY be using them wrong.

I NEVER use dimvar= as the description in the complete syntax listing seemed almost identical to globalvar= so i chose to use globalvar= for any scripts where I want all fpi's to access and alter the var, and localvar= when its contained in the originated script only.

But I seem to be encountering an issue where I can only use one var at a time, by setting globalvar=thirst for example, anything that contains,incvar=1, increments that variable instead, unless I define an alternate global variable prior to incremementing the variable

So for example if Im using a variable for kill count, and a variable for hostages killed, unless i keep changing between variables everytime one is incremented I end up incrementing the wrong one.

This isnt an issue when actually incrememnting the variable, its only an issue If I have multiple different scripts actively waiting to do a variable check

so for example I have a script checking to see if 8 terrorists are dead OR 4 hostages so Have something like

Hostage counter

:state=0,varequal=4:fpgcrawtext=hostages killed try again

And in terrorist counter

:state=0,varequal=8:fpgcrawtext=terrorists killed well donne

So currently its something like this

:state=0:globalvar=hostages,state=1
:state=1,varequal=4:fpgcrawtext=hostages killed blah blah
:state=1,varnotequal=4:state=2

:state=2:globalvar=terrorists,state=3
:state=3,varequal=8:terrorists killed yayness..
:state=3,varnotequal=8:state=0

The problem with this is that its constantly cycling those two variables so when shooting a terrorist it sometimes increments the hostage variables if the counter script happens to be looking at that one at the time

Im sure using dimvar= can fix this for me and allow to read and write multiple variables at once but I cant seem to figure it out.

Any chance of a stupid proof example using the hunger/thirst mentioned above?

I followed the link but Im probably misunderstanding something there

smoke em if you got em

Login to post a reply

Server time is: 2024-03-29 05:23:24
Your offset time is: 2024-03-29 05:23:24