2 registered members (TipmyPip, AndrewAMD),
1,151
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
little problem
#285670
08/19/09 15:45
08/19/09 15:45
|
Joined: Jul 2009
Posts: 96
mEnTaL
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2009
Posts: 96
|
I have a bullet and a wall. I want when the bullet hit the wall to destroy itself. I tried with EVENT_IMPACT but it detects only moving entities, so the bullet doesn't detect the wall -.-' it's important that the event must be attached to the bullet, not to the wall. Any suggestions?
Last edited by mEnTaL; 08/19/09 15:48.
|
|
|
Re: little problem
[Re: Claus_N]
#285686
08/19/09 17:13
08/19/09 17:13
|
Joined: Jul 2009
Posts: 96
mEnTaL
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2009
Posts: 96
|
How to make the bullet destroy itself when its speed=0 ? (because I didn't manage to make it by EVENT_ENTITY I know I am noob with 3dgs )
Last edited by mEnTaL; 08/19/09 17:21.
|
|
|
Re: little problem
[Re: mEnTaL]
#285691
08/19/09 17:43
08/19/09 17:43
|
Joined: Jul 2004
Posts: 1,710
MMike
Serious User
|
Serious User
Joined: Jul 2004
Posts: 1,710
|
why newbies, instead of learning the basic concept of functions and logic, do want to code more if they dont know how to think. but im afraid this is a IQ gap or something , because that answer is basic logic i think. but well. you measure the point where the bullet is emitted. and while(no impact event)..
wait 1, and calculate the initial bullet position, to the current position. also, add movement, with c_scan or anything depends on what you want to do.
After the impact the while loop is break, so you know its zero, then explode or remove.. or you use the calculation speed formula.. s="delta"positions/"delta" time. and if zero, trigger removal. with ent_remove i think.
good luck.
Last edited by MMike; 08/19/09 19:09.
|
|
|
Re: little problem
[Re: MMike]
#285756
08/19/09 21:45
08/19/09 21:45
|
Joined: Jul 2009
Posts: 96
mEnTaL
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2009
Posts: 96
|
action bullet() { ............. while(1) { c_move(me,vector(40,0,0),nullvector,USE_BOX|IGNORE_MODELS); c_scan(me.x,360,vector(360,0,200),SCAN_ENTS|IGNORE_FLAG2); if (result<5) {ent_remove(me);} wait(1); } } and the engine crashes I can't find where is the mistake
|
|
|
Re: little problem
[Re: episch]
#285759
08/19/09 22:05
08/19/09 22:05
|
Joined: Jul 2009
Posts: 16
episch
Newbie
|
Newbie
Joined: Jul 2009
Posts: 16
|
c_scan(me.x,my.pan,360,vector(360,0,200),SCAN_ENTS|IGNORE_FLAG2); the my.pan in the c_sacn was the mistake. but you do a realy complicatet way. i made this much easier. try this witch EVENT_BLOCK for the wall the wen the event is trigerd make the bullet INVISIBLE and remove the bullet. like this:
function wall(){
set(my,INVISIBLE);
set(my,PASSABLE);
wait(4);
ent_remove(me);
}
action bullet(){
my.push = 10;
my.emask |= (EVENT_BLOCK|EVENT_IMPACT|EVENT_ENTITY);
my.event = wall;
while(1){
c_move(my,vector(20,0,0),nullvector,GLIDE,IGNORE_FLAG2);
wait(1);
}}
the EVENT_IMPACT trigger only by entitys with lower push the same with the EVENT_ENTITY. i hope i can help you with this. greets episch
Last edited by episch; 08/19/09 22:06.
|
|
|
Re: little problem
[Re: episch]
#285762
08/19/09 22:41
08/19/09 22:41
|
Joined: Jul 2009
Posts: 96
mEnTaL
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2009
Posts: 96
|
c_scan(me.x,my.pan,vector(360,0,200),SCAN_ENTS|IGNORE_FLAG2);
the my.pan in the c_sacn was the mistake. actulay my.pan is not the mistake, it crashes again your second way works, but EVENT_BLOCK is for block primitives only. My walls are models (Entities)
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|