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 / Variables take the value of player health?

Author
Message
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 28th Oct 2010 12:02
The title says it all.
How do I set a variable to the players health without going
:health=100:setvar=100
:health=99:setvar=99
is there any way to do it in a single line?
Thanks.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 28th Oct 2010 12:16
I'm going to assume you are just giving an example of the logic you are looking for,because a condition such as :health=x: does not exist.

But I think Project Blue had an action that detects that.RPG mod might be capable of doing it also,but I can't be quite sure.

Why do you need this anyway?There are actions and conditions about the players health , as well as huds. ?

Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 28th Oct 2010 12:51
I am making a health regeneration that will hopefully work like this (this isnt fpi, its a mix of fpi and english lol)

state=0,plrhealthless<100 (not equal to):variable=player's health,start timer,state=1
state=1,timergreater=1000,plrhealth = (equal to) variable:state=2
state=1,timergreater=1000,plrhealth != (not equal to) variable:state=0
state=2,plrhealth<100:plraddhealth=1,timerstart,state=3
state=2,plrhealth=100:state=0
state=3,timergreater=50:state=2

Pretty much, I want it to set the variable to the players health to detect if after one second whether their health has changed. If it hasn't, it will add one health twenty times a second.

So, effectively, so long as the players health doesnt change in one second, (as unlikely as it is that they will lose and gain the same amount of health in one second) it will add the health until the player has full health, and then it will continue to run.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 28th Oct 2010 13:05
:state=0,plrhealthless=99:timerstart,state=1
:state=1,timergreater=1000,plrhealthless=99:state=2
:state=1,timergreater=1000,plrhealthgreater=99:state=0
:state=2,plrhealthless=99:plraddhealth=1,timerstart,state=3
:state=2,plrhealthgreater=99:state=0
:state=3,timergreater=100:state=2

This is off-top,but with minor adjustments it should work.

Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 28th Oct 2010 14:22
Yes, thats not bad, but if the player looses health, it will still continue, which is not what I wanted (don't misunderstand me, i am grateful that you want to help). What I was wanting is for one where if the player's health changes, then the script goes to state 0.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 28th Oct 2010 15:23
I see.To be honest I couldn't understand what you wanted exactly.Maybe it's because I'm foregin,maybe your grammar and sentence construction is bad,I don't know.

Well I see why you don't want to write for each 1hp a line of script to set the variable.Like I said,I think Project Blue has an action to retrieve the players exact HP and set in a variable.

But since I see you don't have PB,I suggest looking into RPG Mod's manual.I don't have the time to run some tests,so that's all I can assist you with.

Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 28th Oct 2010 15:35
Yes, ok, i will.
BTW, thanks for helping anyway.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Marc Steene
FPSC Master
18
Years of Service
User Offline
Joined: 27th Mar 2006
Location: Bahrain
Posted: 28th Oct 2010 16:40
Both PB and update 1.18 will contain the $PH internal variable, which retrieves the player's health.


[b]FPSC MIGRATION: http://forum.thegamecreators.com/?m=forum_view&t=142497&b=21
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 29th Oct 2010 01:50
To expand upon Marc's post, here is how the internal variable would be used:



That line will create a variable called "DudesHealth" and then set it to the player's health via the internal variable.


The one and only,


Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 29th Oct 2010 03:45 Edited at: 29th Oct 2010 03:45
Awesome. That means then that I just need to wait for 1.18 (as I can not buy PB yet, but will look into it ASAP)
Thankyou.

EDIT
Also, is that dimvar command native to PB or FPSC itself?

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 29th Oct 2010 03:58 Edited at: 29th Oct 2010 03:59
Quote: "Also, is that dimvar command native to PB or FPSC itself?"


PB only

I'm not sure but isn't that variable system in Project Green?

I reject your reality and substitute my own!

Add more adventure to your game -- use RPG Mod
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 29th Oct 2010 05:33
is there a health variable in rpg mod flatlander?

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 29th Oct 2010 06:31 Edited at: 29th Oct 2010 06:31
Quote: "is there a health variable in rpg mod flatlander?"


No, and I don't foresee adding any because as it looks there will be some internal variables in v118 which I will integrate RPG Mod into that version when the final source code is available.

I personally don't see an advantage. The stock scripting language has two conditions

1. plrhealthgreater=
2. plrhealthless=

and three actions

1. plraddhealth=
2. plrsubhealth=
3. plrsethealth=

RPG Mod does have the following two

1. rpg_changeplayerhealthmax

I found that there would be times I would want to increase or decrease the max in conjunction with an award or a punishment (not word I was looking for).

2. rpg_changeplayerlives

This is kind of related to health. Not sure if this was necessary but thought I would throw it in anyway. Most of my games only allows the player to have one life. But I suppose in a fantasy game you could have the player drink a potion that would a life or lives for him or whatever.

I reject your reality and substitute my own!

Add more adventure to your game -- use RPG Mod
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 29th Oct 2010 08:48
Quote: "Quote: "Also, is that dimvar command native to PB or FPSC itself?"

PB only

I'm not sure but isn't that variable system in Project Green?"


Project Greenhas that variable system, too. Also, it was my understanding that vanilla FPSC now has the majority of the PB variable system, so it should accept the dimvar, setvar, addvar, etc. commands now.

Quote: "I personally don't see an advantage."


What if I wanted to know what 5% of the player's current health was? Or if I wanted to know if the player's health was greater than another variable set dynamically at runtime? There are a myriad of situations that might need the player's health to be stored and manipulated in a variable (without altering the player's health). It also just made sense to include it alongside all of the other internal variables offered (such as player lives, player ammo, clip ammo, entity health, mouse movement, etc.)


The one and only,


Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 29th Oct 2010 09:43
OK, I will try dimvaR THEN.
Ill make a simple script;

Should that work?

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 29th Oct 2010 10:29
Yup, that makes sense Ply. Just didn't think deeply enough regarding any possible scenarios.

I checked the code of the official release of v117. That variable system isn't there. However, Marc Steene said in the v118 thread that it will be in that version. Whether it is in there now I'm not sure unless I download the code.

I reject your reality and substitute my own!

Add more adventure to your game -- use RPG Mod
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 30th Oct 2010 00:21
Some corrections to your script, Michael:



@Terry:

Well, in my discussions with hockeykid, he informed me that the variable system was being integrated slowly. If it ever was in the new version, it should be in there already (since I know that's not what they're working on at this time)


The one and only,


Akanto10
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Earth
Posted: 30th Oct 2010 04:55 Edited at: 30th Oct 2010 04:56
Wow, this thread completely explains/solves my problem. I love this forum!

Sincerely,
Akanto

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 30th Oct 2010 05:39
That's what it's here for, right?


The one and only,


Only those who sow the seeds of their desires will reap their benefits later.
However, I have seeds of my own to tend to. I don't have time to be someone else's watering can.
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 30th Oct 2010 06:15
Quote: "Some corrections to your script, Michael:"

Thanks... I knew it was dodgy, it was just a quick 2 minute chuck up (I did that at school, trying not to let the teacher know...)

Quote: "Wow, this thread completely explains/solves my problem. I love this forum!"

That's great, it solved my problem too. I love this forum too, i referr to it in real life all the time even when its irrelevant to the current discussion.

Quote: "That's what it's here for, right?"

Thats right.

I just want to thank everyone for their support right now, just incase at any stage it seems i wasnt grateful, I am.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Akanto10
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Earth
Posted: 2nd Nov 2010 22:12 Edited at: 2nd Nov 2010 22:13
Oh, I knew I would have a question! When you set a variable to the player's health, (dimvar=plrhealth,setvar=plrhealth $PH) then will it automatically set the variable to the player's health when it changes? Or do I have to keep setting it?

Thanks,
Akanto
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 2nd Nov 2010 22:15 Edited at: 2nd Nov 2010 22:15
If you don't change any states on the script it will change,because it loops it every second.

for example if you have this

:state=0:dimvar=plrhealth,state=1
:state=1:setvar=plrhealth $PH

it shouldn't screw up

Akanto10
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Earth
Posted: 3rd Nov 2010 03:26
I see, thank you.

Thanks,
Akanto
Akanto10
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Earth
Posted: 3rd Nov 2010 03:51 Edited at: 3rd Nov 2010 03:52
Okay, assuming that this $PH variable works with all the vanilla variable actions, (varequal, varnotequal, etc.) this script should recharge the player's health one by one after waiting one second when hit, right?

Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 3rd Nov 2010 03:56 Edited at: 3rd Nov 2010 03:57
I would just say;

That way, if the player is hurt, they will be recharged at 5 health a second.

EDIT
Also, i just remembered to say they will only have their health recharged until they reach health of 100.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Akanto10
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Earth
Posted: 3rd Nov 2010 05:50
Yeah, but I don't want it to recharge automatically every 0.2 seconds, I want to be like commercial games, kind of like Halo, if you get hurt, you wait about a second then it recharges, but if you get hurt within that second of waiting, it starts waiting again. I've done something like that script, and I didn't really get a good "feel" from it, but thank you for giving some input.

Thanks,
Akanto
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 3rd Nov 2010 10:23
Yes, that is what I want too.
I guess we just need to wait until 1.18 is out hey.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 3rd Nov 2010 13:29 Edited at: 3rd Nov 2010 13:34
Well, I already made a Halo type script exactly like that... except it recharged armor instead of health, lol. But it's the same concept. Let me go find my armor script for you, you can see how it works and change it up to suit your needs.

[runs off]

..

[comes back]

Found it! Here it is!!! Ignore all the jumbo about needing ply's mod. It will work for PB just fine... and if the official updates have PB's internal variables, then it should work just fine in the latest beta as well.


The one and only,


Only those who sow the seeds of their desires will reap their benefits later.
However, I have seeds of my own to tend to. I don't have time to be someone else's watering can.
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 3rd Nov 2010 18:10
Lol Thanks. However, the problem is that I dont have PB. I might look into it if I can get paypal or something but that is unlikely for a bit. Thanks anyway.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Akanto10
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Earth
Posted: 4th Nov 2010 03:34
Nice, I've always wanted armor for a scifi-type game!

Thanks,
Akanto
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 4th Nov 2010 06:07
@Michael:

You're welcome anyway.
Unfortunately... this type of script is pretty darn difficult to amke without PB's variable system, hence why it only makes sense to give you the answer using that system. Like I said, the latest beta MAY have PB's variable system, not sure, but you can check.


@Akanto10:

Glad you like it!


The one and only,


Only those who sow the seeds of their desires will reap their benefits later.
However, I have seeds of my own to tend to. I don't have time to be someone else's watering can.
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 4th Nov 2010 12:08
Yes, I heard (saw) that. if it does, then I will look into your script. but I am still grateful. Thanks.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations

Login to post a reply

Server time is: 2024-11-24 16:54:05
Your offset time is: 2024-11-24 16:54:05