3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Entity question - Please help
#256969
03/19/09 19:43
03/19/09 19:43
|
Joined: Mar 2007
Posts: 34 Osasco
xandeck
OP
Newbie
|
OP
Newbie
Joined: Mar 2007
Posts: 34
Osasco
|
Hello all, please, I have a little doubt: I made an action and set up an entity to it: #define TIPO_OBJETO skill57 //type of object, for other tests ENTITY* entObstaculo; //entity for traps
action acao_obst_rampa1 (){ while (!player){ wait(1); } entObstaculo = my; my.TIPO_OBJETO = 4; while (1){ my.pan += 1 * time_step; wait(1); } }
I put this script into 2 of my models. As the command says, it needs to keeps rotating into pan angle. Simple. Ok so far... but, inside my player script I put some commands to show a text when the player hits the model from above: VECTOR temp[3]; var dist_chao; //distance to ground vec_set(temp.x, my.x); temp.z -= 5000; dist_chao = c_trace(my.x, temp.x, IGNORE_PASSABLE); if (hit.entity == entObstaculo){ set (mypanel, VISIBLE); } else { reset (mypanel, VISIBLE); }
The "mypanel" panel only appears in the second model my player touches. In my point fo view, it is like the engine is setting the entObstaculo ENTITY first defined into first model and then it replaces into the second model. Somebody can explain this, please?! Why my pointer cant recognize my 2 entities? Do I need to create one entity for each model I have? Example: ENTITY* model1; //then I place this in model 1 ENTITY* model2; //then I place this in model 2
Last edited by xandeck; 03/19/09 19:46.
XandeCK Lead Developer JogadorVIP.com
|
|
|
Re: Entity question - Please help
[Re: xandeck]
#256971
03/19/09 20:05
03/19/09 20:05
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Tricky, you CAN define multiple entity pointers, but then youll need a different action for every entity.(More or less so anyway) Easier like this(untested code), then an actual pointer to the Obstaculo entities is no longer required(no matter how many). #define TIPO_OBJETO skill57 //type of object, for other tests
#define OBJECT_TYPE skill56 //type of object
#define OBSTACULO 1 //one type of object is an Obstaculo
action acao_obst_rampa1()
{
my.OBJECT_TYPE = OBSTACULO; //make ME an Obstaculo
my.TIPO_OBJETO = 4;
while (!player) { wait(1); }
while(me)
{
my.pan += 1 * time_step;
wait(1);
}
}
---then later on, in the player script---
...
VECTOR temp; //not VECTOR temp[3];
var dist_chao; //distance to ground
vec_set(temp.x, my.x);
temp.z -= 5000;
dist_chao = c_trace(my.x, temp.x, IGNORE_PASSABLE);
if (hit.entity.OBJECT_TYPE==OBSTACULO)
{ set (mypanel, VISIBLE); }
else
{ reset (mypanel, VISIBLE); }
... Ant problems or questions, ask away...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Entity question - Please help
[Re: EvilSOB]
#256973
03/19/09 20:12
03/19/09 20:12
|
Joined: Mar 2007
Posts: 34 Osasco
xandeck
OP
Newbie
|
OP
Newbie
Joined: Mar 2007
Posts: 34
Osasco
|
I will try that... thanks man... You said "not VECTOR temp[3]"... why not? Whats the diference? Thanks 
XandeCK Lead Developer JogadorVIP.com
|
|
|
Re: Entity question - Please help
[Re: xandeck]
#256977
03/19/09 20:24
03/19/09 20:24
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
VECTOR temp; create a vector containing X, Y, and Z values. temp.x, temp.y, and temp.z
VECTOR temp[3]; creates THREE vectors containing X, Y, and Z values. temp[0].x, temp[0].y, and temp[0].z (temp[0].x, y, z can also just be accessed as temp.x, y, z) temp[1].x, temp[1].y, and temp[1].z temp[2].x, temp[2].y, and temp[2].z
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Entity question - Please help
[Re: EvilSOB]
#257174
03/21/09 08:01
03/21/09 08:01
|
Joined: Dec 2008
Posts: 124
bobby_danseco
Member
|
Member
Joined: Dec 2008
Posts: 124
|
hi evisob may i ask for the lite-c equivalent code for the player portion script.  thanks. bobby
|
|
|
Re: Entity question - Please help
[Re: bobby_danseco]
#257183
03/21/09 09:58
03/21/09 09:58
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Maybe someone else can help? Should work fine in lite-c as far as I can see. I use A7.73 commercial, lite-c. This code works in my lite-c, but if it doesnt work in lite-c(free) I dont know the differences. Sorry.
VECTOR tmpV;
vec_set(tmp, my.x);
tmpV.z -= 5000;
var dist_chao = c_trace(my.x, temp.x, IGNORE_PASSABLE);
if(hit.entity.OBJECT_TYPE==OBSTACULO)
{ set(mypanel, VISIBLE); }
else
{ reset(mypanel, VISIBLE); }
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Entity question - Please help
[Re: bobby_danseco]
#257201
03/21/09 12:43
03/21/09 12:43
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Aha, "hit" became valid in 7.20. Try this instead VECTOR tmpV; vec_set(tmp, my.x); tmpV.z -= 5000;
you=NULL;
var dist_chao = c_trace(my.x, temp.x, IGNORE_PASSABLE);
if(you!=NULL) //make sure an ENTITY has been hit
{ if(you.OBJECT_TYPE==OBSTACULO) //check if entity is an OBSTACULO
{ set(mypanel, VISIBLE); }
else
{ reset(mypanel, VISIBLE); }
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Entity question - Please help
[Re: EvilSOB]
#257220
03/21/09 14:58
03/21/09 14:58
|
Joined: Dec 2008
Posts: 124
bobby_danseco
Member
|
Member
Joined: Dec 2008
Posts: 124
|
it seems that it doesnt work for me either.. how can i get the same version as you have. i downloaded recently on the 3dgs site and i got the file version 7.7.0.1 anyway ill try it again.. thank you very much. 
|
|
|
|