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

A WDL-SCRIPT (a weapon) (text must be in a WDL-FILE) > name.wdl < ...

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


SOUND fire_weapon = "shot8.wav"; /*weapon shoot sound , must be in same folder as script*/

var ammo = 100; /* amount of bullets (decrease when shooting */

PANEL cross001 /* the aim*/
{
pos_x = 960; /* x position of aim (on screen)*/
pos_y = 530; /* y position of aim (on screen*/
bmap = "cross.pcx"; /* bitmap to use (must be in same folder , as script*/
flags = SHOW | OVERLAY; /*show immidiately and hide black surfaces*/
}

function gun() /* the weapon , include it in MAIN FUNCTION "gun()"; to trigger the gun */
{
while(ammo > 0) /* while ammo is higher then 0 */
{
if(key_ctrl == 1)||(mouse_left == 1) /*if those are pressed*/
{
ammo-=1; /*decrease ammo*/
vec_set(temp,camera.x); /* copy temp (how long the bullet goes) to camera.x*/
temp.x = 1000000; /*distance to trace (how long the bullet goes)*/
vec_rotate(temp,camera.pan); /*rotate , the trace distance (how long the bullet goes) (with the cameras pan value)*/
trace_mode = ignore_me + ignore_passable + activate_shoot; /* ignore that , and make entitis with "my.enable_shoot = on" sensitive , to being shoot at*/
trace(camera.x,temp); /* shoot 10000000 forward*/
snd_play(fire_weapon,100,1);/* play this sound when shooting (must be in the same folder as script)*/
wait(3); /* wait this before shooting again (pushing MOUSE_LEFT or CTRL)*/
}
wait(1);
}
}



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

Needed something to do ..

/B