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 / New FPI command "SHOTDAMAGE=X" for PLAYER - Lesson by hukuta94

Years of Service
User Offline
Joined: 4th Jan 2011
Location: Russian Federation
Posted: 2nd Jun 2015 12:53 Edited at: 2nd Jun 2015 12:54
Lesson from Script Pack 10 - Nazi Zombies:

Read\Download PDF online:



FPS Creator has fpi command SHOTDAMAGE = X, which means: "If the entity \ character takes damage, it perform the action ...." But the list of commands fpi you will not find a similar command to the player. BUT you can realize it with the help of internal variables «internal». You will need a variable «$ PH» (Player Health), which shows the level of health of the player. The main principle of our commands is as follows: "If the player's health has changed (not equal to the current value), then perform the action ...."
Creating this condition

First you need to create a new local variable. That we need to compare the current health of the player:

:state=0:dimlocalvar=H,setvar=H $PH,state=1

dimlocalvar=H – the name of the new variable (it can be anything, for convenience, I use the H (Health);
setvar=H $PH – assign our variable "H" value «$ PH», that is Our variable has a value equal to the current health of the players (the default is 500 hp).
Now you need to create a comparison of these variables. We will write the script for this algorithm, "if the value of the variable $ PH is less than the value of the variable H, then ..."

How to do it? Very simple! We will use the «PLRHEALTHLESS = X». The second line of the script would look like:


The icon "%" means that fpi command «plrhealthless» takes a value in our variable "H" (remember that the value of the variable H is equal to the current health of player - 500 hp).

But there is not enough of another fpi command after the second a colon, namely the renovation of our variable "H". When the player's health has changed, we need to update our variable "H" and assign it a new value of the current health of the player. So we finish the second line of the script action:

:state=1,plrhealthless=%H:setvar=H $PH,state=2

Now what happens? Once a player has changed the level of health, our condition is triggered «plrhealthless =% H» and updated value of the variable "H" to a new level of current health. It's too hard? Here's a simple example:
The player has 500 hp, it fell from a great height and his health declined by 50 hp. Since Variable H = 500, then just our condition can write:


After this condition is updated value of the variable "H":
setvar=H $PH
Now the variable H = 450. As you have seen, we have introduced an additional variable to the script has been universal, that we do not have to register multiple «plrhealthless = x» in each case.


With this condition greatly expanded range of possibilities FPS Creator! Now it is possible to implement many ideas related to the health of the player. For example, as implemented in the script pack №10, heartbeat and blood drops on the screen when critical injuries. Earlier this script took lots and lots of strings to react to the slightest change in health. Now is responsible for it all one line! We just do the assignment of the value of one variable to another, such as the programming language of a higher level:

a = 500
b = a
if a < b then

As you can see something like that can be implemented and FPS Creator.
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 2nd Jun 2015 16:25 Edited at: 2nd Jun 2015 16:34
That's very good hukuta94
Nice way of thinking "out of the box". I have needed something
just like this in the past. I will play with this and see what
I can do. Definitely will keep this script.
Good work and Thank You for sharing this.

edit: hukuta94 I was thinking, since $PH defaults to 500
is it possible to change the player health to say 100 before
running your script? Like maybe first run "setvar=$PH 100
then run YOUR script??

My games never have bugs. They just develop random features..
Lots and lots of random features...
Years of Service
User Offline
Joined: 4th Jan 2011
Location: Russian Federation
Posted: 3rd Jun 2015 00:28
Yes, you can run first setvar=$PH 100 or set health in player's settings

Login to post a reply

Server time is: 2022-09-25 21:42:28
Your offset time is: 2022-09-25 21:42:28