3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: My bullets don't go to the middle of the crosshair.Look ->
[Re: MikeS]
#303311
12/27/09 23:40
12/27/09 23:40
|
Joined: Dec 2009
Posts: 74 Romania,Bucharest
Ted22
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2009
Posts: 74
Romania,Bucharest
|
sure ,here it is (thanks for helping me,guys  ) : function move_bullets() { VECTOR bullet_speed; my.emask = ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK; my.event = remove_bullets; my.pan = guard.pan; my.tilt = guard.tilt; bullet_speed.x = 35 * time_step; bullet_speed.y = 0; bullet_speed.z = 0; while (my) { c_move (my, bullet_speed, nullvector, IGNORE_PASSABLE | IGNORE_YOU); wait (1); } } and in fire_bullets if i remove vec_to_angle(guard.pan,mouse_dir3d); my bullets will go somehow random
|
|
|
Re: My bullets don't go to the middle of the crosshair.Look ->
[Re: Ted22]
#303318
12/28/09 00:13
12/28/09 00:13
|
Joined: Mar 2007
Posts: 112
MikeS
Member
|
Member
Joined: Mar 2007
Posts: 112
|
VECTOR temp;
function fire_bullets()
{ VECTOR bullet_pos;
mouse_spot.x = bmap_width(arrow_pcx)/2; // hot spot in the bmap center mouse_spot.y = bmap_height(arrow_pcx)/2; vec_to_angle(temp,mouse_dir3d); vec_for_vertex(bullet_pos, guard, 6); ent_create("bullet.mdl", bullet_pos, move_bullets);
//while(1) //{ //VECTOR temp; //temp.x = mouse_pos.x - bmap_width(crosshair_pcx)/2; //temp.y = mouse_pos.y - bmap_height(crosshair_pcx)/2; //temp.z = 5000; //vec_to_screen(temp, camera); //c_trace(guard.x, temp, 0); //vec_set(temp, target.x); //vec_sub(temp, guard.x); //vec_to_angle(guard.pan, temp); // vec_to_angle(guard.pan,mouse_dir3d); //wait(1);
//} }
and in move bullets use
my.pan =temp;
my.pan tilt and roll is set to vector temp
|
|
|
Re: My bullets don't go to the middle of the crosshair.Look ->
[Re: Ted22]
#303319
12/28/09 00:17
12/28/09 00:17
|
Joined: Mar 2007
Posts: 112
MikeS
Member
|
Member
Joined: Mar 2007
Posts: 112
|
i tried to use bullet.pan = guard.pan; but when i press click it shuts down the program...... ähm, i think you didnt define the bullet entity, thats why it shuts down. if you wanna try this, ENTITY* bullet; and in fire bullets bullet = ent_create........ then u should be able to say bullet.Pan = guard.pan but u did it right with the move bullet funktion, my.pan is in this case correct.
|
|
|
Re: My bullets don't go to the middle of the crosshair.Look ->
[Re: MikeS]
#303341
12/28/09 11:18
12/28/09 11:18
|
Joined: Dec 2009
Posts: 74 Romania,Bucharest
Ted22
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2009
Posts: 74
Romania,Bucharest
|
/////////////////////////////// #include <acknex.h> #include <default.c> ///////////////////////////////
var walk_percentage;//ignore this vars..they are for future actions var run_percentage; var walk_percentage2; var death_percentage; var stand_procentaj; var attack_procentaj; var front_offset = 30; var init_offset = 30; BMAP* crosshair_pcx = "crosshair.pcx"; ENTITY* guard; ENTITY* bullet; STRING* bullet_mdl = "bullet.mdl"; function fire_bullets(); function move_bullets(); function remove_bullets();
function main() { video_mode = 7; video_screen = 1; level_load ("mylvl.wmb"); mouse_mode=1; mouse_map = crosshair_pcx; wait (2); while (1) { mouse_pos.x = 400; mouse_pos.y = 300; camera.pan -= mouse_force.x; camera.tilt += mouse_force.y; wait (1); } }
function attach_weapon1()
{ guard = my; set(my, PASSABLE); while (1) { vec_set (my.x, vector (20, -10, 0)); vec_rotate (my.x, you.pan); vec_add (my.x, you.x); my.pan = you.pan; my.tilt = camera.tilt; wait (1); } }
action players_code()
{ player = my; ent_create ("guard.mdl", nullvector, attach_weapon1); while (1) { c_move (my, vector(10 * (key_w - key_s) * time_step, 6 * (key_a - key_d) * time_step, 0), nullvector, GLIDE); vec_set (camera.x, player.x); camera.z += 45; camera.pan -= 5 * mouse_force.x * time_step; camera.tilt += 3 * mouse_force.y * time_step; my.pan = camera.pan; set(guard,INVISIBLE); wait (1); } } function remove_bullets()
{ wait (1); ent_remove (my); }
function move_bullets()
{ VECTOR bullet_speed[3]; my.emask = ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK; my.event = remove_bullets; my.pan = guard.pan; my.tilt = guard.tilt; bullet_speed.x = 35 * time_step; bullet_speed.y = 0; bullet_speed.z = 0; while (my) { c_move (my, bullet_speed, nullvector, IGNORE_PASSABLE | IGNORE_YOU); wait (1); } }
VECTOR temp;
ENTITY* bullet;
function fire_bullets()
{ VECTOR bullet_pos;
mouse_spot.x = bmap_width(crosshair_pcx)/2; // hot spot in the bmap center mouse_spot.z = bmap_height(crosshair_pcx)/2; vec_to_angle(temp,mouse_dir3d); vec_for_vertex(bullet_pos, guard, 6); ent_create("bullet.mdl", bullet_pos, move_bullets);
while(1) { VECTOR temp; temp.x = mouse_pos.x - bmap_width(crosshair_pcx)/2; temp.y = mouse_pos.y - bmap_height(crosshair_pcx)/2; temp.z = 5000; vec_to_screen(temp, camera); c_trace(guard.x, temp, 0); vec_set(temp, target.x); vec_sub(temp, guard.x); vec_to_angle(guard.pan, temp); vec_to_angle(guard.pan,mouse_dir3d); wait(1);
} }
function bullets_startup()
{ on_mouse_left = fire_bullets; }
//Still doesen't works! :(( As i set my.pan =temp; it gives me "uncliered indentifier" P.S.:It is just an experimental script,so it may have some mistakes;
|
|
|
Re: My bullets don't go to the middle of the crosshair.Look ->
[Re: Ted22]
#303342
12/28/09 11:31
12/28/09 11:31
|
Joined: Dec 2009
Posts: 74 Romania,Bucharest
Ted22
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2009
Posts: 74
Romania,Bucharest
|
omg...so wierd...mouse_spot.x = bmap_width(crosshair_pcx)/2; // hot spot in the bmap center and temp.x = mouse_pos.x - bmap_width(crosshairr_pcx)/2; works but temp.y = mouse_pos.y - bmap_height(crosshairr_pcx)/2; and mouse_spot.y = bmap_height(crosshair_pcx)/2; doesent! :((
Last edited by Ted22; 12/28/09 11:38.
|
|
|
|