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 / Trouble with displaying HUDs using variables

Author
Message
gsdasd
12
Years of Service
User Offline
Joined: 7th Dec 2011
Location:
Posted: 13th Dec 2011 00:31
Hi all im attempting to do a max payne kinda health. Were you pick up the health packs save them, then when needed press tab to restore health. Im able to increment the var add health but when i try the decvar=1 it seems to set my var back to 0. Plus my huds seems to mess up and dont display the correct numbers after decvar is used. Here is the code.

This is the one for incrementing the variables


This is the one to display the HUDs in order what what the variable is.

angusm3
15
Years of Service
User Offline
Joined: 6th Mar 2009
Location: Right behind you...
Posted: 13th Dec 2011 16:28 Edited at: 13th Dec 2011 16:28
us my cod health script but replace the regen with

:state=0:state=1

:state=1:dimvar=healthpackcount,state=2
:state=2,scancodekeypressed=15,vargreater=healthpackcount 0:incvar=healthpackcount -1,plraddhealth=25

I appear to have burst into flames...
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 13th Dec 2011 16:38 Edited at: 13th Dec 2011 17:01
Quote: ":state=2,vareless=5:hudunshow=three,hudshow=four,state=3
"


search the error, hint: "e"

varless=5 means 4,3,2,1,0, so every state is true > error.

i dont know how to handle localvars, but i think you have to specify wich var you want to manipulate (as it is done with dimvars), so "varless=1 5" or something like that. but as said i dont know how its done with localvars.
this is just for info, it doesnt make sense for me when think in logical terms.
try to use varequal=x x, that specifies the varcount exactly, should work better for this script.

oh, and its better to define vars and huds in the state=0-line.

i would do it something like this (dont know if its working, cant check):



using the 2nd script on a nonstatic,isimobile entity always active anywhere on the map.

justmy2cents
gsdasd
12
Years of Service
User Offline
Joined: 7th Dec 2011
Location:
Posted: 13th Dec 2011 17:25
Quote: "i would do it something like this (dont know if its working, cant check):"


I have edited the script as you have done it increments the vars but doesnt display them as im collecting the health. When I press tab im having the trouble of all the vars been taken away instead of one at a time.
angusm3
15
Years of Service
User Offline
Joined: 6th Mar 2009
Location: Right behind you...
Posted: 13th Dec 2011 23:50
did you try using the incvar -1 thing?

I appear to have burst into flames...
gsdasd
12
Years of Service
User Offline
Joined: 7th Dec 2011
Location:
Posted: 14th Dec 2011 00:16 Edited at: 14th Dec 2011 03:20
I think the vars are being decremented but its like when I press Tab it seems to me that fpsc thinks ive got my finger on the tab all the time, thats why my vars are just disappearing. Does anyone know how I could make it just take one var off each time I press the Tab key cause this has had me confused for awhile.
angusm3
15
Years of Service
User Offline
Joined: 6th Mar 2009
Location: Right behind you...
Posted: 14th Dec 2011 03:30 Edited at: 14th Dec 2011 03:33
:state=3:state=2 may be mussing it up

I appear to have burst into flames...
gsdasd
12
Years of Service
User Offline
Joined: 7th Dec 2011
Location:
Posted: 14th Dec 2011 04:16 Edited at: 14th Dec 2011 04:59
ive managed to do it now I didnt add a timerstart onto the scripts it was decrementing the vars but just to fast. Thanks for the help anyways.

Attachments

Login to view attachments
angusm3
15
Years of Service
User Offline
Joined: 6th Mar 2009
Location: Right behind you...
Posted: 14th Dec 2011 05:13
okay, try "hudunshow"ing every hud you declare there before hudshowing the one you want

I appear to have burst into flames...
gsdasd
12
Years of Service
User Offline
Joined: 7th Dec 2011
Location:
Posted: 14th Dec 2011 05:19 Edited at: 14th Dec 2011 05:33
Ye ive done that now. Everytime im doing something else that doesnt involve fpsc for some reason I seem to come up with the solution lol. O well this is my first ever script, so im glad its done now. This is how I got it sorted. Just incase anyone else has any trouble.

This script is attached to a entity.



This script is attached to the trigger zone.

Login to post a reply

Server time is: 2024-11-24 04:46:36
Your offset time is: 2024-11-24 04:46:36