Life Bar above characters

oclipper

New member
Hi guys,

Is there script to have lifebar above characters head ? (and maintain default life bar top of game screen). I found no results searching the forum, some mods have this feature (life bar above monsters like RPG games) but no idea how to bring it on my mod.

example:
http://i.imgur.com/fsrZsnK.png
 
Use updated.c for that. You can draw the bars yourself with two drawbox calls or you can move engine created bars.

You have to loop through entities and create/move bars. Here's a function example to move bars :

Code:
void drawBars(){
	int iECnt = openborvariant("count_entities");
	int iEnt;
	void vEnt, previousAggro;
	void aniID;
	int entGroup;
	int count = 0;
	int i;
	for(iEnt=0; iEnt<iECnt; iEnt++){
		vEnt=getentity(iEnt);
		if(getentityproperty(vEnt,"exists")){
		
			int x = getentityproperty(vEnt, "x");
			int z = getentityproperty(vEnt, "z") - openborvariant("ypos");
		
			changeentityproperty(vEnt, "lifeposition", x, z-100);
			changeentityproperty(vEnt, "nameposition", x+20, z-100);
		}
	}
	
}



To enable engine created bar, in entity file :

Code:
lifebarstatus 100 10 0 0
lifeposition -999 -999
iconposition -999 -999
nameposition -999 -999

 
thansks for reply;

with this update.c script shows static hp/mana with numbers. But about life bar above character head on all characters ? where to put this second code
 
oclipper said:
thansks for reply;

with this update.c script shows static hp/mana with numbers. But about life bar above character head on all characters ? where to put this second code

In updated.c (should be in scripts folder, if you don't have on just create one).

Code:
void main(){
    drawBars();

}
 
Piccolo said:
[...]
Code:
void drawBars(){
	int iECnt = openborvariant("count_entities");
	int iEnt;
	void vEnt, previousAggro;
	void aniID;
	int entGroup;
	int count = 0;
	int i;
	for(iEnt=0; iEnt<iECnt; iEnt++){
		vEnt=getentity(iEnt);
		if(getentityproperty(vEnt,"exists")){
		
			int x = getentityproperty(vEnt, "x");
			int z = getentityproperty(vEnt, "z") - openborvariant("ypos");
		
			changeentityproperty(vEnt, "lifeposition", x, z-100);
			changeentityproperty(vEnt, "nameposition", x+20, z-100);
		}
	}
	
}



To enable engine created bar, in entity file :

Code:
lifebarstatus 100 10 0 0
lifeposition -999 -999
iconposition -999 -999
nameposition -999 -999

With first code as update,c inside script folder, game crash after character select.

Where to put second code? I tried update,c from ClaFan mod and appeared hp/mana in numbers, My mod is based on final fight x,

edit>
im trying this:
http://www.chronocrash.com/forum/index.php?topic=741.0
 
He mentioned updated.c, not update.c. However, I can draw my lifebars for players in update.c but not the RPG style-like ones. There's a difference between update.c and updated.c. They're not the same.

update.c

    ~Engine starts update cycle.

updated.c

    ~Engine completes update cycle.

updated.c in which Piccolo meant/mentioned:

Code:
void main(){
    drawBars();
}

void drawBars(){
	int iECnt = openborvariant("count_entities");
	int iEnt;
	void vEnt, previousAggro;
	void aniID;
	int entGroup;
	int count = 0;
	int i;
	for(iEnt=0; iEnt<iECnt; iEnt++){
		vEnt=getentity(iEnt);
		if(getentityproperty(vEnt,"exists")){
		
			int x = getentityproperty(vEnt, "x");
			int z = getentityproperty(vEnt, "z") - openborvariant("ypos");
		
			changeentityproperty(vEnt, "lifeposition", x, z-100);
			changeentityproperty(vEnt, "nameposition", x+20, z-100);
		}
	}
	
}

With first code as update,c inside script folder, game crash after character select.

Where to put second code? I tried update,c from ClaFan mod and appeared hp/mana in numbers, My mod is based on final fight x,

Is that a typo that says "update,c" instead of "update.c"? (Does your file say "update.c" or "update,c"?)

I think these must be in the entity header for example.

Code:
name Rusty
health 100
speed 14
type enemy
lifebarstatus 100 10 0 0
lifeposition -999 -999
iconposition -999 -999
nameposition -999 -999

EDIT: I forgot this one here.

http://www.chronocrash.com/forum/index.php?topic=741.0
 
Back
Top Bottom