Code: Select all
// STALINGRAD BETA TDM FFA RB
// BY GEN COBRA (Chris Murchison)
main:
setcvar "g_obj_alliedtext1" " STALINGRAD"
setcvar "g_obj_axistext1" " GEN COBRA"
level.script="maps/dm/stalingrad_beta.scr"
setcvar "g_scoreboardpic" "textures/mohmenu/dmloading/stalingrad_beta2.tga"
local.master = spawn ScriptMaster
local.master aliascache leadinmp1 sound/weapons/explo/Exp_LeadIn_06.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m obj dm train"
local.master aliascache leadinmp2 sound/weapons/explo/Exp_LeadIn_07.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m obj dm train"
local.master aliascache leadinmp3 sound/weapons/explo/Exp_LeadIn_08.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m obj dm train"
local.master aliascache leadinmp4 sound/weapons/explo/Exp_LeadIn_09.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m obj dm train"
local.master aliascache leadinmp5 sound/weapons/explo/Exp_LeadIn_10.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m obj dm train"
local.master aliascache leadinmp6 sound/weapons/explo/Exp_LeadIn_11.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m obj dm train"
local.master aliascache leadinmp7 sound/weapons/explo/Exp_LeadIn_12.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m obj dm train"
local.master aliascache leadinmp8 sound/weapons/explo/Exp_LeadIn_13.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "m obj dm train"
local.master aliascache higgins_explode sound/weapons/explo/Explo_MetalMed1.wav soundparms 1.5 0.0 1.0 0.0 500 5000 weapon loaded maps "m obj dm train"
exec global/ambient.scr m5l1b music
exec global/exploder.scr
exec global/bomber.scr
exec global/door_locked.scr::lock
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waitTill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
level.script = maps/dm/stalingrad_beta.scr
exec ubersound/ubersound.scr
thread random_explode_start
level waittill spawn
end
StartTank:
// Initialisation of the tank parameters.
$TankPanzer1 waitthread InitTank
// Put the tank health on the player screen.
$TankPanzer1 thread TankHealthLoop
// Make the tank move along the chosen path.
$TankPanzer1 thread MoveTank
// Destruction of the tank.
$TankPanzer1 thread TankDeath
end
//*************************************************************************************//
// Definition of the threads that are call from the scr. //
//*************************************************************************************//
InitTank:
self.health = 1000 // Set the initial health of the tank.
self removeondeath 0 // Make sure the tank doesn't desappear when it is destroy.
self lock // Make sure the player can't use the tank.
$TankPanzer1 setcollisionentity self.target // Set the tank collision mask
// Set the tank's immunities.
self immune bullet
self immune fast_bullet
self immune grenade
self immune bash
end
TankHealthLoop:
local.StartHealth = self.health
local.LastHealth = self.health
while (isAlive self)
{
waitframe
if !(isAlive self)
end
if (self.health < local.LastHealth)
{
local.HealthFraction = (self.health / local.StartHealth) * 100
local.HealthFractionInt = int local.HealthFraction
iprintlnbold_noloc (loc_convert_string "PANZER TANK: ") local.HealthFractionInt (loc_convert_string " percent")
local.LastHealth = self.health
}
}
end
MoveTank:
local.Path = $TankPanzer1_Path1 // Set the tank path.
local.TankSpeed = 7 // Set the tank speed value.
local.Acceleration = 30 // Set the tank acceleration value.
local.ReachDistance = 200 // Set the tank reaching distance value.
local.LookAhead = 64 // Set the tank look ahead value
// Move the tank along the path.
self drive local.Path local.TankSpeed local.Acceleration local.ReachDistance local.LookAhead
self waitTill drive // Wait until the tank is at end of path.
self stop // Stop the tank.
self thread TankFire // Call the targeting and firing thread.
end
TankFire:
// While the tank is still alive.
while(isAlive self)
{
// Get out of the thread if the player is dead.
if !(isAlive $player)
end
// Initialisation of the main gun.
local.gun1 = self QueryTurretSlotEntity 0
// Set the main gun turn speed
local.gun1 TurnSpeed 15
// Aim the main gun at the player and wait until it is on the target.
local.gun1 setAimTarget $player
local.gun1 waittill ontarget
// Get out of the thread if the tank is destroy.
if !(isAlive self)
end
// Check if the line of sight is clear.
local.trace = trace (self.origin + (0 0 120)) ($player.origin + (0 0 48)) 1
if ((local.trace[0] != $player.origin[0]) || (local.trace[1] != $player.origin[1]) || (local.trace[2] != $player.origin[2] + 48))
wait(1)
// Check if the player is not to close to the tank.
else if (vector_within $player.origin self.origin 384)
wait(1)
// Check if the player is not to far from the tank.
else if (!(vector_within $player.origin self.origin 2500))
wait(1)
// If the tank can fire at the player
else
{
// Make the main gun fire a shot at the target.
local.gun1 startfiring
wait(1)
local.gun1 stopFiring
wait(5)
}
}
end
TankDeath:
// Wait until the tank is dead.
self waittill death
// Make sure the tank is visible.
self show
// Make sure the tank is not moving.
self stop
// Initialisation of the 2 guns (main gun and mg).
local.gun1 = self QueryTurretSlotEntity 0
local.gun2 = self QueryTurretSlotEntity 1
// Make sure the main gun isn't firing.
local.gun1 stopfiring
// Delete the main gun.
if (local.gun1)
{
self DetachTurretSlot 0
local.gun1 remove
}
// Delete the mg.
if (local.gun2)
{
self DetachTurretSlot 1
local.gun2 remove
}
// Play the sound for the explosion.
self playsound explode_tank
// Spawn the tank explosion.
local.Exp = spawn "fx/fx_tank_explosion.tik"
local.Exp.origin = self.origin
local.Exp anim start
// Shake the ground hard and make a damage zone for the tank destruction blast.
exec global/earthquake.scr .23 4 0 0
radiusdamage self.origin 200 200
// Set the dead thank collision mask.
local.brushmodel = self.target.brushmodel
local.collision = spawn script_object model local.brushmodel
local.collision.angles = self.angles
local.collision.origin = self.origin
local.collision disconnect_paths
// Spawn the destroy tank model.
local.damaged = spawn script_model model models/vehicles/tigertank_d.tik
local.damaged.origin = self.origin
local.damaged.angles = self.angles
// Remove the non-destroy tank model.
self remove
local.Exp remove
end
// --------------------------------------------
// Random Explosions
// --------------------------------------------
random_explode_start:
thread random_explode1
thread random_explode2
thread random_explode3
thread random_explode4
$random_explode4_smoke anim start
$player playsound warn_player_arty_cover
end
random_explode1:
wait (randomfloat 13 + 16)
$random_explode1_origin playsound leadinmp
wait 1
$random_explode1 anim start
radiusdamage $random_explode1_origin 256 384
goto random_explode1
end
random_explode2:
wait (randomfloat 7 + 14)
$random_explode2_origin playsound leadinmp
wait 1
$random_explode2 anim start
radiusdamage $random_explode2_origin 256 384
goto random_explode2
end
random_explode3:
wait (randomfloat 5 + 8)
$random_explode3_origin playsound leadinmp
wait 1
$random_explode3_origin playsound higgins_explode
$random_explode3 anim start
radiusdamage $random_explode3_origin 256 512
goto random_explode3
end
random_explode4:
wait (randomfloat 8 + 12)
$random_explode4_origin playsound leadinmp
wait 1
$random_explode4 anim start
radiusdamage $random_explode4_origin 256 480
goto random_explode4
end 