Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, dr_panther), 834 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Gun script ... #483912
08/14/21 00:28
08/14/21 00:28
Joined: Jun 2018
Posts: 29
B
bbn1982 Offline OP
Newbie
bbn1982  Offline OP
Newbie
B

Joined: Jun 2018
Posts: 29



// A GUN //////////////////////////////////////////////////////////////////

var shotgun_shells = 8; // amount of bullets

SOUND fire_first_gun = "SHOT8.WAV"; // must be in folder were this script is , change this if another sound ...

function muzzle_remove()
{
my.passable = on; my.transparent =on; // made it passable (shit from gun) and transparent ...
waitt(8); ent_remove (me); Remove bitmap after 8 frames
}

function shoot() // include this function in main function ... > shoot(); <
{
while(shotgun_shells > 0) // while the shotgun shells is higher then 0 ..
{
if(key_ctrl == 1)||(mouse_left == 1){shotgun_shells-=1;snd_play(fire_first_gun,100,0);vec_set(temp,camera.x);temp.x = 100000;vec_rotate( temp,camera.pan); trace_mode == ignore_me+ignore_sprites+activate_shoot; trace_mode = 1; trace(camera.x,temp);ent_create("muzzle1.tga", target,muzzle_remove); waitt(3);} // > muzzle1.tga < must be in the same folders script ...
wait(1);
}
}

//////////////////////////////////////////////////////////////////////////////

Hope it works!

/B

Re: Gun script ... [Re: bbn1982] #483913
08/14/21 00:54
08/14/21 00:54
Joined: Jun 2018
Posts: 29
B
bbn1982 Offline OP
Newbie
bbn1982  Offline OP
Newbie
B

Joined: Jun 2018
Posts: 29

UPDATED:

// A GUN //////////////////////////////////////////////////////////////////

PANEL cross_hair
{
bmap = "cross.pcx"; // must be in same folder as script ...
pos_x= 400; pos_y= 290; // where shall the cross be ... on screen ..
flags = SHOW | OVERLAY; // show it and remove black parts
}

var shotgun_shells = 8; // amount of bullets

SOUND fire_first_gun = "SHOT8.WAV"; // must be in folder were this script is , change this if another sound ...

function muzzle_remove() // function for muzzle shit ...
{
my.passable = on; // make it passable
my.transparent = on; // make it transparent.
wait(8); // wait 8 frames
ent_remove (me); Remove bitmap after 8 frames
}

function shoot() // include this function in main function ... > shoot(); <
{
while(shotgun_shells > 0) // while the shotgun shells is higher then 0 ..
{
if(key_ctrl == 1)||(mouse_left == 1) // if pressing mouse left or ctrl
{
shotgun_shells-=1; // decrease ammo
snd_play(fire_first_gun,100,0); // play a sound
vec_set(temp,camera.x);// copy camera.x to temp
temp.x = 100000; // 100000 forward
vec_rotate( temp,camera.pan); // rotate temp (1000000) with the camera .pan
trace_mode == ignore_me+ignore_sprites+activate_shoot; // ignore me entity ignore sprites och activate shoot
trace_mode = 1;
trace(camera.x,temp); // trace 100000 forward
ent_create("muzzle1.tga", target,muzzle_remove); // "muzzle1.tga" must be in the same folders script ...
wait(8); // wait 8 frames
}
wait(1);
}
}

Hope it works!

/B

////////////////////////////////////////////////////////////////////////

Re: Gun script ... [Re: bbn1982] #483914
08/14/21 00:55
08/14/21 00:55
Joined: Jun 2018
Posts: 29
B
bbn1982 Offline OP
Newbie
bbn1982  Offline OP
Newbie
B

Joined: Jun 2018
Posts: 29
\_ *1000!

/B


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