dantedevil
Well-known member
I have two scripts for use in my character hero.
This scripts are:
trailer.c
And bar.c
This is my character header:
This way works perfect all.
But can't find a way to put bar.c script in my character.
If set like this:
The trailer.c nor work, only the bar.c.
If set the bar.c first and next trailer.c, only the last works again.
I try setting bar.c like this
But nothing...
How can make to use this 2 scripts together?
This scripts are:
trailer.c
Code:
#include "data/scripts/trailer.h"
void main()
{
int i, j, k;
void spr;
int facing, cd;
float a, z, x;
void ent = getlocalvar("self");
int anim = getentityproperty(ent, "animationid");
void map;
int elapsed_time = openborvariant("elapsed_time");
if(anim == openborconstant("ANI_FREESPECIAL5")){ map = getentityproperty(ent, "colourtable", 0);}
if(anim == openborconstant("ANI_FOLLOW9")){ map = getentityproperty(ent, "colourtable", 0);}
if(anim == openborconstant("ANI_FREESPECIAL13")){ map = getentityproperty(ent, "colourtable", 0);}
if(anim == openborconstant("ANI_FREESPECIAL14")){ map = getentityproperty(ent, "colourtable", 0);}
if(anim == openborconstant("ANI_FREESPECIAL16")){ map = getentityproperty(ent, "colourtable", 0);}
setglobalvar("blahblah.map", map);
if(elapsed_time%trailerd==0)
{
if((anim == openborconstant("ANI_FREESPECIAL5")) || (anim == openborconstant("ANI_FOLLOW9")) || (anim == openborconstant("ANI_FREESPECIAL13")) || (anim == openborconstant("ANI_FREESPECIAL14")) || (anim == openborconstant("ANI_FREESPECIAL16")))
{
spr = getentityproperty(ent, "sprite");
x = getentityproperty(ent, "x");
z = getentityproperty(ent, "z");
a = getentityproperty(ent, "a");
facing = !getentityproperty(ent, "direction");
for(k=1; k<=trailermax; k++) //find an empty trailer slot
{
if(getglobalvar("trailer"+k+".s")==NULL())
{
setglobalvar("trailer"+k+".s", spr);
setglobalvar("trailer"+k+".x", x);
setglobalvar("trailer"+k+".z", z);
setglobalvar("trailer"+k+".a", a);
setglobalvar("trailer"+k+".f", facing);
setglobalvar("trailer"+k+".c", trailerc*trailerd);
break;
}
}
}
}
}
And bar.c
Code:
void main()
{
int i; int z; int t;int health;int off;
void pl;
char cstring;
if(openborvariant("in_level")==1)
{
z = openborconstant("FRONTPANEL_Z");
for(i=0; i<3; i++)
{
pl = getplayerproperty(i, "ent");
if(pl!=NULL())
{
void self = getlocalvar("self");
void target = findtarget(self);
health = getentityproperty(target, "health");
if (health<=20)// checks if the health is 20 or less and draws a red box
{
//drawbox(x, y, width, height, z, color, alpha)
drawbox(i*160+21, 37, health, 6, z+1000, rgbcolor(255,0,0));//health red
}
}
}
}
}
This is my character header:
Code:
name MIDAS
health 100
speed 8
throw 2 3
type player
grabdistance 45
shadow 0
gfxshadow 1
icon data/chars/midas/icon.png
makeinv 1
holdblock 1
bflash block
fmap 2
jumpheight 3.5
mp 100
mprate 2
dust dust
risetime 100
projectilehit player obstacle
falldie 2
diesound data/sounds/yuoh.wav
animationscript data/scripts/script.c
onfallscript data/scripts/release.c
script data/chars/midas/trailer.c
This way works perfect all.
But can't find a way to put bar.c script in my character.
If set like this:
Code:
animationscript data/scripts/script.c
onfallscript data/scripts/release.c
script data/chars/midas/trailer.c
script data/scripts/bar.c
If set the bar.c first and next trailer.c, only the last works again.
I try setting bar.c like this
Code:
ondrawscript data/scripts/bar.c
How can make to use this 2 scripts together?