Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,618 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Entity question - Please help #256969
03/19/09 19:43
03/19/09 19:43
Joined: Mar 2007
Posts: 34
Osasco
xandeck Offline OP
Newbie
xandeck  Offline 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:

Quote:

#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:

Quote:

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 Offline
Expert
EvilSOB  Offline
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).
Code:
#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 Offline OP
Newbie
xandeck  Offline 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 smile


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 Offline
Expert
EvilSOB  Offline
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] #256987
03/19/09 21:30
03/19/09 21:30
Joined: Mar 2007
Posts: 34
Osasco
xandeck Offline OP
Newbie
xandeck  Offline OP
Newbie

Joined: Mar 2007
Posts: 34
Osasco
OK, thanks again


XandeCK
Lead Developer
JogadorVIP.com
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 Offline
Member
bobby_danseco  Offline
Member

Joined: Dec 2008
Posts: 124
hi evisob

may i ask for the lite-c equivalent code for
the player portion script. smile

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 Offline
Expert
EvilSOB  Offline
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.
Code:
   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: EvilSOB] #257186
03/21/09 10:36
03/21/09 10:36
Joined: Dec 2008
Posts: 124
bobby_danseco Offline
Member
bobby_danseco  Offline
Member

Joined: Dec 2008
Posts: 124
im using sed ver 7.11.1 i have A7.7 commercial. im having an error 'hit' undeclared identifier.. frown

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 Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Aha, "hit" became valid in 7.20. Try this instead
Code:
   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 Offline
Member
bobby_danseco  Offline
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. smile

Page 1 of 3 1 2 3

Moderated by  HeelX, rvL_eXile 

Gamestudio download | 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