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 / Need help with my script to toggle a hud

Author
Message
riccetts
13
Years of Service
User Offline
Joined: 14th Oct 2010
Location:
Posted: 20th Feb 2017 02:26 Edited at: 20th Feb 2017 02:49
I want to toggle my hazmat helmet I got it to appear by pushing the "G" button but can't seem to make it toggle off.
This mask also hides the health hud ect which I want to show.
Can I get some help please?
heres my script

desc=shows mask
;trigger
:state=0,scancodekeypressed=34:state=1
:state=1:hudreset,hudx=50,hudy=50,hudimagefine=gamecore\huds\Gmask.dds,hudname=Gmask,hudhide=1,hudmake=display,state=1
:state=1,plrinzone:hudshow=Gmask
:state=3,scancodekeypressed=0:state=4
:state=4,scancodekeypressed=34:state=5
:state=5:hudreset,hudx=50,hudy=50,hudimagefine=gamecore\huds\Gmask.dds,hudname=Gmask,hudhide=1,hudunshow=Gmask,state=5
:state=5,plrinzone:hudhide=1
:state=6,scancodekeypressed=0:state=0
;end script
2S!K
11
Years of Service
User Offline
Joined: 21st Jul 2012
Playing: Working on "This Is Home" an FPSc project
Posted: 20th Feb 2017 10:24
I take it your a bit new to coding? No worries you will get the hang of it in no time! I created a script for you, the only problem is that the health hud and other huds are still behind the gas mask hud. I found a command called 'hudlayer=' but I had no luck with that or any other commands I tried. The problem is they're preloaded into the level so I doubt you can rearrange them. I would suggest making your hud semi/transparent in those spots so that player could still see the huds.
Ok so I made some changes. I didnt know why you use "scancodekeypressed=0" if thats not a press able key so I replaced it with key release. Also I didnt understand if you wanted gas mask only usable in a trigger zone? My script will show text when you enter the trigger zone allowing you to equip the gas mask (hud), you can then take it off by pressing the 'G' key again even when you are no longer in the trigger zone. I also added a play sound command so put a nice audio of a mask being equipped in the trigger zone properties and your good to go.
As always, Game on! -2S!K Productions
riccetts
13
Years of Service
User Offline
Joined: 14th Oct 2010
Location:
Posted: 20th Feb 2017 14:29
s
2S!k,
How about resizing the hud?
I appreciate your help on this and I'm not new at but I have been away from it for sometime.
Thanks again!
2S!K
11
Years of Service
User Offline
Joined: 21st Jul 2012
Playing: Working on "This Is Home" an FPSc project
Posted: 20th Feb 2017 19:57
Haha well glad to see you are back. There are 2 ways you can resize the hud.
1) Resize the actual image file (Will give you better clarity)
2) Add "hudsizex=", and "hudsizey=" after the initiation (after "hudreset" would be fine)

I had to resize my image as well using hudsize when testing this but I took it out thinking you would not need it.
As always, Game on! -2S!K Productions
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 21st Feb 2017 00:35
Hi guys, in case your using Black Ice mod it uses a new command for hud's. "hudglobalx, & hudglobaly" (Dynamic scaling for HUDs) which basically sizes the hud to fit the screen.
There is also a way to "overlap" hud's using Black Fox's method.
https://forum.thegamecreators.com/thread/192148
About halfway down "Overlapping Hud display"
You can also script it into your setuplevel.fpi and call for it throughout your game?
That way you could retain your health and Lives huds ???
My games never have bugs. They just develop random features..
Lots and lots of random features...
2S!K
11
Years of Service
User Offline
Joined: 21st Jul 2012
Playing: Working on "This Is Home" an FPSc project
Posted: 21st Feb 2017 18:42
Nice tips ncmako.
In order to still have your lives, health, ammo etc. still be visible the hud should be defined in state=0. Otherwise it gets loaded after other huds, similar to the overlap method you are referring to.
I remade the code and now it works fine, here you go..
As always, Game on! -2S!K Productions

Login to post a reply

Server time is: 2024-04-20 08:15:52
Your offset time is: 2024-04-20 08:15:52