2 registered members (AndrewAMD, SBGuy),
987
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Something ...> copy and paste ? <
#473541
07/20/18 17:26
07/20/18 17:26
|
Joined: Jun 2018
Posts: 29
bbn1982
OP
Newbie
|
OP
Newbie
Joined: Jun 2018
Posts: 29
|
// Shootable entity & weapon + more ///////
STRING map001map = <map001.wmb>; // filename 4 map
SOUND weap001snd = <shot4.wav>; // Sound when shoots
SOUND robdie = <aaahh.wav>; // Sound when dying SOUND robhit = <metalhit.wav>; // Sound when hitted
define digit_font,"digfont.pcx";
var ent001health;
function main() { level_load (map001map); // load level gun001(); // trigger gun }
function gun_muzzle() // what will happen to the gun_muzzle { wait(30); // Wait 30 frames ent_remove(me); // And remove it }
function gun001() // a gun ... { while(1) // shall happen forever { if(mouse_left == 1)||(key_ctrl == 1) // If pressing mouse left or ctrl { vec_set(temp,camera.x); // copy 2 camera temp.x = 30000; // What to copy , to the camera position ... vec_rotate(temp,camera.pan); // Rotate with camera's pan trace(camera.x,temp); // Trace forward (30000) trace_mode = ignore_sprites + ignore_passable + activate_shoot; // What shall be brought up (in trace) ent_create("particle.pcx",target,gun_muzzle);// Create a particle (bitmap) at position where trace ray hit and add the function > gun_muzzle < to it snd_play(weap001snd,100,1);// weapon sound wait(30); // Time between shots ... } wait(1); // Wait 1 frame } }
function change_d() { if(event_type == event_block)||(event_type == event_entity){my.pan = random(360);} // When hit wall or entity , rotate in a random vaue ... if(event_type == event_shoot){my.skill5 -=1;snd_play(robhit,100,0);} // If shooted at decrease health with 1 } }
PANEL digits_pan () { pos_x = 4; pos_y = 4; digits(18,20,4,digit_font,1,ent001health); //digits(18,40,4,digit_font,1,kulsprute_ammo); //digits(18,60,4,digit_font,1,shotgun_ammo); //digits(18,80,4,digit_font,1,enemkills); //digits(18,100,3,digit_font,1,shotgun_ammo); //digits(18,120,3,digit_font,1,scan_mode); //digits(60,0,4,digit_font,1,player._speed); //digits(120,0,4,digit_font,1,my_height); flags = SHOW; }
action ent001 { my.fat = on; // big bounding box my.enable_block = on; my.enable_entity = on ; my.enable_shoot = on; my.event = change_d; // Make entity sensible 4 blocks and other entities & make it shootable my.skill5 = 13;// health while(my.skill5 > -1) // while health is higher then 0 { ent001health = my.skill5; my.skill1+=0.3; ent_cycle("walk",my.skill1); // animate entity my.skill2 = 0.3; move_mode = ignore_me + ignore_passable + ignore_sprites; ent_move(my.skill2,nullvector);// & move it wait(1); // wait 1 frame } my.skill1 = 0;// restore animation while(my.skill1 < 100) // if the animation cycle lower then 100 { my.skill1+=1; // increased it ent_frame("death",my.skill1);// play death animation
wait(1); } my.passable = on; snd_play(robdie,100,1); waitt(30); ent_remove (me); }
action look_at_camera // attach to entity , which shall look at , camera ...script much be attach to , level , every time , it is changed (action is added to script)... in WED , that is ... { while(1) // while this happens , the loop , shall run ... 1 frame that is { var lookatcam[3]; // Where to look lookatcam.x = camera.x - my.x; // x position lookatcam.y = camera.y - my.y; // Y position lookatcam.z = 0; // z position //lookatcam.z = camera.z - my.z; vec_to_angle(my.pan,lookatcam); // turn towards camera ... wait(1); } }
// Have it good!
//B
Last edited by bbn1982; 07/20/18 20:51.
|
|
|
Re: Something ...> copy and paste ? <
[Re: bbn1982]
#473544
07/20/18 20:47
07/20/18 20:47
|
Joined: Jun 2018
Posts: 29
bbn1982
OP
Newbie
|
OP
Newbie
Joined: Jun 2018
Posts: 29
|
// Updated code ...
// Shootable entity & weapon + more ///////
STRING map001map = <map001.wmb>; // filename 4 map
SOUND weap001snd = <shot4.wav>; // Sound when shoots
SOUND robdie = <aaahh.wav>; // Sound when shoots SOUND robhit = <metalhit.wav>; // Sound when shoots
define digit_font,"digfont.pcx";
var ent001health;
function main() { level_load (map001map); // load level gun001(); // trigger gun }
function gun_muzzle() // what will happen to the gun_muzzle { wait(30); // Wait 30 frames ent_remove(me); // And remove it }
function gun001() // a gun ... { while(1) // shall happen forever { if(mouse_left == 1)||(key_ctrl == 1) // If pressing mouse left or ctrl { vec_set(temp,camera.x); // copy 2 camera temp.x = 30000; // What to copy , to the camera position ... vec_rotate(temp,camera.pan); // Rotate with camera's pan trace(camera.x,temp); // Trace forward (30000) trace_mode = ignore_sprites + ignore_passable + activate_shoot; // What shall be brought up (in trace) ent_create("particle.pcx",target,gun_muzzle);// Create a particle (bitmap) at position where trace ray hit and add the function > gun_muzzle < to it snd_play(weap001snd,100,1);// weapon sound wait(30); // Time between shots ... } wait(1); // Wait 1 frame } }
function change_d() { if(event_type == event_block)||(event_type == event_entity){my.pan = random(360);} // When hit wall or entity , rotate in a random vaue ... if(event_type == event_shoot){my.skill5 -=1;snd_play(robhit,100,0);} // If shooted at decrease health with 1 } }
PANEL digits_pan () { pos_x = 4; pos_y = 4; digits(18,20,4,digit_font,1,ent001health); //digits(18,40,4,digit_font,1,kulsprute_ammo); //digits(18,60,4,digit_font,1,shotgun_ammo); //digits(18,80,4,digit_font,1,enemkills); //digits(18,100,3,digit_font,1,shotgun_ammo); //digits(18,120,3,digit_font,1,scan_mode); //digits(60,0,4,digit_font,1,player._speed); //digits(120,0,4,digit_font,1,my_height); flags = SHOW; }
action ent001 { my.fat = on; // big bounding box my.enable_block = on; my.enable_entity = on ; my.enable_shoot = on; my.event = change_d; // Make entity sensible 4 blocks and other entities & make it shootable my.skill5 = 13;// health while(my.skill5 > -1) // while health is higher then 0 { ent001health = my.skill5; my.skill1+=0.3; ent_cycle("walk",my.skill1); // animate entity my.skill2 = 0.3; move_mode = ignore_me + ignore_passable + ignore_sprites; ent_move(my.skill2,nullvector);// & move it wait(1); // wait 1 frame } my.skill1 = 0;// restore animation while(my.skill1 < 100) // if the animation cycle lower then 100 { my.skill1+=1; // increased it ent_frame("death",my.skill1);// play death animation
wait(1); } my.passable = on; snd_play(robdie,100,1); waitt(30); ent_remove (me); }
action look_at_camera // attach to entity , which shall look at , camera ...script much be attach to , level , every time , it is changed (action is added to script)... in WED , that is ... { while(1) // while this happens , the loop , shall run ... 1 frame that is { var lookatcam[3]; // Where to look lookatcam.x = camera.x - my.x; // x position lookatcam.y = camera.y - my.y; // Y position lookatcam.z = 0; // z position //lookatcam.z = camera.z - my.z; vec_to_angle(my.pan,lookatcam); // turn towards camera ... wait(1); } }
// Have it good!
//B
|
|
|
|