Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
4 registered members (ozgur, AbrahamR, wdlmaster, 7th_zorro), 839 guests, and 7 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
#Define problem #347828
11/19/10 20:06
11/19/10 20:06
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
Hi all,

I got a problem. Here's the code:

#define Health skill10 Health = 100;
#define Mana skill11 Mana = 50;

PANEL* skill_panel =
{

pos_x = 0;
pos_y = 0;

digits(50, 25, "Health = %0.f", *, 1, Health);
digits(50, 50, "Mana = %0.f", *, 1, Mana);

flags = OVERLAY | SHOW;
}

function main()

{
video_mode = 9;
screen_color.blue = 180;
mouse_mode = 4;
}

The problem is when I start the program, Health and Mana are still 0. How does this come?

Greetings Dave

Re: #Define problem [Re: GieskeBon] #347834
11/19/10 20:52
11/19/10 20:52
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
You are doing wrong dude, cause you are using 'defines' you need to define exactly what entity has its health set to 100 and mana to 100, like this:
Code:
#define Health skill1 
#define Mana skill2

PANEL* skill_panel =
{
	digits(50,25,"Arial#24bi",1,player.skill1); // SHOW PLAYERS HEALTH
	digits(50,50,"Arial#24bi",1,player.skill2); // SHOW PLAYERS MANA
	flags = SHOW; // You do not need to use OVERLAY for digits!!!
}

function handle_camera()
{
	vec_set(camera.x,vector(my.x - 150,my.y,my.z + 30));
	vec_rotate(camera.pan,my.pan);
}

action hero() // PLAYERS ACTION
{
	player = my; // I'm the player
	my.Health = 100; // my health is 100
	my.Mana = 100; // my mana is 100
	while(my.Health > 0) // while I'm alive
	{
		handle_camera(); // call camera's function
		wait(1);
	}
}

function main()
{
	fps_max = 75; // limit FPS at 75
	video_mode = 9;
	load_level(NULL); // load empty level
	ent_create("guard.mdl",nullvector,hero); // put default guard model into the projects folder
}

You can not define it like this:
Code:
#define Health skill10 Health = 100;
#define Mana skill11 Mana = 50;

You can only define vars like that!!! Example:
Code:
var Health = 100;
var Mana = 50;

And in PANELS you need to call skills, not the define's name! Example:
Code:
PANEL* skill_panel =
{
        //RIGHT!!
	digits(50,25,"Arial#24bi",1,player.skill1); // SHOW PLAYERS SKILL1  
        //WRONG!!!
        digits(50,25,"Arial#24bi",1,player.health);
	flags = SHOW;
}

Good luck. And read manual carefully.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: #Define problem [Re: 3run] #347836
11/19/10 21:05
11/19/10 21:05
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
Hey 3Run,

Thanks for the quick reply.
I found this at the manual under the 'skills' examples. Thats the reason why I did:

#define Health skill10 Health = 100;

About the PANEL*, I didn't know that! Even after reading it. But I will read it read it more carefully next time laugh

I will try it out.

Thanks again

Re: #Define problem [Re: GieskeBon] #347837
11/19/10 21:21
11/19/10 21:21
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I'm pretty sure you did not get that
#define Health skill10 Health = 100;
from the manual. Do you mean the following example?

#define health skill10
my.health = 99;
...

It can be misleading, but I hope you see the difference to your code. skill1-100 are contained in the ENTITY struct, that's why there's a my. in front of the "health".

#define health skill10
...
my.health = 99;
...

That should be clearer, right? Another example:

#define health skill10

action enemy() {
my.health = 99;
while(1) ...
}


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: #Define problem [Re: Superku] #347840
11/19/10 21:40
11/19/10 21:40
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
@ Superku,

Yes, thats the example I used and I think I understand it more clearer now. I will try this above in my code. Then I will see if I really understand it.

Thanks for your reply


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