Entity creator problem

Posted By: Ness

Entity creator problem - 02/28/09 18:23

hello,i am trying to programm an entity creator like!
There is a main model like a box!
it has his action mainbox!
His stats are:

Click to reveal..
function test();
function babytest();
function babybox();


action box
{
player = me;
my.enable_click = on;
my.event = test;
}


function test()
{
if(event_type == event_click)
{
ent_create("babybox.mdl",player.x,babybox);
}
}

function babybox()
{
my.enable_click = on;
my.event = babytest;
}

function babytest()
{
if(event_type == event_click)
{
ent_create("babybox.mdl",player.x,babybox);
}
}


well to this point it should function well!
The problem is i want that every model have to be INDIPENDENT!
Meaning: Every entity should have his own heart var!!!!,own position VAR!
Meaning: If i click a babybox,it should post his heart as a text!
If i click another babybox it should show HIS own heart!
So how can i make this????
I cant use public vars because i can use them only in the function where i created the var!
Global vars are not possible too because 1 VAR can not have all stats of the created entitys! Someone said i have to use skills! And i think there have to be something with arrays too?! Could someone post a tutorial or something like this how it is makeable?
I cant solve this creating problem!

PS:
1)The try to post wait(1); in every function DOES NOT WORK!
2)The fake indipendet thingy wouldnt work too! Meaning: creating for every entity creating his own vars is too much work! and i want that i can create hundreds of entitys with own stats... i want this interactive function!Creating lots of entitys
greetings ness frown

Posted By: Jaxas

Re: Entity creator problem - 03/01/09 08:39

first change "function babybox()" to "action babybox()" and then create local variables like heart or what ever you want, or you can use skills for that wink
Posted By: badapple

Re: Entity creator problem - 03/01/09 09:32

it doesnt matter whether baby box is a function or an action really there the same , as for heart use a define like this
#define HEART skill17 a define is like a global var but everybodys HEART value can be different like so my.HEART=100;

hope that helps
Posted By: Ness

Re: Entity creator problem - 03/02/09 22:57

PROBLEM:
I cant use vector skills! BAD BAD!
because:

action mainbox
{
..
....
my.defineplayer = player.z;
}

ent_CREATE("babybox.md.",my.defineplayer,babyfunction);

I get 0 for kopfhoehe!
How the hell can i do this without skills???
Posted By: Jaxas

Re: Entity creator problem - 03/03/09 18:52

whay can't be

skill1 = player.x;
skill2 = player.y;
skill3 = player.z;

?
Posted By: Ness

Re: Entity creator problem - 03/13/09 16:50

Damn it,does nobody know ONE example about this entity creating if its so easy o.OŽ?!
I only know that its called OOP programming or capsuling like in Delphi,C++ BUT HOW does THIS function
in C-Script???
Can someone make a script,where i can create a entity and if i click on it i can see his heart on a panel....?

It would be very nice smile

PS: If you think that i can do nothing than its WRONG! I tried but i get some fatal results which are bad!
Posted By: Ness

Re: Entity creator problem - 04/20/09 21:13

Originally Posted By: badapple
it doesnt matter whether baby box is a function or an action really there the same , as for heart use a define like this
#define HEART skill17 a define is like a global var but everybodys HEART value can be different like so my.HEART=100;

hope that helps


How can i check on a panel which heart var i mean?
I have only 1 model and its the player which creates the babyplayers! each babyplayer has this my.heart = 100!
Let me ask something: if i clicked at babyplayer2,how can i now that its my.heart(babyplayer2)?
what do i have to write in:
digits(0,0,30*,1,???)
to get the heart level of babyplayer2?
Posted By: Jaxas

Re: Entity creator problem - 04/21/09 08:15

you write babyplayer2.heart wink you should learn again about local and global variables, and especial about skills smile
Posted By: Ness

Re: Entity creator problem - 05/17/09 15:05

you made me more stupid than before...
whats wrong?
Posted By: darkinferno

Re: Entity creator problem - 05/17/09 15:20

Originally Posted By: Jaxas
first change "function babybox()" to "action babybox()" and then create local variables like heart or what ever you want, or you can use skills for that wink
he doesnt have to...

what i would do, is define local variables in each baby player and have a global variable for the health bar, something like...
Code:
var globvar;

function babyplayer()
{
var my_health;
while(1)
 {
  if (myselected)//player selected this baby to view its health
  {
  globvar=my_health;
  }
  wait(1); 
 }
}

© 2024 lite-C Forums