2 registered members (TipmyPip, 1 invisible),
18,731
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Touch entity.
#176911
01/07/08 16:46
01/07/08 16:46
|
Joined: Jul 2005
Posts: 262 Earth, The Netherlands
NL_3DGS_n00b
OP
Member
|
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: ello]
#176913
01/07/08 17:39
01/07/08 17:39
|
Joined: Jul 2005
Posts: 262 Earth, The Netherlands
NL_3DGS_n00b
OP
Member
|
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
flits
User
|
User
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
OP
Member
|
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: vlau]
#176917
01/08/08 09:32
01/08/08 09:32
|
Joined: Jul 2005
Posts: 262 Earth, The Netherlands
NL_3DGS_n00b
OP
Member
|
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
OP
Member
|
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_actWhat 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
vlau
Serious User
|
Serious User
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
OP
Member
|
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.
|
|
|
|