Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Ayumi, NewbieZorro, TipmyPip), 13,887 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
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 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
sure ,here it is (thanks for helping me,guys laugh ) :
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: MikeS] #303314
12/27/09 23:48
12/27/09 23:48
Joined: Dec 2009
Posts: 74
Romania,Bucharest
Ted22 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
i tried to use bullet.pan = guard.pan; but when i press click
it shuts down the program...... frown

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 Offline
Member
MikeS  Offline
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 Offline
Member
MikeS  Offline
Member

Joined: Mar 2007
Posts: 112
Originally Posted By: Ted22
i tried to use bullet.pan = guard.pan; but when i press click
it shuts down the program...... frown


ä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 Offline OP
Junior Member
Ted22  Offline 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 Offline OP
Junior Member
Ted22  Offline 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.
Re: My bullets don't go to the middle of the crosshair.Look -> [Re: Ted22] #303343
12/28/09 11:35
12/28/09 11:35
Joined: Dec 2009
Posts: 74
Romania,Bucharest
Ted22 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
as i mouse_spot.x = bmap_width(crosshair_pcx)*2; insteed of mouse_spot.x = bmap_width(crosshair_pcx)/2; it looks like my bullets move farrer so it works but if i do the same thing with the height doesent :((

Re: My bullets don't go to the middle of the crosshair.Look -> [Re: Ted22] #303346
12/28/09 11:41
12/28/09 11:41
Joined: Dec 2009
Posts: 74
Romania,Bucharest
Ted22 Offline OP
Junior Member
Ted22  Offline OP
Junior Member

Joined: Dec 2009
Posts: 74
Romania,Bucharest
oh yes it works!IT WORKS!!!!!!!YEAAAAAAA IT WORKS THANKS!!!THANKSS!!!THANKS!!!THANKS!!!THANKS!!!THANKS!!!THANKS!!!THANKS!!!I don't know why it didn't worked with / so i used
mouse_spot.x = bmap_width(crosshair_pcx)- 40; // hot spot in the bmap center
mouse_spot.y = bmap_height(crosshair_pcx)- 80;
oh but it works thanks alot! :)) :))

Page 2 of 2 1 2

Moderated by  HeelX, rvL_eXile 

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