|
|
Re: bullet holes
[Re: Grimber]
#74996
05/31/06 14:05
05/31/06 14:05
|
Joined: Apr 2006
Posts: 265
vartan_s
OP
Member
|
OP
Member
Joined: Apr 2006
Posts: 265
|
great... although my bullet holes are still going wrong...
Here's my code:
action shoot_bullet() { bullet = me; my.invisible = on; my.push = push_factor_change; if (push_factor_change == -weapon_in_play_pellets) { push_factor_change = 0; } my.enable_block = on; my.skill4 = weapon_in_play_damage; my.skill5 = weapon_in_play_bullet_speed; randomize(); my.pan = camera.pan + random(weapon_in_play_acc_change) - random(weapon_in_play_acc_change); my.tilt = camera.tilt + random(weapon_in_play_acc_change) - random(weapon_in_play_acc_change); my.event = remove_bullet; while (my.flag1 != 1) { move_mode = ignore_you + ignore_passable + ignore_me; c_move(my,my.skill5,nullvector,move_mode); if (my.flag8 == 1) { my.passable = on; ent_create(bullethole_pcx,my.x,bullet_hole); my.flag1 = 1; } wait(1); } ent_remove(me); }
function bullet_hole() { my.passable = on; // because at the time this entity is created YOU pointer will point back to the bullet entity so we can sue that to grab our movment vector IF we do it right away vec_set(my.skill5,YOU.skill5); // the movment direction vector backed up
vec_normalize(my.skill5,10); // here i just increased the length of teh vector *10 //now I just do the trace my.skill10 = c_trace(my.x,my.skill5,IGNORE_ME+IGNORE_YOU); // the ignore you is important too. else your still existing bullet entity will stop the trace soon as it starts. if(my.skill10 >0) // trace hit something { my.oriented = on; // look up these to line sin manual if you don't know them my.facing = off; vec_set(my.x,TARGET); vec_to_angle(my.pan,normal); wait(2000); ent_remove(me); } else // no surface to attach to so remove me from the world { remove(me); }
A short explanation... The acc_change is basically the accuracy of the weapon, which I can change based on movement or length being fired or even depepnding on the weapon.
The weapon in play push factor thing changes the push of the bullet accordingly, to allow me to create more than one pellet without having them collide with each other.
In the remove_bullet function, I've made it exactly like you told me to... it makes flag 8 = 1.
It would be really good if you could fix this. Thanks.
Last edited by vartan_s; 05/31/06 14:06.
|
|
|
Re: bullet holes
[Re: Grimber]
#75000
06/06/06 13:57
06/06/06 13:57
|
Joined: Apr 2006
Posts: 265
vartan_s
OP
Member
|
OP
Member
Joined: Apr 2006
Posts: 265
|
remove_bullet code: Code:
function remove_bullet() { my.enable_entity = off; my.enable_block = off; my.flag8 = 1; } I think the problem is in the angle of the vector my.skill5, but I'm not sure. The code you gave me doesn't seem to work... are you sure it's right? On some walls the bullet holes work well, on others they appear on an adjacent wall, and on some, its a mixture of correct and adjacent. Any ideas?
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|