|
Panels and ENTITY Skills
#223531
08/24/08 23:47
08/24/08 23:47
|
Joined: Oct 2007
Posts: 27
phmenard
OP
Newbie
|
OP
Newbie
Joined: Oct 2007
Posts: 27
|
How can I get the skills of an entity to show up in a panel. For example ...
#define Name skill50 ***This creates a problem *** #define Health skill51
ENTITY* Person = NULL;
function main() { you = ent_create("person.mdl",target.x,Human_Act); }
action Human_Act() { ***** this next line causes an error "can't convert array to fixed" why is this. *******
my.name = "Paul"; my.heath = 100; while(1) { *** some actions ***
}
}
PANEL* info = { pos_x = 0; pos_y = 100; bmap = ppl_info; digits = 5,15,"Name: %s",*,1,mouse_ent.name; digits = 5,25,"Health: %s",*,1,mouse_ent.health; }
this isn't the actual code I am playing around with I just typed it in quickly so you get the idea. As you can see I'm trying to get a panel to display information about a entity that has been "clicked" mouse_ent from what I understand is supposed to hold all information on an entity that has been clicked, then why is the panel info always 0 or null in the case of the name ... I can't even give name a value because of the error. This seems that it should be this hard to figure out, can someone point me in the right direction.
|
|
|
Re: Panels and ENTITY Skills
[Re: badapple]
#223566
08/25/08 08:05
08/25/08 08:05
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
STRING* str_a = "";
STRING* str_b = "";
PANEL* info =
{
pos_x = 0; pos_y = 100;
bmap = ppl_info;
digits = 5,15,"Name: %s",*,1,str_a;
digits = 5,25,"Health: %s",*,1,str_b;
}
function mouse_str()
{
while(1)
{
if(mouse_ent)
{
str_num(str_a,mouse_ent.name);
str_num(str_b,mouse_ent.health);
}
wait(1);
}
}
function main()
{
...
mouse_str();
...
"empty"
|
|
|
Re: Panels and ENTITY Skills
[Re: flits]
#223665
08/25/08 20:41
08/25/08 20:41
|
Joined: Oct 2007
Posts: 27
phmenard
OP
Newbie
|
OP
Newbie
Joined: Oct 2007
Posts: 27
|
Yea that all seems to work fine, but I thought ENTITY was global??? so why would I have to create TWO more variables ... this doesn't make sense. Why couldn't I just use ...
PANEL* info = { pos_x = 0; pos_y = 100; bmap = ppl_info;
digits = 5,15,"Name: %s",*,1,mouse_ent.name; digits = 5,25,"Health: %s",*,1,mouse_ent.health; }
instead of your panel code above flits?? And not only am I creating TWO more variables I'm also creating another infinite loop, why would I want to do that ... this seems like a waist of resources. Shouldn't these calculations be able to take place in an action and "mouse_ent" updated every step of the way?? seems odd to me ... can anyone help???
|
|
|
Re: Panels and ENTITY Skills
[Re: MrGuest]
#224747
09/01/08 00:37
09/01/08 00:37
|
Joined: Oct 2007
Posts: 27
phmenard
OP
Newbie
|
OP
Newbie
Joined: Oct 2007
Posts: 27
|
and then what ... do somthing like this ...
PANEL* info = { pos_x = 0; pos_y = 100; bmap = ppl_info;
digits = 5,15,"Name: %s",*,1,player .name; digits = 5,25,"Health: %s",*,1,player .health; }
|
|
|
Re: Panels and ENTITY Skills
[Re: MrGuest]
#224823
09/01/08 11:57
09/01/08 11:57
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
The problem you are probably going to get is that unless "player" is defined in WED, your going to get compile errors from the panel on the "player.???" lines. Because if player is undefined ay compile time, the panel cant find "player.name" because "player==NULL". UNLESS you cheat. It can get messy but if you are careful you can get away with it. At the top of your code somewhere define "player" like this ENTITY* player = { x=x; }
instead of
ENTITY* player; This creates a dummy global entity for your panel to compile with. The rest of your coding can stay the same.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|