//---------------------------------------------------------------------- // FlakFire.scr v2.0 // By =|95th|=GenDonut // Credits: // bdbodger bdbodger@bodger-mods.com // SorridStroker // // |F |L /A\ |K |F |I| |R |E . S (C |R // // Usage: // Exec the flakfire.scr with an origin, an angle, and an amount of amno // // exec global/flakfire.scr ( ORIGIN ) ( ANGLE ) AMNO TAKE_DMG FLAKHEALTH // // eg. // Sample script for mohdm4 add the following line to dm/mohdm4.scr // ORIGIN ANGLE AMNO TAKE DMG flak health // exec global/flakfire.scr ( 18.8 2906.8 296.1 ) ( 0.0 270.2 0.0 ) 100 1 100 // // Description: // Go to the flak and press use to get on and use to get off. // Move around and fire. //--------------------------------------------------------------------- main local.origin local.angle local.amno local.destory local.health: local.random = randomint(9999) local.ent = spawn models/statweapons/flak88turret.tik local.ent.origin = local.origin local.ent.origin += ( 0 0 50 ) local.ent.angles = local.angle local.ent.shellamno = local.amno local.ent targetname ("flak_" + local.random) local.ent.save_amno = local.amno local.ent.destroyed_model = "models/statweapons/flak88_d.tik" local.ent.destroy_enabled = local.destroy local.ent.canhealth = local.health local.ent.base = spawn models/statweapons/flak88base.tik local.ent.base.origin = local.origin local.ent.base.angles = local.angle local.ent thread flak_initial local.ent.dmg_listener = spawn trigger_multipleall origin local.origin spawnflags 128 local.ent.dmg_listener setsize ( -200 -200 -50 ) ( 200 200 100 ) local.ent.dmg_listener setthread flak_pain local.ent.dmg_listener.flakcan = local.ent end flak_initial: local.master = spawn scriptmaster //Flak 88 gun local.master aliascache flak_snd_move sound/vehicle/veh_tank_turret1.wav soundparms 0.9 0.2 0.9 0.2 800 4000 auto loaded maps "dm obj" local.master aliascache flak_snd_fire1 sound/weapons/fire/TankCannonFire1.wav soundparms 1.5 0.0 1.0 0.0 2000 4000 weapon loaded maps "dm obj" local.master aliascache flak_snd_fire2 sound/weapons/fire/Flak88Fire1.wav soundparms 1.5 0.0 1.0 0.0 2000 4000 weapon loaded maps "dm obj" local.master aliascache flak_snd_fire3 sound/weapons/fire/Flak88Fire3.wav soundparms 1.5 0.0 1.0 0.0 2000 4000 weapon loaded maps "dm obj" local.master aliascache flak_snd_fire4 sound/weapons/fire/Flak88Fire4.wav soundparms 1.5 0.0 1.0 0.0 2000 4000 weapon loaded maps "dm obj" local.master aliascache flak88_fire1 sound/weapons/fire/TankCannonFire1.wav soundparms 1.5 0.0 1.0 0.0 2000 4000 weapon loaded maps "dm obj" local.master aliascache flak88_fire2 sound/weapons/fire/Flak88Fire1.wav soundparms 1.5 0.0 1.0 0.0 2000 4000 weapon loaded maps "dm obj" local.master aliascache flak88_fire3 sound/weapons/fire/Flak88Fire3.wav soundparms 1.5 0.0 1.0 0.0 2000 4000 weapon loaded maps "dm obj" local.master aliascache flak88_fire4 sound/weapons/fire/Flak88Fire4.wav soundparms 1.5 0.0 1.0 0.0 2000 4000 weapon loaded maps "dm obj" local.master aliascache flak_reload sound/weapons/fire/TankFire1.wav soundparms 1.5 0.0 1.0 0.0 2000 4000 auto loaded maps "dm obj" self dmprojectile models/projectiles/tigercannonshell.tik //self dmprojectile models/fx/dummy.tik local.trigger = spawn trigger_multiple origin self.origin local.trigger setsize ( -200 -200 -50 ) ( 200 200 100 ) local.trigger.target = self self.touchlisten = local.trigger while(1) { local.trigger waittill trigger local.trigger waitthread get_ready_to_fire } end //------------------------------------------------------------------- get_ready_to_fire: local.player = parm.other while(local.player istouching self.target && local.player.useheld == 1 && local.player.onflak != 1) { if(local.player.wasuse != 1) local.player.wasuse = 1 waitframe } if(local.player.onflak != 1 && local.player.wasuse == 1 && local.player istouching self.target && self.target.hasgunner != 1) { self.target waitthread player_getin local.player local.player.wasuse = 0 } end player_getin local.player: //local.player forcetorsostate FLAK_CONTROL_MAIN self.hasgunner = 1 //local.player holster local.player notsolid local.player hide local.player physics_off local.player.onflak = 1 self.gunner = local.player local.player.flakgun = self //local.player stufftext ("globalwidgetcommand dday1 title Cannon-Amno-" + self.shellamno) //local.player stufftext "globalwidgetcommand dday1 shader townhallwindow" //local.player stufftext "globalwidgetcommand dday1 fgcolor 1.00 1.00 1.00 1.00" //local.player stufftext "globalwidgetcommand dday1 bgcolor 0.50 0.50 0.50 0.00" //local.player stufftext "globalwidgetcommand dday1 fadein 0" //local.player stufftext "globalwidgetcommand dday1 menu dday1 640 480 NONE 0" //local.player stufftext "globalwidgetcommand dday1 virtualres 1" //local.player stufftext "globalwidgetcommand dday1 fullscreen 1" //local.player stufftext "globalwidgetcommand june6 shader townhallwindow" //local.player stufftext "globalwidgetcommand june6 rect 64 288 512 64" //local.player stufftext "globalwidgetcommand june6 fgcolor 1.00 1.00 1.00 1.00" //local.player stufftext "globalwidgetcommand june6 bgcolor 0.00 0.00 0.00 0.00" //local.player stufftext "globalwidgetcommand june6 font facfont-20" //local.player stufftext ("globalwidgetcommand june6 title Cannon-Amno:-" + self.shellamno) //local.player stufftext "showmenu dday1" while((local.player.onflak) && (local.player.dmteam != "spectator") && (local.player!= NULL) && (local.player!= NIL)) { local.player stufftext ("globalwidgetcommand june6 title Cannon-Amno-" + self.shellamno) if(local.player.useheld || !IsAlive(local.player)) { local.player.onflak = 0 } //println "moving player" local.player.origin = self.origin - self.forwardvector * 56 //distance back local.player.origin += ( 0 0 37 ) //dist up local.canangle = local.player thread find_spot self setaimtarget local.canangle if(local.player.fireheld == 1 && self.canfire != 0 && self.shellamno != 0) { local.shot_org = local.canangle self waitthread fire_cannon local.shot_org //wait 4.8 self thread check_fire_ready local.canangle remove //local.player iprint ("SHELLS REMAINING: " + self.shellamno) 1 } waitframe if(local.canangle != NULL) local.canangle remove } if(local.player != NULL) { local.player solid //local.player holster local.player show local.player uselast local.player physics_on local.player stufftext "hidemenu dday1" } self.hasgunner = 0 end check_fire_ready: self.canfire = 0 wait 4.8 self.canfire = 1 if(self.shellamno == 0) { self.gunner stopwatch 15 self playsound flak_reload wait 14.8 self.shellamno = self.save_amno //self.gunner iprint "Reloading Done" 1 } end //------------------------------------------------------------------- find_spot: local.fwd_vec = (angles_toforward self.viewangles) local.start = self gettagposition "Bip01 Head" local.range = 5000 local.hit_location = trace (local.start - local.fwd_vec * 56) (local.start + local.fwd_vec * local.range ) 0 local.ent = spawn script_origin origin (local.hit_location - ( 0 0 32 )) end local.ent //------------------------------------------------------------------- fire_cannon local.arty: self setaimtarget local.arty self waittill ontarget self anim fire waitthread get_playerkills local.arty self thread bang local.arty wait .8 self playsound flak_reload local.arty immediateremove self.shellamno-- end //------------------------------------------------ end bang local.arty: local.Exp1 = spawn "fx/scriptbazookaexplosion.tik" local.Exp2 = spawn "animate/fx_mortar_dirt.tik" local.Exp3 = spawn "emitters/fireandsmoke.tik" local.Exp4 = spawn "emitters/residual_fire.tik" exec global/earthquake.scr .23 4 0 0 local.Exp1.origin = local.arty local.Exp1 anim start local.Exp2.origin = local.arty local.Exp2 anim start local.Exp3.origin = local.arty local.Exp3 anim start local.Exp4.origin = local.arty local.Exp4 anim start wait 1 local.Exp1 remove local.Exp2 remove wait 3 local.Exp3 remove local.Exp4 remove end flak_pain: local.killer = parm.other local.victim = self.flakcan.gunner if((local.victim != NULL) && (local.victim.onflak == 1) && (local.victim != local.killer)) { local.victim damage local.killer 10 local.killer local.victim.origin local.victim.forwardvector ( 0 0 0 ) 0 0 17 0 } if(self.flakcan.destroy_enabled) { self.flakcan.canhealth -= 15 if(self.flakcan.canhealth <= 0) { local.d_flak = spawn self.flakcan.destroyed_model //models/statweapons/flak88turret.tik local.d_flak.origin = self.flakcan.origin local.d_flak.angles = self.flakcan.angles iprintlnbold "A Flak88 Cannon Has Destroyed!" waitframe self.flakcan.base remove self.flakcan.touchlisten remove self.flakcan.gunner.onflak = 0 self remove } } end get_playerkills local.arg local.flak: for(local.i=1; local.i <= $player.size; local.i++) { if((vector_within $player[local.i].origin local.arg 300) && ($player[local.i] != local.flak.gunner)) { local.victim = $player[local.i] local.killer = local.flak.gunner local.victim damage local.killer 150 local.killer local.victim.origin local.victim.forwardvector ( 0 0 0 ) 0 0 9 0 } } end