main local.name local.originbomb local.anglesbomb local.originwalkie local.angleswalkie local.damageradius local.move1st_b4blowup local.pulsating local.pulsetime: // runs only once when map loads. level.radiobomb_origin[local.name] = local.originbomb level.radiobomb_angles[local.name] = local.anglesbomb level.walkietalkie_origin[local.name] = local.originwalkie level.walkietalkie_angles[local.name] = local.angleswalkie level.rw_damageradius[local.name] = local.damageradius level.rw_move1st_b4blowup[local.name] = local.move1st_b4blowup level.rw_pulsating[local.name] = local.pulsating if(local.pulsetime != NIL) { level.rw_pulsetime[local.name] = local.pulsetime } if(local.pulsetime == NIL) { level.rw_pulsetime[local.name] = 8 } // default: 8 seconds of radiobomb's red pulsating model after blowing up, before it's removed. thread radiobomb local.originbomb local.anglesbomb local.name thread walkietalkie local.originwalkie local.angleswalkie local.name end //////////////////////////////////////////////////////////////////////// change_originangles local.name local.originbomb local.anglesbomb local.originwalkie local.angleswalkie: // in case you want to randomize the origins after the radio and walkie respawn. // randomization must be controlled by a while-loop outside of this script. level.radiobomb_origin[local.name] = local.originbomb level.radiobomb_angles[local.name] = local.anglesbomb level.walkietalkie_origin[local.name] = local.originwalkie level.walkietalkie_angles[local.name] = local.angleswalkie end //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// radiobombblowup local.origin local.angles local.name: if(level.rw_move1st_b4blowup[local.name] == 0 || (level.rw_move1st_b4blowup[local.name] == 1 && local.origin != level.radiobomb_origin[local.name])) { if(level.radiobomb_blowup[local.name] != 1) { local.explosion = spawn script_model local.explosion model "animate/fx_explosion_mine.tik" local.explosion.origin = local.origin + ( 0 0 10 ) local.explosion.angles = local.angles local.explosion notsolid local.explosion.scale = 2 local.explosion anim start local.debris = spawn script_model local.debris model "animate/fx_mortar_dirt.tik" local.debris.origin = local.origin + ( 0 0 10 ) local.debris.angles = local.angles local.debris notsolid local.debris.scale = 1.5 local.debris anim start radiusdamage local.explosion.origin 500 level.rw_damageradius[local.name] waitframe local.explosion remove local.debris remove if(level.rw_pulsating[local.name] == 1) { thread pulsating_afterglow local.origin local.angles local.name } } $("rbomb_trigger1" + local.name).origin = level.radiobomb_origin[local.name] // if the bomb was on the ground, move it back to its original spawn location $("rbomb_trigger1" + local.name).angles = level.radiobomb_angles[local.name] // otherwise if carried by a player, $rbomb_trigger1 = NIL (not spawned in yet by "radiobomb" thread). $("rbomb_trigger1" + local.name).model = "animate/pulse_radiobomb_pickup.tik" } if(level.rw_move1st_b4blowup[local.name] == 1 && local.origin == level.radiobomb_origin[local.name]) // in case the walkie talkie player tries to blow up a bomb that hasn't moved from its spawn yet. { level.bombstill_at1storigin[local.name] = 1 // only used to turn on/off iprint commands in walkie talkie's "scan_player" thread. } end //////////////////////////////////////////////////////////////////////// pulsating_afterglow local.origin local.angles local.name: local.bombpulse = spawn script_model local.bombpulse model "animate/pulse_radiobomb.tik" local.bombpulse.origin = local.origin local.bombpulse.angles = local.angles local.bombpulse notsolid wait level.rw_pulsetime[local.name] // pulsating radiobomb ghost appears for local.pulsetime seconds at the explosion's origin, after blowing up. local.bombpulse remove end //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// radiobomb local.origin local.angles local.name: local.trigger = spawn trigger_use targetname ("rbomb_trigger1" + local.name) local.trigger model "animate/pulse_radiobomb_pickup.tik" local.trigger setsize ( -30 -30 -50 ) ( 30 30 50 ) local.trigger.scale = 1 //local.trigger light 0 0 1 100 local.trigger show //local.trigger droptofloor if(level.radiobomb_blowup[local.name] != 1) { local.trigger.origin = local.origin local.trigger.angles = local.angles } if(level.radiobomb_blowup[local.name] == 1 || level.playerheld_explode[local.name] == 1) // when a player explodes while holding the rbomb, force the rbomb respawn back to initial origin. { local.trigger.origin = level.radiobomb_origin[local.name] local.trigger.angles = level.radiobomb_angles[local.name] level.rbomb_dropped[local.name] = 0 } if(level.radiobomb_origin[local.name] != local.origin && level.playerheld_explode[local.name] != 1) { local.trigger.model = "animate/radiobomb.tik" } level.radiobomb_blowup[local.name] = 0 // this makes sure the "radiobombblowup" thread isn't triggered again, shortly after a player picks up the recently-exploded bomb. level.playerheld_explode[local.name] = 0 local.trigger waittill trigger local.trigger nottriggerable local.player = parm.other if(local.player.inuse == 1) { local.player iprint "Cannot use. You are holding something already." wait 1 local.trigger remove thread radiobomb local.origin local.angles local.name end } else { if(level.rbomb_dropped[local.name] != 1) { local.trigger message ("*** You have acquired a radiobomb. ***") } if(level.rbomb_dropped[local.name] == 1) { local.trigger message ("*** You have picked up a radiobomb. ***") } local.player.inuse = 1 local.player playsound radiobombplant local.player thread doit local.name local.origin local.angles waitframe local.trigger remove } end doit local.name local.origin local.angles: self iprint ("Tuned to: " + local.name) self iprint ("Hold the USE key for 3 seconds to drop/plant the radiobomb.") self iprint ("CAUTION: The player holding the walkie talkie will kill you if they hold the USE key!") self attachmodel models/animate/radiobomb.tik "Bip01 R Thigh" 0.5 ("rbomb1_1" + local.name) 1 -1 -1 -1 -1 ( 0 0 3 ) //( -up +down, +forward -backward, +right -left ) local.static = spawn script_model local.static model "items/cigarette.tik" local.static.scale = 0.001 local.static.origin = self.origin local.static notsolid //local.static light 0 0 1 70 local.static glue self local.static show //huddraw_alpha 104 0 //huddraw_virtualsize 104 1 //huddraw_alpha 104 .8 //huddraw_font 104 "verdana-12" //huddraw_color 104 .5 0 .5 //huddraw_rect 104 -200 222 200 14 //huddraw_string 104 "Radio Bomb: Picking Up" $("rbomb_trigger1" + local.name) nottriggerable waitframe $("rbomb_trigger1" + local.name) remove $("rbomb1_1" + local.name).angles = ( 0 180 20 ) //if(level.rbomb_dropped[local.name] != 1) { self stufftext "say *** I have acquired a radiobomb. ***" } //if(level.rbomb_dropped[local.name] == 1) { self stufftext "say *** I picked up a radiobomb. ***" } //wait 0.5 //huddraw_string 104 "Radio Bomb: Acquired" //wait 0.5 local.result = self waitthread scan_player local.name if(local.result != left) { self.inuse = 0 $("rbomb1_1" + local.name) remove //self stufftext "say *** I dropped a radiobomb. ***" //huddraw_string 104 "Radio Bomb: Dropped" local.static unglue local.static remove level.rbomb_dropped[local.name] = 1 if(level.rw_bombnowplanted[local.name] != 1) { if(level.rbomb_spectator[local.name] != 1) { wait 0.5 } // do not wait 0.5 seconds if player goes into spectator. //huddraw_string 104 "" if(level.rbomb_spectator[local.name] == 1) { level.rbomb_spectator[local.name] = 0 goto radiobomb local.origin local.angles local.name } goto radiobomb self.origin self.angles local.name } if(level.rw_bombnowplanted[local.name] == 1) { thread radiobomb self.origin self.angles local.name // using "thread" here allows bomb to be planted faster. level.rw_bombnowplanted[local.name] = 0 //wait 0.5 //huddraw_string 104 "" } } end scan_player local.name: local.result = ok local.team = self.dmteam local.count = 0 while(1) { if(self == NULL) { local.result = left end local.result } else { level.bombstill_at1storigin[local.name] = 0 // as soon as a player picks up a radiobomb from its 1st origin, make this 0. if(self.dmteam != local.team || !isalive self || self.dmteam == spectator) { if(self.dmteam == spectator || isalive self) { level.rbomb_spectator[local.name] = 1 } end local.result } local.planttimer = 0 while(self.useheld == 1 && self.dmteam == local.team && isalive self) { if(local.planttimer == 0) { self stopwatch 3 } if(local.planttimer >= 30) { self stopwatch 0 self iprint ("You planted a radiobomb, named: " + local.name) level.rw_bombnowplanted[local.name] = 1 end local.result // plants the bomb after holding for 3 seconds, removes from player's hand and drops to the ground. } local.planttimer++ wait 0.1 } self stopwatch 0 if(level.radiobomb_blowup[local.name] == 1) { waitthread radiobombblowup self.origin self.angles local.name // whenever the player holding a walkie talkie holds USE key, the bomb will blow up at the player's origin. end local.result } } wait 0.1 } end //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// walkietalkie local.origin local.angles local.name: local.trigger = spawn trigger_use targetname ("rwalkie_trigger1" + local.name) local.trigger model "items/walkietalkie.tik" if(level.radiobomb_blowup[local.name] != 1 || level.bombstill_at1storigin[local.name] == 1) { local.trigger.origin = local.origin // if the bomb was blown up, respawn the walkie back to its first spawn origin. local.trigger.angles = local.angles } // walkie talkie drops from player to ground after blowing up the bomb with USE key. if(level.radiobomb_blowup[local.name] == 1 && level.bombstill_at1storigin[local.name] == 0) { local.trigger.origin = level.walkietalkie_origin[local.name] local.trigger.angles = level.walkietalkie_angles[local.name] level.rbomb_dropped[local.name] = 0 } local.trigger setsize ( -30 -30 -50 ) ( 30 30 50 ) local.trigger.scale = 1 //local.trigger light 0.5 0 1 100 local.trigger show local.trigger droptofloor level.radiobomb_blowup[local.name] = 0 local.trigger waittill trigger local.trigger nottriggerable local.player = parm.other if(local.player.inuse == 1) { local.player iprint "Cannot use. You are holding something already." wait 1 local.trigger remove thread walkietalkie local.origin local.angles local.name end } else { if(level.rwalkie_dropped[local.name] != 1) { local.trigger message ("*** You have acquired a walkie talkie.***") } if(level.rwalkie_dropped[local.name] == 1) { local.trigger message ("*** You have picked up a walkie talkie. ***") } local.player.inuse = 1 local.random = randomint(2) if(local.random == 0) { local.player playsound ledpickup1 } if(local.random == 1) { local.player playsound ledpickup2 } local.player thread doit2 local.name local.origin local.angles waitframe local.trigger remove } end doit2 local.name local.origin local.angles: self iprint ("Tuned to: " + local.name) self iprint ("Hold the USE key for 3 seconds to blow up the radiobomb.") self iprint ("CAUTION: You will kill the player holding the radiobomb! Wait until they drop it first.") self attachmodel models/static/scr536.tik "Bip01 R Thigh" 0.75 ("rwalkie1_1" + local.name) 1 -1 -1 -1 -1 ( 0 0 4 ) //( -up +down, +forward -backward, +right -left ) local.static = spawn script_model local.static model "items/cigarette.tik" local.static.scale = 0.001 local.static.origin = self.origin local.static notsolid //local.static light 0.5 0 1 70 local.static glue self local.static show //huddraw_alpha 104 0 //huddraw_virtualsize 104 1 //huddraw_alpha 104 .8 //huddraw_font 104 "verdana-12" //huddraw_color 104 .5 0 .5 //huddraw_rect 104 -200 222 200 14 //huddraw_string 104 "Walkie Talkie: Picking Up" $("rwalkie_trigger1" + local.name) nottriggerable waitframe $("rwalkie_trigger1" + local.name) remove $("rwalkie1_1" + local.name).angles = ( 90 180 20 ) //if(level.rwalkie_dropped[local.name] != 1) { self stufftext "say *** I have acquired a walkie talkie. ***" } //if(level.rwalkie_dropped[local.name] == 1) { self stufftext "say *** I picked up a walkie talkie. ***" } //wait 0.5 //huddraw_string 104 "Walkie Talkie: Acquired" //wait 0.5 local.result = self waitthread scan_player2 local.name if(local.result != left) { self.inuse = 0 $("rwalkie1_1" + local.name) remove //self stufftext "say *** I dropped a walkie talkie. ***" //huddraw_string 104 "Walkie Talkie: Dropped" local.static unglue local.static remove level.rwalkie_dropped[local.name] = 1 if(level.rw_bombnowplanted[local.name] != 1) { if(level.talkie_spectator[local.name] != 1) { wait 0.5 } //huddraw_string 104 "" if(level.talkie_spectator[local.name] == 1) { level.talkie_spectator[local.name] = 0 goto walkietalkie local.origin local.angles local.name } goto walkietalkie self.origin self.angles local.name } if(level.rw_bombnowplanted[local.name] == 1) { self playsound fastradionoise thread walkietalkie self.origin self.angles local.name // using "thread" here allows walkie to respawn faster. level.rw_bombnowplanted[local.name] = 0 //wait 0.5 //huddraw_string 104 "" } } end scan_player2 local.name: local.result = ok local.team = self.dmteam local.count = 0 while(1) { if(self == NULL) { local.result = left end local.result } else { if(self.dmteam != local.team || !isalive self || self.dmteam == spectator) { if(self.dmteam == spectator || isalive self) { level.talkie_spectator[local.name] = 1 } end local.result } local.detonatetimer = 0 while(self.useheld == 1 && self.dmteam == local.team && isalive self) { if(local.detonatetimer == 0) { self stopwatch 3 } if(local.detonatetimer >= 30) { if($("rbomb_trigger1" + local.name) != NULL) { thread radiobombblowup $("rbomb_trigger1" + local.name).origin $("rbomb_trigger1" + local.name).angles local.name } if($("rbomb_trigger1" + local.name) == NULL) { thread radiobombblowup $("rbomb1_1" + local.name).origin $("rbomb1_1" + local.name).angles local.name level.playerheld_explode[local.name] = 1 } level.radiobomb_blowup[local.name] = 1 // this is used in case $rbomb_trigger1 = NIL (bomb still in a player's hand/waist, now called $rbomb1_1). self stopwatch 0 if(level.bombstill_at1storigin[local.name] == 1) { self iprint ("You dropped a walkie talkie, named: " + local.name) self iprint ("The bomb must be moved from its 1st reset-origin before you can blow it up.") level.rw_bombnowplanted[local.name] = 1 end local.result // commenting this line out disables dropping the walkie talkie (usually drops to the ground below player). } if(level.bombstill_at1storigin[local.name] != 1) { end local.result // drop/respawn the walkie talkie if the bomb blew up (only if bomb is not at 1st origin) } // "end local.result" will always happen here if local.move1st_b4blowup = 0 (also named: level.rw_move1st_b4blowup[local.name]) } local.detonatetimer++ wait 0.1 } self stopwatch 0 } wait 0.1 } end