|
Re: Create Entity pointers dinamicly (runtime)
[Re: amadeu]
#131341
05/23/07 21:20
05/23/07 21:20
|
Joined: Mar 2007
Posts: 776 Poor village - Poland ;)
tompo
User
|
User
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
|
maybe I do not understand... but can't You do this with simple you pointer? create next player and inside his action write:
you = ent_create("arrow.mdl",my.x,arrow_fun); and then in arrow_fun in loop my.x = you.x; my.y = you.y - 250;
or in player action my.skill70 = ent_create("arrow.mdl,my.x,null) and in the same player action in loop you = my.skill70; you.x = my.x; you.y = my.y -250;
Or I missed something
Last edited by tompo; 05/23/07 21:20.
Never say never.
|
|
|
Re: Create Entity pointers dinamicly (runtime)
[Re: amadeu]
#131343
05/23/07 21:44
05/23/07 21:44
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
Serious User
|
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
every player go at the begin of his action through a loop and put his pointer into an array, if u want to have the number 5 u just ahve to pcik the 5th array-element Code:
action player { var i; while(i<10&&i!=0) { i+=1; } player_ptr[i]=me; }
if u want to get the position just write: Code:
my=player_ptr[4];
edit: if you player 5 is a special entity u have to say it the engine per skill so the action would be that way: Code:
action player { player_ptr[my.skill1-1];//-1 becasueif he's player number 5he get the index 4 }
Last edited by Scorpion; 05/23/07 21:45.
|
|
|
Re: Create Entity pointers dinamicly (runtime)
[Re: amadeu]
#131345
05/23/07 22:29
05/23/07 22:29
|
Joined: Mar 2007
Posts: 776 Poor village - Poland ;)
tompo
User
|
User
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
|
you may create a var and define f.e. var number_var; define number,skill1;
then each time you create entity (player) add +1 to number_var; something like:
number_var +=1; you = ent_create(bla,bla,bla) you.number = number_var; so every player will have his own number skill
then if(you.number == 5){show me your position;} like: var avatar_pos[3]; if(you.number == 5){vec_set(avatar_pos,you.pos);} it means... avatar_pos.x = you.x; avatar_pos.y = you.y; avatar_pos.z = you.z;
Last edited by tompo; 05/23/07 22:32.
Never say never.
|
|
|
Re: Create Entity pointers dinamicly (runtime)
[Re: tompo]
#131346
05/24/07 05:54
05/24/07 05:54
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
I think very few if any use it but... Using entity linked lists / entity arrays plugin (eLL) I might find pos of player 5 like this: Code:
entity* ent0; define _id, skill38;
// create players function plfCreate() { var i = 0; eLLsDelete(); eLLsNew(1); while(i < 10) { ent0 = ent_create(<player.mdl>, pos, function); ent0._id = i + 1; eLLPush(0, ent0); i += 1; } }
// find player pos function plfPosFind(id, &_pos) { eLLNextReset(0); ent0 = eLLNext(0); while(ent0 != NULL) { if (ent0._id == id) { vec_set(_pos, ent0.x); return(1); } ent0 = eLLNext(0); } return(0); }
// plfPosFind(5, temp);
get eLL here (ver. 6.5 will be uploaded later)
|
|
|
|