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,709 guests, and 7 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
Touch entity. #176911
01/07/08 16:46
01/07/08 16:46
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
I have a gun entity in my project, and gave it an action named; gun_act
In WED I attached that action to the gun.
The action is working alright, because I put a rotation script in the action, and the gun starts to rotate.
Now I want the load a function when the player walks trough the gun.
What do I have to put in the my.emask, within the gun_act action?

This is the gun action:

Code:
action gun_act(){
while(1){
my.pan += 5*time_step;
wait(1);
}
my.emask |= ENABLE_IMPACT;
my.event = gun_func;
}



The funtion that needs to run is called gun_func, as seen in the script above.
But that function never runs...
That function is above the action in the script.

What did I do wrong?


The best games are the games you create yourself.
Re: Touch entity. [Re: NL_3DGS_n00b] #176912
01/07/08 17:27
01/07/08 17:27
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
you should place the two last lines before the while loop.

Re: Touch entity. [Re: ello] #176913
01/07/08 17:39
01/07/08 17:39
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
This is the action now:

Code:
action gun_act(){
my.emask |= ENABLE_IMPACT;
my.event = gun_func;
while(1){
my.pan += 5*time_step;
wait(1);
}
}



My player action:
(In my level is a MDL entity with this action.
Movement is OK, but collision doesn't work...)

Code:
action speler_act(){
player = me;
while(1){
camera.x = me.x;
camera.y = me.y;
camera.z = 90;
camera.pan = me.pan;
if(key_w)
c_move(me,vector(15*time_step,0,0),nullvector,GLIDE);
if(key_s)
c_move(me,vector(-15*time_step,0,0),nullvector,GLIDE);
if(key_d)
me.pan -= 10*time_step;
if(key_a)
me.pan += 10*time_step;

wait(1);
}
}




The best games are the games you create yourself.
Re: Touch entity. [Re: NL_3DGS_n00b] #176914
01/07/08 18:49
01/07/08 18:49
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
use my.emask |= ENABLE_entity;


"empty"
Re: Touch entity. [Re: flits] #176915
01/07/08 19:12
01/07/08 19:12
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
Also that isn't working.
I just walk through the model, nothing happens...
(Also, keep in mind, Lite-C is CAPS sensitive. ENABLE_ENTITY)


The best games are the games you create yourself.
Re: Touch entity. [Re: NL_3DGS_n00b] #176916
01/08/08 07:49
01/08/08 07:49
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Maybe reset the bounding box of each entity
with c_setminmax(my).

I think ENABLE_IMPACT in gun_act should work.

Re: Touch entity. [Re: vlau] #176917
01/08/08 09:32
01/08/08 09:32
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
So I have to put

c_setminmax(my);

In each action? (2 entities, 2 actions)
Thank you for your reply, I will test it when I'm home.


The best games are the games you create yourself.
Re: Touch entity. [Re: NL_3DGS_n00b] #176918
01/08/08 18:28
01/08/08 18:28
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
Thank you, now I can finally touch the gun.
My following problem, when I touch the gun, I get this error:

Crash in speler_act

What can be the problem in my player action...

Code:
PROBLEM SOLVED!



------------------------

Another question I have for moments, hoe can I make a entity to stay on screen all te time?
I have this now:

Code:
action fire_weapon(){ 
weap_uzi.pan = -80;
weap_uzi.tilt = -5;
while(1){
weap_uzi.x = camera.x + 75;
weap_uzi.y = camera.y + 175;
weap_uzi.z = camera.z - 40;
wait(1);
}
}



But when the PAN of the camera changes, the camera stays its place, it only moves along the camera.

Last edited by NL_3DGS_n00b; 01/08/08 18:39.

The best games are the games you create yourself.
Re: Touch entity. [Re: NL_3DGS_n00b] #176919
01/08/08 19:26
01/08/08 19:26
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Quote:


hoe can I make a entity to stay on screen all te time?





Normally, most people use view entity.

I'm not sure how can you see your entity with the above
code, anyway, you can try the following codes :


Code:

VECTOR temp1;
action fire_weapon()
{
weap_uzi.pan = -80;
weap_uzi.tilt = -5;
while(1)
{
weap_uzi.x = camera.x + 75;
weap_uzi.y = camera.y + 175;
weap_uzi.z = camera.z - 40;

vec_diff(temp1,weap_uzi.x,camera.x);
vec_set(weap_uzi.x,temp1.x);
vec_rotate(weap_uzi.x,camera.pan);
vec_add(weap_uzi.x,camera.x);
weap_uzi.pan = camera.pan - 80;
weap_uzi.tilt = camera.tilt - 5;

wait(1);
}
}



Re: Touch entity. [Re: vlau] #176920
01/08/08 20:07
01/08/08 20:07
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
Code:
I'm not sure how can you see your entity with the above


I used ent_create to make a enemy, en placed it's positions so that it will be floating the same directions as the player, so it will be in front of the player all the time.
fire_weapon is attached to the ent_create command.

I wil test your script.


The best games are the games you create yourself.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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