Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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 (Ayumi, 1 invisible), 584 guests, and 1 spider.
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 2 of 2 1 2
Re: little problem [Re: mEnTaL] #285801
08/20/09 09:06
08/20/09 09:06
Joined: Jul 2009
Posts: 16
E
episch Offline
Newbie
episch  Offline
Newbie
E

Joined: Jul 2009
Posts: 16
so you mus spawn the bullet a litter front the gun with vec_vor vertex.
so open you gun model in MED look witch vertex are at the front of the gun
example = put this in the action for the gun :
vec_for_vertex(temp,my,xx) xx is the vertex from the gun
temp.x +=5;
ent_create("bullet.mdl",temp,bullet);

and set the FLAG2 tag to the gun and the player

Re: little problem [Re: episch] #285813
08/20/09 10:44
08/20/09 10:44
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
i know that, my bullet is created this way, but it doesn't help.

Re: little problem [Re: mEnTaL] #285822
08/20/09 11:49
08/20/09 11:49
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
try this:
right on the first line of wall function:

if(is(you,FLAG2)==1){return;}

by the way your gun, and player, must have set(my,FLAG2); to work


Last edited by MMike; 08/20/09 11:53.
Re: little problem [Re: MMike] #285832
08/20/09 14:06
08/20/09 14:06
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
function bullet()
{
.........

while(me)
{
c_move(me,vector(40,0,0),nullvector,USE_BOX|IGNORE_MODELS);
c_scan(me.x,me.pan,vector(360,0,200),SCAN_ENTS|IGNORE_FLAG2|IGNORE_ME);
if (result<5)
{
if(is(you,FLAG2)==1){return;}
ent_remove(me);
}
wait(1);
}
}

and also the player and the gun have Flag2 set, but the engine crashes. Can you correct it if you find mistake in the code pls

Re: little problem [Re: mEnTaL] #285837
08/20/09 14:45
08/20/09 14:45
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
You probably have to assure that the 'you' isn't empty.

Other suggestions:
- you could start the scan a few moments later, when the bullet already left the gun.
- Did you try IGNORE_YOU? Although, it has to reset after leaving the gun.
- you could scan from a position ahead the bullet:
vec_for_angle(temp, my.pan);//Get a 'direction' from the angle
//Now, when the position is one quant ahead the bullet, scale the vector/direction to get the position a few quants more ahead, let's say 10:
vec_scale(temp, 10);

Re: little problem [Re: Pappenheimer] #285844
08/20/09 16:23
08/20/09 16:23
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
I tried all the suggestions:
I made check if(you!=NULL) to do the rest
I made the bullet start the scanning 10 frames after it's created
I put IGNORE_YOU
i made the bullet scan 10 quants ahead it
but maybe I miss something or do something wrong cuz the engine crashes again.
Can you post here the shortest and fastest code for moving entity which destroys itself when hit static entity. Thx laugh

Re: little problem [Re: mEnTaL] #285864
08/20/09 20:04
08/20/09 20:04
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
well the crash.. is wird.. give us the acklog, maybe thats better, to check the error.. and where is the actual crash, are sure its from those functions or are others?

Also.after the bullet is created you must put an wait(1); after..

Re: little problem [Re: MMike] #286087
08/22/09 22:58
08/22/09 22:58
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
I use this collision code:

function remove_bullets();

function bullet()
{
my.emask|=ENABLE_IMPACT;
my.emask|=ENABLE_ENTITY;
my.emask|=ENABLE_BLOCK;
my.event = remove_bullets;
while(1)
{
c_move(me,vector(40,0,0),nullvector,USE_BOX|IGNORE_MODELS);
wait(1);
}
}

function remove_bullets() // this function runs when the bullet collides with something
{
wait (1); // wait a frame to be sure (don't trigger engine warnings)
ent_remove (my); // and then remove the bullet
}

The collision detection definitely works, but can you just tell me how to make the bullet don't detect the gun and the player models in this case

Page 2 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