G
Goliath
Guest
Here is a script i want to share:
It drains entity HP over time and kills it when HP = 0.
Usefull for delays and signals, like warning signal.
How to use it:
Declare command on anim like this:
@cmd drainHP 5
An example of use:
You can control the time on level spawn, like this:
Code:
void drainHP (int quantity){
// Drains Health over time and killself
void self = getlocalvar("self");
void true = getentityproperty(self, "exists");
int Health = getentityproperty(self, "health");
if(true!=NULL()){
changeentityproperty(self, "health", Health-quantity);
if (Health <= 0){
changeentityproperty(self, "animation", openborconstant("ANI_DEATH"));
}
}
}
It drains entity HP over time and kills it when HP = 0.
Usefull for delays and signals, like warning signal.
How to use it:
Declare command on anim like this:
@cmd drainHP 5
An example of use:
Code:
#----------WARNING SIGN
name Warning
type none
health 5
facing 1
nolife 1
nopain 1
falldie 1
nomove 1 1
antigravity 100
animationscript data/scripts/oscript.c
anim idle
loop 1
delay 30
offset 24 36
frame data/sprites/ws.png
[color=orange]@cmd drainHP 5[/color]
frame data/chars/misc/empty.png
anim death
delay 1
offset 1 1
@cmd killentity getlocalvar("self")
frame data/chars/misc/empty.png
You can control the time on level spawn, like this:
Code:
spawn Warning
Health 50
coords 250 223 133
at 0