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 medical kit inventory?

Author
Message
Pazjf
15
Years of Service
User Offline
Joined: 17th Nov 2009
Location:
Posted: 13th Jan 2010 20:16
I know an inventory script is very difficult to make, but I'm attempting something much more simple. Next to the health bar I will have a HUD image of a health kit, so when the player picks up health items, a number next to the image increases. The player presses a key (e.g. H) to heal, and it uses up a health kit.

Basically, how difficult would this be, or is it even possible? Im about to make the HUD's now, but my scripting skills are a nightmare haha. Thanks in advance
The Master Dinasty
16
Years of Service
User Offline
Joined: 14th Sep 2008
Location: Valhalla
Posted: 13th Jan 2010 22:30
Picking it up, and increasing the value would be simple if you had scripting skills. But since you lack of scripting knowledge go and do some tutorials. There is a fine selection in the doc folder in the FPSC directory.

PS: This can be done with stock engine.



-Massap2

Beacause massa is the master!
Staring blankly at the sun waiting for my time to come...
Pazjf
15
Years of Service
User Offline
Joined: 17th Nov 2009
Location:
Posted: 13th Jan 2010 23:16
Thanks for the advice, I'm hoping to learn how to script well so now that I know it's simple, I'll make some attempts and learning it. If I come up with a script but have some issues can I show it to you and see if you can guide me in the right direction?
The Master Dinasty
16
Years of Service
User Offline
Joined: 14th Sep 2008
Location: Valhalla
Posted: 14th Jan 2010 14:24
Quote: "Thanks for the advice, I'm hoping to learn how to script well so now that I know it's simple, I'll make some attempts and learning it. If I come up with a script but have some issues can I show it to you and see if you can guide me in the right direction? "

Yes i am always glad to help, but this is kind of extreme to begin with. Try the offical tutorials with simple things like hud and stuff, its located in your fpsc directory under doc.

-Massap2

Beacause massa is the master!
Staring blankly at the sun waiting for my time to come...
Pazjf
15
Years of Service
User Offline
Joined: 17th Nov 2009
Location:
Posted: 15th Jan 2010 17:59
Hey I spent some time playing around with the scripts and attempting to get this working. I've got half of it working now. When I pick up a medical kit, it increases the variable by 1. the max med kits is 9, so when i try pick up a 10th nothing happens, which is great. BUT I can;t get the variable to display on the screen, no matter what I do. So I must be missing something. I attempted to use Conjured's cash scripts to help me and came up with this.... Andy ideas why I can't get it to work?



;Display Global Variable for Health Pickups (Variable number8)

;create huds
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\0.dds,hudhide=1,hudname=medpack0,hudmake=display
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\1.dds,hudhide=1,hudname=medpack1,hudmake=display
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\2.dds,hudhide=1,hudname=medpack2,hudmake=display
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\3.dds,hudhide=1,hudname=medpack3,hudmake=display
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\4.dds,hudhide=1,hudname=medpack4,hudmake=display
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\5.dds,hudhide=1,hudname=medpack5,hudmake=display
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\6.dds,hudhide=1,hudname=medpack6,hudmake=display
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\7.dds,hudhide=1,hudname=medpack7,hudmake=display
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\8.dds,hudhide=1,hudname=medpack8,hudmake=display
:state=0:hudreset,hudx=19,hudy=40,hudimagefine=gamecore\huds\user\9.dds,hudhide=1,hudname=medpack9,hudmake=display


;initialization
:state=0:localvar=8,setvar=0,state=5

:state=5:globalvar=8,state=6

;remove any existing huds before we display new ones
:state=6:hudunshow=medpack0,hudunshow=medpack1,hudunshow=medpack2,hudunshow=medpack3,hudunshow=medpack4,hudunshow=medpack5,hudunshow=medpack6,hudunshow=medpack7,hudunshow=medpack8,hudunshow=medpack9,state=26

;test ones
:state=26,varequal=9:hudshow=medpack9,state=36
:state=26,varequal=8:hudshow=medpack8,state=36
:state=26,varequal=7:hudshow=medpack7,state=36
:state=26,varequal=6:hudshow=medpack6,state=36
:state=26,varequal=5:hudshow=medpack5,state=36
:state=26,varequal=4:hudshow=medpack4,state=36
:state=26,varequal=3:hudshow=medpack3,state=36
:state=26,varequal=2:hudshow=medpack2,state=36
:state=26,varequal=1:hudshow=medpack1,state=36
:state=26,varless=1:hudshow=medpack0,state=36



;End of Script
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 16th Jan 2010 00:09
sent you an email, Terry's the name in the email

-----------------------------------------------
OliveTreeGames
god games
15
Years of Service
User Offline
Joined: 25th Dec 2008
Location: in a house with a roof on it
Posted: 16th Jan 2010 23:04
will you give it for a download? please

don't move handsup
The Master Dinasty
16
Years of Service
User Offline
Joined: 14th Sep 2008
Location: Valhalla
Posted: 16th Jan 2010 23:20 Edited at: 16th Jan 2010 23:21
Well the script looks like its gonna work, BUT you are setting you`re script to look IF it has the variable of the number. So when you pick up a "med kit" it wouldent be setting the variables to its property. you need to increment the variables by X, try this script on the healthpacks....



NOTE: The script i have attached is for the med kit, you need to add in you`re script a button function(to read when the player presses button then do its function). And its function would be to add health.

You are doing fine the way i am seeing it.

EDIT: What is written within state 36? you need to loop the script you know!


-Massap2

Beacause massa is the master!
Staring blankly at the sun waiting for my time to come...
Pazjf
15
Years of Service
User Offline
Joined: 17th Nov 2009
Location:
Posted: 17th Jan 2010 13:58
To god games:

Do you want the script available for download so you can use it too? Because if so, I'll include a notepad of instructions on what parts of the script are referring to what appears on screen.


To Massap 2:
Aha, because I was using pieces of various scripts to try and make mine, I didn;t realise the state 36 at the end. Is is state 5 I need to loop it to or state 6?

Also, with reference to the medpack script, I should really have included my own so you could understand it better, sorry about that. I've already got a script for the medpacks, so here it is. Maybe you can spot a mistake I've made...

;Medpack Increase Script

;Header

desc = Add 1 to medpack ammount

;Triggers

:state=0:hudreset,hudx=94,hudy=94,hudimagefine=languagebank\english\gamecore\huds\hand.dds,hudname=hand,hudhide=1,hudmake=display
:state=0:settargetname=medpack,state=1

:state=1,plrdistwithin=30:hudshow=hand,hudfadeout=hand
:state=1,plrdistwithin=30,plrusingaction=1:globalvar=8,state=2
:state=2,varequal=9:state=1
:state=2,varless=9:incvar=1,state=3


:state=3:plrsound=$0,state=4
:state=4:destroy

;End of Script



Basically what's happening here is, in my game I have a HUD box in the bottom-right corner, in which a HUD symbol appears when the player can interact with something. As far as I know this script should do this:
When the player is within 30 distance, it displays the "hand" symbol. If the player then presses the "use" button, they pick up the medkit and it increases the medkit variable by 1. If there are too many kits in the inventory, the item is not collected. Any holes in the plan?

Thanks so much for helping by the way
Pazjf
15
Years of Service
User Offline
Joined: 17th Nov 2009
Location:
Posted: 17th Jan 2010 14:51
Okay just encountered a new, and very strange problem. When I loop my script as you told me to, whenever I testplay the level I can't see anything

My HUD's are all there as they should be, but a bunch of others cover the screen too. From what I can make out, it's the damage huds and such, as the screen is tinted red. As well as this, the circular red blur around the outside when you recieve damage is there too, but it's in white.

So basically I have a black background, tinted red and with a white blur around the edges... what the hell!? haha

Screenshot included, in case it helps.

Attachments

Login to view attachments
god games
15
Years of Service
User Offline
Joined: 25th Dec 2008
Location: in a house with a roof on it
Posted: 21st Jan 2010 10:40
thank you somuch

don't move handsup
The Master Dinasty
16
Years of Service
User Offline
Joined: 14th Sep 2008
Location: Valhalla
Posted: 22nd Jan 2010 19:14 Edited at: 22nd Jan 2010 19:15
I think its going to work, BUT i spotted a little something something...

Quote: "
:state=1,plrdistwithin=30:hudshow=hand,hudfadeout=hand
"


You forgot to have a "plrdistfurther" command too, and you`re hud wont disappear beacause you have made this mistake and also "hudfadeout" should be in the dispear state. Basicly add something like this!



Othervise it should work, i can say bravo bravo and about that bug it happends to me from time to time but i havent ever search for a solution for it.


-Massap2

You might one day find you`re self laughing at my tombstone, but if that was me id piss on yours!
Lead me to heaven when i die.
Pazjf
15
Years of Service
User Offline
Joined: 17th Nov 2009
Location:
Posted: 30th Jan 2010 14:22
Thanks a bunch for your help Massap2, in the short time it took me to work out how to make this, I've pretty much learned how to do anything I want with the scripting!

Even though this script should work though, I can't fix that screen bug so I've had to change the way it works. Now the player can only hold 1 medkit at a time, and rather that a numeric to show that one is help, a yellow blip icon fills the box the number used to be in. Only way I can fix it, it seems

But thanks so much for all your help
Marc Steene
FPSC Master
18
Years of Service
User Offline
Joined: 27th Mar 2006
Location: Bahrain
Posted: 31st Jan 2010 13:15
It's very easy to do with Project Blue/Project Green.

:state=0:dimvar=medkits,setvar=medkits 1,state=1
:state=1,keypressed=25 1,vargreater=medkits 0:setplrhealth=100,sound=$0,subvar=medkits 1

Obviously this is just the functionality, you'd have to add the HUDs yourself.


[b]FPSC MIGRATION: http://forum.thegamecreators.com/?m=forum_view&t=142497&b=21

Login to post a reply

Server time is: 2024-11-25 03:41:27
Your offset time is: 2024-11-25 03:41:27