Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (juanex, AndrewAMD), 988 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
ent_remove help. #297679
11/09/09 09:32
11/09/09 09:32
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
I am currently having a problem with my shooting script. I have looked everywhere and spent the last 3 hours searching the manual but I still couldn't find anything that could help me. For some reason my code doesn't remove the bullet whenever it collides with level geometry. I currently have the passable flag set on which I believe to be the problem. However, I NEED the flag to be on for my game to function properly. So I am asking if there is anything that I can use in a statement to test for block collision? I am not very good at explaining what I mean, so here is an example.

Code:
while(vec_dist(my.x,block) > 20)
{
c_move(me, vector(0,60*time,0), nullvector,IGNORE_FLAG2+USE_AABB);
	wait(1);
}
	ent_remove(me);
	snd_play(bullet_hit,100,0);
}



Notice how in the "while(vec_dist(my.x,block)" statement, I used the word block to represent level geometry. Something like this would be most useful and I am sure 3DGS has this feature. I just cant find it.

Re: ent_remove help. [Re: exile] #297683
11/09/09 10:00
11/09/09 10:00
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
you can test for hitting blocks several ways...
through events (EVENT_BLOCK) or through the return type of a c_trace (then do a tex_name, combined with hit).

look that up in the manual, should get you started laugh

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: ent_remove help. [Re: Helghast] #297750
11/09/09 16:05
11/09/09 16:05
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Im not sure if this will work, but give it a try...
Code:
...
	var dist=0;
	while(1)
	{
		dist = c_move(me, vector(0,60*time,0), nullvector,IGNORE_ME+IGNORE_FLAG2+USE_AABB);
		if((dist!=0)&&(you==NULL))  {  break;  }
		wait(1);
	}
	ent_remove(me);
	snd_play(bullet_hit,100,0);
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: ent_remove help. [Re: EvilSOB] #298007
11/11/09 10:17
11/11/09 10:17
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
Thanks for the help guys. All of your suggestions work as expected. However, my problem still exists. You see, I need the bullet entity to be passable in which EVENT_BLOCK/ENTITY and EvilSOB's suggestions wont work. Whenever the bullet if fired with the passable flag on, the bullet gets stuck in my player model. is there any way to do with with the passable flag on?

Re: ent_remove help. [Re: exile] #298217
11/12/09 23:05
11/12/09 23:05
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
anyone?

Re: ent_remove help. [Re: exile] #298310
11/13/09 19:24
11/13/09 19:24
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
OK, so I solved my main issue but now I have another one. When my bullets get fired they collide with the player model and get destroyed. Is there any way I can make it so that my bullet entities DONT collide with the player? I am assuming I need to use c_scan/trace or something. I wish there was an easier way to do this. I mean, we have the "IGNORE_FLAG2" modifier, so why not an "ONLY_FLAG2" one?

Re: ent_remove help. [Re: exile] #298313
11/13/09 19:29
11/13/09 19:29
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
first: you = player;
than, in the c_move: c_move(...,...,..., ...|IGNORE_YOU);

hope this helps laugh

Re: ent_remove help. [Re: exile] #298314
11/13/09 19:32
11/13/09 19:32
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
try to create the bullet in front of the weapon and the player so that the collision hulls don't overlap.
Using this way you avoid the problem that the bullet hits the player.

muffel

Re: ent_remove help. [Re: muffel] #298323
11/13/09 20:33
11/13/09 20:33
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
I have already tried that. Because my player models box is rather large I have to create the bullet model so far out that it looks rather strange. Thanks though laugh

EDIT: Oh and Rei, sadly I currently have the "you" pointer being taken by... you = ent_create("mgun.mdl",my.x,gun_attach);. So I put, "you = player;" in my bullet code. Sadly, my character STILL picks it up.
To make this a bit easier, i'll post my gun code.
Code:
function pistolbullet()
{
	you = player;
my.ENABLE_BLOCK = ON;
my.ENABLE_ENTITY = on;
my.event = collisionhit;
my.passable = off;
my.pan = player.pan + 270;
my.tilt = player.tilt;
my.ambient = 100;
	while (1){
c_move(me, vector(0,60*time,0), nullvector,IGNORE_FLAG2+IGNORE_CONTENT+ignore_passable+IGNORE_ME+IGNORE_SPRITES+IGNORE_YOU);
wait (1);
}
}



Last edited by exile; 11/13/09 22:49.
Re: ent_remove help. [Re: exile] #298467
11/15/09 11:31
11/15/09 11:31
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Rei's suggestion with 'you = player' and 'IGNORE_YOU' is the common way to avoid collision with the origin of the bullet.

But, if this doesn't work, you could try this:
You could create the bullet at a vertex at the gun's end with vec_for_vertex.
Then you could reduce the collision box of the player with max_x, min_x, max_y, min_y, that the gun's end is out side that collision box, and the bullet is created outside.
You can see the size of the box when hitting F11 twice.

About "you = player" and "you = ent_create":
you and me are pointers that are relatively to an entity's function, this means that the 'you' within the function of the player points at a different entity than the 'you' within the bullet's function.

Page 1 of 2 1 2

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

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