Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 1,151 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
little problem #285670
08/19/09 15:45
08/19/09 15:45
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

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? wink

Last edited by mEnTaL; 08/19/09 15:48.
Re: little problem [Re: mEnTaL] #285677
08/19/09 16:29
08/19/09 16:29
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
use EVENT_ENTITY and EVENT_BLOCK instead laugh

Re: little problem [Re: Claus_N] #285686
08/19/09 17:13
08/19/09 17:13
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

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 frown I know I am noob with 3dgs grin )

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 Offline
Serious User
MMike  Offline
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
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

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 frown I can't find where is the mistake

Re: little problem [Re: mEnTaL] #285758
08/19/09 21:59
08/19/09 21:59
Joined: Jul 2009
Posts: 16
E
episch Offline
Newbie
episch  Offline
Newbie
E

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.

Re: little problem [Re: episch] #285759
08/19/09 22:05
08/19/09 22:05
Joined: Jul 2009
Posts: 16
E
episch Offline
Newbie
episch  Offline
Newbie
E

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:

Code:
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
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
Originally Posted By: episch
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 frown


your second way works, but EVENT_BLOCK is for block primitives only.
My walls are models (Entities)

Re: little problem [Re: episch] #285763
08/19/09 22:43
08/19/09 22:43
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
i just dont understand why the bullet is action bullet and not function bullet?
since this bullet is runtime created it should be function..
on the ent_create process pass the function bullet right.

Also making that while loop, and then the event removing the entity while in the while loop will certain crash!! no? i think it should be

while(me) and not while (1);

Re: little problem [Re: MMike] #285765
08/19/09 23:35
08/19/09 23:35
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
it's ok now, but I can't understand only ome thing: why the bullet gets destroyed when it is created. It seems that it detects the player and the gun entities, but they have Flag2 set, and the c_scan functions has IGNORE_FLAG2, I added and IGNORE_ME and the same thing happens.

Page 1 of 2 1 2

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