Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,405 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Entity Panel [Re: Meerkat] #253005
02/22/09 02:28
02/22/09 02:28
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
little question:

Code:
ENTITY* hud_ent_heart_01 = {type="Herz.mdl";view=camera;x = 700;y =  360;z = 280;tilt = 90;event=heart_1();flags2 = SHOW;}

That´s the code to create the Entity..

Now i want to animate it with:
Code:
function heart_1()
{
	my.skill1 = 1;
	while(1)
	{
		if(player.skill98 == my.skill1 + 3){ent_animate(my,"heartp",  0,ANM_CYCLE);}
		if(player.skill98 == my.skill1 + 2){ent_animate(my,"heartp", 25,ANM_CYCLE);}
		if(player.skill98 == my.skill1 + 1){ent_animate(my,"heartp", 50,ANM_CYCLE);}
		if(player.skill98 == my.skill1){    ent_animate(my,"heartp", 75,ANM_CYCLE);}
		if(player.skill98 <  my.skill1){    ent_animate(my,"heartp",100,ANM_CYCLE);}
	}
}


But the Model won´t do anything..

Why???


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Entity Panel [Re: Espér] #253006
02/22/09 03:19
02/22/09 03:19
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
heart_1 isnt being run because view entities dont have actions (as far as I know).
The 'event' entry in a view entity isnt an action.

Change all references in heart_1 from "me" to to be "hud_ent_heart_01" ,
then manually call the heart_1 function when you want it to start working.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Entity Panel [Re: EvilSOB] #253007
02/22/09 03:57
02/22/09 03:57
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
made it..
But the hearts are not animated...
here the complete code:
Click to reveal.. ("HUD")

Code:
//=================================================================================================================================
//                                                                                                                               //
//                                                     DAS HUD-SCRIPT                                                            //
//                                                     ^^^^^^^^^^^^^^                                                            //
//                                                                                                                               //
//=================================================================================================================================

function heart_1();function heart_2();function heart_3();function heart_4();function heart_5();
function heart_6();function heart_7();function heart_8();function heart_9();function heart_10();function heart_11();
function heart_12();function heart_13();function heart_14();function heart_15();function heart_16();

ENTITY* hud_ent_heart_01 = {type="Herz.mdl";view=camera;x = 700;y =  360;z = 280;tilt = 90;flags2 = SHOW;}
ENTITY* hud_ent_heart_02 = {type="Herz.mdl";view=camera;x = 700;y =  325;z = 280;tilt = 90;flags2 = SHOW;}
ENTITY* hud_ent_heart_03 = {type="Herz.mdl";view=camera;x = 700;y =  290;z = 280;tilt = 90;flags2 = SHOW;}
ENTITY* hud_ent_heart_04 = {type="Herz.mdl";view=camera;x = 700;y =  255;z = 280;tilt = 90;flags2 = SHOW;}
ENTITY* hud_ent_heart_05 = {type="Herz.mdl";view=camera;x = 700;y =  220;z = 280;tilt = 90;flags2 = SHOW;}
ENTITY* hud_ent_heart_06 = {type="Herz.mdl";view=camera;x = 700;y =  185;z = 280;tilt = 90;flags2 = SHOW;}
ENTITY* hud_ent_heart_07 = {type="Herz.mdl";view=camera;x = 700;y =  150;z = 280;tilt = 90;flags2 = SHOW;}
ENTITY* hud_ent_heart_08 = {type="Herz.mdl";view=camera;x = 700;y =  115;z = 280;tilt = 90;flags2 = SHOW;}

//=================================================================================================================================
//                                                                                                                               //
//                                                       FUNKTIONEN                                                              //
//                                                       """"""""""                                                              //
//                                                                                                                               //
//=================================================================================================================================

function heart_1()
{
	hud_ent_heart_01.skill1 = 1;
	if(player.skill98 == hud_ent_heart_01.skill1 + 3){ent_animate(hud_ent_heart_01,"heartp",  0,ANM_CYCLE);}
	if(player.skill98 == hud_ent_heart_01.skill1 + 2){ent_animate(hud_ent_heart_01,"heartp", 25,ANM_CYCLE);}
	if(player.skill98 == hud_ent_heart_01.skill1 + 1){ent_animate(hud_ent_heart_01,"heartp", 50,ANM_CYCLE);}
	if(player.skill98 == hud_ent_heart_01.skill1){    ent_animate(hud_ent_heart_01,"heartp", 75,ANM_CYCLE);}
	if(player.skill98 <  hud_ent_heart_01.skill1){    ent_animate(hud_ent_heart_01,"heartp",100,ANM_CYCLE);}
}


//=================================================================================================================================
//                                                                                                                               //
//                                                        AKTIONEN                                                               //
//                                                        """"""""                                                               //
//                                                                                                                               //
//=================================================================================================================================

function hud_update()
{
	while(1)
	{
		heart_1();
		wait(1);
	}
}




player.skill98 are the momental HP of the player.. at the beginning, this is set to 4

Hope someone has an idea..


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Entity Panel [Re: Espér] #253013
02/22/09 05:07
02/22/09 05:07
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I dont get what you are trying to do... These answers will help me.
What are/is the Herz.mdl animations doing?
Is it a beating heart cycle, a shrinking heart cycle, or something else?

Are ALL the hearts supposed to 'die' during the players journey from 100 to zero?
Or does each hart die one by one as the player approaches death?

When player.skill98 = 100, is that FULL-health or dead?

What is the point of the heart.skill1 being 1,2,3 or 4? What does it symbolise?

Overall, on-screen , what should the string of hearts do as player hets hurt?

Last edited by EvilSOB; 02/22/09 06:11. Reason: more questions

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Entity Panel [Re: EvilSOB] #253048
02/22/09 12:29
02/22/09 12:29
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
I try to explain better..:

First a Picture of the heart-Animation:


And now explaining:

entity.skill1 of the hearts, is the minimum value, the heart should react to.

first heart has a min_hp value of 1.
The second heart´s min_hp is 5.
the 3rd min_hp value is 9..

Means.. Each heart reacts from his min_hp to his min_hp+3 ( 4 steps )

player.skill98 are the player´s hp. Like in zelda, it calculates in quarter-steps ( 4,8,12,16...).

MEANS:
Player.skill99 ( max HP ) is 12, skill98 is 12
= 3 hearts are visible
Player.skill99 ( max HP ) is 12, skill98 is 10
= 2 hearts + 1 half are visible
Player.skill99 ( max HP ) is 12, skill98 is 3
= one 3/4 heart is visible

Zelda HUD ^^

Now you ask, why not using sprites instead of models.
Easy: the models will beat a bit, and rotate on their pan/tilt/roll randomly a bit. Sprites look ugly there ^^

What i need now:
The animation of the heart is called "heartp". is has 5 animation steps. Later the beating will be added. But the hearts are not animated with my code yet. Why?


Edit:
At the 3/4,half,1/4 and non heart Pic, the ">=" is "=="
Made a little writing mistake.

Last edited by Espér; 02/22/09 12:31. Reason: >>little symbol mistake in the picture explained

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Entity Panel [Re: Espér] #253116
02/22/09 21:19
02/22/09 21:19
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Ok, I got it now. I'll get back to it later today...
I just needed to know the overall design so I could see where its going wrong.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Entity Panel [Re: EvilSOB] #253163
02/23/09 07:29
02/23/09 07:29
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Sorry for such a complete re-write, but I found it easier that way.
I couldnt really see where your code was going wrong, because I couldnt
actually figure out how it was "trying" to work.... My bad I believe.

So here is my interpretation of your code.
I BELIEVE it is achieving what you wanted. Let me know if it isnt...
Code:
#include <acknex.h>
#include <default.c>

/////  DE-Bugging ONLY  -  START
STRING* health = "#15";		STRING* v1 = "#15";		STRING* v2 = "#15";	
TEXT* healthbar = { pos_x=20; pos_y=210; font="Arial#24bi"; string(health,v1,v2); flags=SHOW; }
//
var test1()	{	player.skill98 += 1;		}
var test2()	{	player.skill98 -= 1;		}
/////  DE-Bugging ONLY  -  END


//=================================================================================================================================
//                                                                                                                               //
//                                                     DAS HUD-SCRIPT                                                            //
//                                                     ^^^^^^^^^^^^^^                                                            //
//                                                                                                                               //
//=================================================================================================================================

function heart_1();function heart_2();function heart_3();function heart_4();function heart_5();
function heart_6();function heart_7();function heart_8();function heart_9();function heart_10();function heart_11();
function heart_12();function heart_13();function heart_14();function heart_15();function heart_16();

//
//=================================================================================================================================
//                                                                                                                               //
//                                                       FUNKTIONEN                                                              //
//                                                       """"""""""                                                              //
//                                                                                                                               //
//=================================================================================================================================
//
ENTITY* hud_ent_heart[8];
//
function heart_startup()
{	var h; for(h=0; h<8; h++)	//only needs running ONCE bet game-boot
	{	hud_ent_heart[h] = ent_createlayer("Herz.mdl", NULL, 1000);		
		vec_set(hud_ent_heart[h].x, vector(700,(360-(h*35)),280));
		hud_ent_heart[h].tilt = 90;		}	
}	
//
//
function heart_1()
{
	var heart_num  = integer(player.skill98 / 4);
	var h; for(h=0; h<8; h++)
	{
		if(heart_num<h)								//if lower health than this heart
		{	ent_animate(hud_ent_heart[h], "heartp",   0, ANM_SKIP);	}
		else
		{	
			if(heart_num>h)							//if higher health than this heart
			{	ent_animate(hud_ent_heart[h], "heartp", 100, ANM_SKIP);  }
			else											//if ON this heart
			{	ent_animate(hud_ent_heart[h], "heartp", fraction(player.skill98/4)*100, ANM_SKIP);	}
		}			
		//insert standard heartbeat animation gere if you want to.
	}
/////  DE-Bugging ONLY  -  START
str_cpy(health, "");	str_cat_num(health, "health = %.0f", player.skill98);
str_cpy(v1,"");	str_cat_num(v1,"heart   = %.0f",heart_num);
str_cpy(v2,"");	str_cat_num(v2,"percent = %.0f",fraction(player.skill98/4)*100);
/////  DE-Bugging ONLY  -  END
}


//=================================================================================================================================
//                                                                                                                               //
//                                                        AKTIONEN                                                               //
//                                                        """"""""                                                               //
//                                                                                                                               //
//=================================================================================================================================

function hud_update()
{
	while(1)
	{
		heart_1();
		wait(1);
	}
}


function main()
{
	fps_max = 60;	level_load(NULL);		wait(5);		diag("\n\n\n");		wait(5);

	player = ent_create("player.mdl", nullvector, NULL);
	player.skill99 = player.skill98 = 12;
	hud_update();


/////  DE-Bugging ONLY  -  START
on_1=test1;
on_2=test2;
/////  DE-Bugging ONLY  -  END
	
	while(1)		wait(1);
}



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Entity Panel [Re: EvilSOB] #253191
02/23/09 12:56
02/23/09 12:56
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
will try qhen I'm at home... In the evening...


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Entity Panel [Re: Espér] #253302
02/23/09 21:35
02/23/09 21:35
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
seems not to work...


The little number right_top is the HP of the player ( debug-Panel )
It´s 7.. but 8 hearts are shown completely...


2nd question..
How to add 2 more lines of hearts??? 8 Hearts is the maximum of a line.


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Entity Panel [Re: Espér] #253316
02/23/09 23:52
02/23/09 23:52
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

A counter starts at 0
so 0 to 7 is 8

Ottawa

Page 2 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1