Problem with Driveable Tanks

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Jayblade
Private
Posts: 8
Joined: Tue Jul 29, 2003 8:33 pm

Problem with Driveable Tanks

Post by Jayblade »

I attempted to spawn driveable tanks on Southern France but the game crashes during loading. I included all the textures and scripts needed in the .pk3. This is the script for the map.

Code: Select all


// Dammit 2003 .........Blitzschnee
// CONCEPT MAPPING + ARCHITECTURE: Gary Lack (Small Sumo)
// SCRIPTING + AI: ? ? (Wombat)
// SCRIPTING + VEHICLES: Duncan Weir (Scorpio)
// August 2002

main:

thread debugtext "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
thread debugtext "                    Southern France               "
thread debugtext "***********************************************************"

level.debug = 1


thread debugtext "THREAD main"

setcvar "g_obj_alliedtext1" "Southern France"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "mohdm1"

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//there are three places to add your extra tanks. below is one
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//we are useing 4 tanks not 8 so you see 4 are // out ....... you can have as many
// as you like just follow the patern


level.alliedtank_1alive = 1
level.alliedtank_2alive = 1
//level.alliedtank_3alive = 1
//level.alliedtank_4alive = 1

level.axistank_1alive = 1
level.axistank_2alive = 1
//level.axistank_3alive = 1
//level.axistank_4alive = 1

// ******************************************************************************
// ************************************* VARS THAT CONTROL THE GAME *************
// setup default vars

// ******************************************************************************
// ******************************************************************************




	level waittill prespawn

	local.tank = spawn models/vehicles/axis_kingtank.tik
	local.tank.targetname = "axistank_1"
	local.tank.origin = (255.27 -378.02 16.13)
	local.tank solid
	local.tank immune bullet 
	local.tank immune fast_bullet
	local.tank immune bash
	local.tank immune mg
	local.tank immune explosion

	local.tank = spawn models/vehicles/axis_kingtank.tik
	local.tank.targetname = "axistank_2"
	local.tank.origin = (49.22 525.87 384.13)
	local.tank solid
	local.tank immune bullet 
	local.tank immune fast_bullet
	local.tank immune bash
	local.tank immune mg
	local.tank immune explosion

	local.tank = spawn models/vehicles/allied_kingtank.tik
	local.tank.targetname = "alliedtank_1"
	local.tank.origin = (487.00 470.28 384.13)
	local.tank solid
	local.tank immune bullet 
	local.tank immune fast_bullet
	local.tank immune bash
	local.tank immune mg
	local.tank immune explosion

	local.tank = spawn models/vehicles/allied_kingtank.tik
	local.tank.targetname = "alliedtank_2"
	local.tank.origin = (771.21 2296.53 384.13)
	local.tank solid
	local.tank immune bullet 
	local.tank immune fast_bullet
	local.tank immune bash
	local.tank immune mg
	local.tank immune explosion	

	thread debugtext "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
	thread debugtext "                      PRESPAWN !                           "
	thread debugtext "***********************************************************"

	//*** Precache Dm Stuff
	exec global/DMprecache.scr

///////////////////////////////////////////////////////////////map name here also*********

	level.script = maps/dm/mohdm1.scr

	thread debugtext "Loading script: ambient.scr"
	exec global/ambient.scr mohdm1




	level waittill spawn

	thread debugtext "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
	thread debugtext "                         SPAWN !                           "
	thread debugtext "***********************************************************"

	// set the parameters for this round/wave based match
	level.dmrespawning = 1   // 1 **wave based** or 0 **round based**
	level.dmroundlimit = 30   // round time limit in minutes
	level.clockside = draw // set to axis, allies, kills, or draw

	

	// start  the tanks
	thread spawntanks	

	level waittill roundstart

	thread debugtext "***********************************************************"
	thread debugtext "                         ROUNDSTART !                       "
	thread debugtext "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//there are three places to add your extra tanks. below is another and a third
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

	$axistank_1 thread allies_win_tank	
        $axistank_2 thread allies_win_tank

        //$axistank_3 thread allies_win_tank	
        //$axistank_4 thread allies_win_tank

	$alliedtank_1 thread axis_win_tank
        $alliedtank_2 thread axis_win_tank

       // $alliedtank_3 thread axis_win_tank
       // $alliedtank_4 thread axis_win_tank

	thread debugtext "END THREAD main"
end

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


spawntanks:	
	thread debugtext "THREAD spawntanks"


	$alliedtank_1 thread preptank "allies"
        

	$alliedtank_2 thread preptank "allies"

        
	//$alliedtank_3 thread preptank "allies"

      
	//$alliedtank_4 thread preptank "allies"

/////////////////////////////////////////////////////////next team////////////////////////////

		
	$axistank_1 thread preptank "axis"

        	
	$axistank_2 thread preptank "axis"

       	
	//$axistank_3 thread prepbike

        	
	//$axistank_4 thread preptank "axis"
	
	thread debugtext "END THREAD spawntanks"
end

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


preptank local.team:	
	thread debugtext ("THREAD preptank = " + self + ", Team that owns this tank = " + local.team)	

	
	self.destroyed = 0

	self.driver = NULL

	self.speed = 400
	self.maxspeed = self.speed

	self vehiclespeed self.speed

	self removeondeath 0

	self.inuse = 0

	self.health = 600                                           /////////tank health

//	self vehicleanim remove_surfaces

	self rendereffects "-shadow"

	self takedamage

	self.drivable = 1
	
	self.gun = self queryturretslotentity 0
	if (self.gun)
	{
		self.gun.targetname = (self + "_turret1")
/////////////////////////////////////////////////////////////////////////////?????????
		//self.gun unlock
//		self.gun takedamage
		self.gun solid
		self.gun rendereffects "-shadow"

		self.gun removeimmune bash
		self.gun removeimmune bullet
		self.gun removeimmune fast_bullet
		self.gun removeimmune shotgun
		self.gun removeimmune grenade
		self.gun removeimmune rocket
		self.gun removeimmune explosion
		self.gun removeimmune crush
		self.gun removeimmune falling
		self.gun removeimmune vehicle
	}

	local.t2 = self queryturretslotentity 1
	if (local.t2)
		local.t2 remove

	self notsolid

	if (self.target)
	{	
		self.collisionent = self.target
//		self.collisionent hide

		self.collisionent removeimmune bash
		self.collisionent removeimmune bullet
		self.collisionent removeimmune fast_bullet
		self.collisionent removeimmune shotgun
		self.collisionent removeimmune grenade
		self.collisionent removeimmune rocket
		self.collisionent removeimmune explosion
		self.collisionent removeimmune crush
		self.collisionent removeimmune falling
		self.collisionent removeimmune vehicle
	}

	self removeimmune bash
	self removeimmune bullet
	self removeimmune fast_bullet
	self removeimmune shotgun
	self removeimmune grenade
	self removeimmune rocket
	self removeimmune explosion
	self removeimmune crush
	self removeimmune falling
	self removeimmune vehicle

	thread tankpain

	thread waitfordeath

	thread waitforplayer local.team

	if (self.trigger)
	{
		local.tanktrigger = spawn script_origin
		local.tanktrigger.origin = self.origin
		self.trigger.origin = self.origin
		self.trigger bind local.tanktrigger
		local.tanktrigger glue self
	}
		
	if (local.team == "allies")
	{
		local.enemy = "axis"
		

		

		

		
	}
	else
	{
		local.enemy = "allies"
		







	}

	

	self.team = local.team
	self.enemy = local.enemy

	

	thread debugtext ("END THREAD preptank = " + self + ", Team that can use this tank = " + local.team)
end

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



waitfordeath:
	thread debugtext ("THREAD waitfordeath for tank = " + self)

	self waittill death

	self.inuse = 1

	thread tankexplode

	thread debugtext ("END THREAD waitfordeath for tank = " + self)
end

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


waitforplayer local.team:
	thread debugtext ("THREAD waitforplayer for tank = " + self + ", team that owns this tank = " + local.team)
	
	while ((IsAlive self) && (self.inuse == 1))
	{
		if (self.health <=0)
			end

		waitframe
	}

	local.fov = 120
	local.usedistance = 200

	thread debugtext ("waitforplayer: waittill player has triggered " + self.trigger )
	self.trigger waittill trigger
	thread debugtext ("waitforplayer: player has triggered " + self.trigger )

	if (self.inuse == 1)
		goto waitforplayer local.team

	local.player = parm.other // get player

//	if ( (Isalive local.player) && (local.player cansee self local.fov local.usedistance) && (local.player.useheld == 1) )

//	if ( local.distance < local.usedistance )

	if ( (Isalive local.player) && (local.player.useheld == 1) )
	{
		local.distance = vector_length (local.player.origin - self.gun.origin)
		thread debugtext ("waitforplayer: Player within use distance of " + self + "'s gun = " + self.gun + " :), distance = " + local.distance + ", needs to be <= " + local.usedistance)
	
		self.inuse = 1
	
		while (local.player.useheld == 1) // wait for play to release use key
			waitframe

	//	local.player notsolid
	//	local.player nodamage

//		self.gun unlock
//		self.gun setPlayerUsable 1
//		self.gun doUse local.player
//		self.gun setPlayerUsable 0
//		self.gun lock

		self attachdriverslot 0 local.player

		self.driver = local.player

		self removeimmune bash
		self removeimmune bullet
		self removeimmune fast_bullet
		self removeimmune shotgun
		self removeimmune grenade
		self removeimmune rocket
		self removeimmune explosion
		self removeimmune crush
		self removeimmune falling
		self removeimmune vehicle

		self.gun removeimmune bash
		self.gun removeimmune bullet
		self.gun removeimmune fast_bullet
		self.gun removeimmune shotgun
		self.gun removeimmune grenade
		self.gun removeimmune rocket
		self.gun removeimmune explosion
		self.gun removeimmune crush
		self.gun removeimmune falling
		self.gun removeimmune vehicle

		local.player removeimmune bash
		local.player removeimmune bullet
		local.player removeimmune fast_bullet
		local.player removeimmune shotgun
		local.player removeimmune grenade
		local.player removeimmune rocket
		local.player removeimmune explosion
		local.player removeimmune crush
		local.player removeimmune falling
		local.player removeimmune vehicle

//		local.player hide

//		self attachturretslot 0 local.player
//		local.player perferredweapon "88mm Tank Gun"

		//thread tank_health_hud local.team local.player

		//if (local.player.dmteam != local.team)
			//thread capturetank local.player.dmteam local.player

//		waitthread waitfortank

		thread debugtext ("THREAD waitfortank = " + self)

		while ((IsAlive self) && (self.health > 0) && (self.inuse == 1))
		{
			if (IsAlive local.player)
			{
				if (local.player.dmteam == "spectator")
				{
					//waitthread getoutoftank
					self.inuse = 0
					goto waitforplayer local.team
				}

				if (local.player.useheld == 1)
				{
					thread debugtext ("waitfortank: player has pressed use, while i'm processing " + self + ", start time = " + level.time)

					local.starttime = level.time
					local.time = 0
					while ( (IsAlive local.player) && (IsAlive self) && (self.inuse == 1) && (local.player.useheld == 1) && (local.time <=1) )
					{		
						if (local.player.dmteam == "spectator")
						{
							//waitthread getoutoftank
							self.inuse = 0
							goto waitforplayer local.team
						}
	
						wait .1
						local.time ++
					}

					thread debugtext ("waitfortank: player held use for " + self + ", for time = " + local.time)

					if (local.time > 1)
					{
						waitthread getoutoftank local.player
						goto waitforplayer local.team
					}
				}
			}
			else
			{
				self.inuse = 0
				goto waitforplayer local.team
			}

			waitframe
		}

		goto waitforplayer local.team
	}

	thread debugtext ("waitforplayer: Player not near enough to " + self + "'s gun = " + self.gun + " !, distance = " + local.distance + ", needs to be <= " + local.usedistance)
	goto waitforplayer local.team

	thread debugtext ("END THREAD waitforplayer for tank = " + self)
end

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


waitfortank:
	thread debugtext ("THREAD waitfortank = " + self)

	local.player = parm.other

	while ((IsAlive self) && (self.health > 0) && (self.inuse == 1))
	{
		if (local.player.useheld == 1)
		{
			thread debugtext ("waitfortank: player has pressed use, while i'm processing " + self + ", start time = " + level.time)

			local.starttime = level.time
			local.time = 0
			while ((local.player!=NULL) && (IsAlive self) && (self.inuse == 1) && (local.player.useheld == 1) && (local.time <=1) )
			{
				wait .1
				local.time ++
			}

			thread debugtext ("waitfortank: player held use for " + self + ", for time = " + local.time)

			if (local.time > 1)
			{
				waitthread getoutoftank local.player
				end
			}
		}

		waitframe
	}

	thread debugtext ("ENDTHREAD waitfortank = " + self)
end

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


getoutoftank local.player:
	thread debugtext ("THREAD getoutoftank = " + self)

	self fullstop

	self notsolid
	self.collisionent notsolid

	thread debugtext ("Self origin = " + self.origin)
	thread debugtext ("Turret origin = " + self.gun.origin)
	thread debugtext ("Player origin = " + local.player.origin)

	local.origin = local.player.origin + (50 50 100)                         
	local.player.origin = local.origin

	thread debugtext ("after move New Player origin = " + local.player.origin)

	//self detachturretslot 0 self.origin
	self detachdriverslot 0 local.player

	thread debugtext ("after driver New Player origin = " + local.player.origin)

	if (self.gun)
	{
		self detachturretslot 0 self.gun.origin

		thread debugtext ("after turret New Player origin = " + local.player.origin)
//		self.gun unlock
//		self.gun setPlayerUsable 1
//		self.gun doUse local.player
//		self.gun setPlayerUsable 0
//		self.gun lock
		local.gunangles = self.gun.angles		
		self.gun remove	
	}
	
	//local.player unlockmovement

	local.player physics_on

	local.player show

	releaseplayer
	cueplayer

	local.player solid
	local.player takedamage

	local.player removeimmune bash
	local.player removeimmune bullet
	local.player removeimmune fast_bullet
	local.player removeimmune shotgun
	local.player removeimmune grenade
	local.player removeimmune rocket
	local.player removeimmune explosion
	local.player removeimmune crush
	local.player removeimmune falling
	local.player removeimmune vehicle

	thread debugtext ("New Player origin = " + local.player.origin)

////////////////////////////////////////////////////////////////////////////////
/////turret/////////////////////////////////////////////////////////////////////
/////turret/////////////////////////////////////////////////////////////////////
/////turret/////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////


	if (self.team == "axis")
		self spawnturret 0 "vehicles/axis_kingcannon.tik"
	else
		self spawnturret 0 "vehicles/panzer_cannon_sumo.tik"

	self.gun = self queryturretslotentity 0
	if (self.gun)
	{
		self.gun.angles = local.gunangles
		self.gun solid
		self.gun rendereffects "-shadow"
	}

	wait 1

	self.driver = NULL
	self.inuse = 0

	thread debugtext ("END THREAD getoutoftank = " + self)
end

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


tankpain:
	thread debugtext ("THREAD tankpain for tank = " + self)

	local.original_health = self.health
	local.previoushealth = self.health
	local.paintime = level.time
	
	while (IsAlive self)
	{
		if (self.health < local.previoushealth)
		{
			self playsound damage_tank
			exec global/earthquake.scr .2 4 0 0	
		
			if ( (self.health < (local.previoushealth - 150)) && (level.time > (local.paintime + 5) ) )
			{
				local.paintime = level.time
				local.health_fraction = (self.health / local.original_health)

				thread debugtext ("  TankPain: local.health_fraction: " + local.health_fraction)

				local.newspeed = self.speed * local.health_fraction
				if (local.newspeed<0)
					local.newspeed = 0

				self.maxspeed = local.newspeed
				self vehiclespeed self.maxspeed
				
				if (local.health_fraction >= 0.666)
				{
					self playsound tank_hurt1

					waitthread tankdamage 1
				}
				else if (local.health_fraction >= 0.333)
				{
					self playsound tank_hurt2

					waitthread tankdamage 2
				}
				else
				{					
					self playsound tank_hurt3

					waitthread tankdamage 3
				}
			}
			
			local.previoushealth = self.health
		}

		wait .1
	}

	thread debugtext ("END THREAD tankpain for tank = " + self)
end

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


//*** --------------------------------------------
//*** "Allies Victory"
//*** --------------------------------------------

allies_win_tank:
	$alliedtank_1 waittill death 
if(isAlive $alliedtank_2) $alliedtank_2 waittill death 
teamwin axis 


//if(isAlive $alliedtank_3) $alliedtank_3 waittill death 
//teamwin axis 
//if(isAlive $alliedtank_4) $alliedtank_4 waittill death 
//teamwin axis 
end 


//*** --------------------------------------------
//*** "Axis Victory"
//*** --------------------------------------------

axis_win_tank:
	$axistank_1 waittill death 
if(isAlive $axistank_2) $axistank_2 waittill death 
teamwin allies 


//if(isAlive $axistank_3) $axistank_3 waittill death 
//teamwin allies 
//if(isAlive $axistank_4) $axistank_4 waittill death 
//teamwin allies 


end 

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


hudprint local.string local.r local.g local.b:
	thread debugtext ("THREAD hudprint = " + local.string)

	if ((level.hudprint != -1) && (level.hudprint != NULL) && (level.hudprint != NIL) )
		level.hudprint delete

	level.hudprint = local
	local.hudelement = 187

	if (local.r == NIL)
		local.r = 1

	if (local.g == NIL)
		local.g = 1

	if (local.b == NIL)
		local.b = 1

	local.distance = local.string.size / -2
//	huddraw_rect local.hudelement (local.distance * 13) 100 0 0
	huddraw_rect local.hudelement (local.distance * 10) 200 0 0
	huddraw_color local.hudelement local.r local.g local.b

	huddraw_font local.hudelement "facfont-20"
	huddraw_string local.hudelement local.string
	huddraw_align local.hudelement center top
	local.strength = 1
	huddraw_alpha local.hudelement local.strength

	//wait (2 * level.newtimescale)
	wait 2

	while (local.strength > 0)
	{
		local.strength = local.strength - 0.02
		huddraw_alpha local.hudelement local.strength
		wait 0.02
	}

	thread debugtext ("ENDTHREAD hudprint = " + local.string)
end

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


tankdamage local.smoke:
	thread debugtext ("THREAD: tankdamage: self = " + self + ", local.smoke = " + local.smoke)

	self thread spawn_fx "fx/fx_tank_explosion.tik"
	self playsound explode_tank

	thread jitter_large 0 // make the screen shake

	if (local.smoke == 3) // turret
	{
		self.smoke3o = spawn script_origin
		self.smoke3o.origin = self.origin

		self.smoke3 = spawn "models/emitters/linger_smoke.tik"
		self.smoke3 notsolid
		self.smoke3 anim start
		self.smoke3.origin = (self.origin + ( -40 0 130) )
		self.smoke3 bind self.smoke3o

		self.smoke3o glue self
	}
	else if (local.smoke == 2) // front
	{
		self.smoke2o = spawn script_origin
		self.smoke2o.origin = self.origin

		self.smoke2 = spawn "models/emitters/linger_smoke.tik"
		self.smoke2 notsolid
		self.smoke2 anim start
		self.smoke2.origin = (self.origin + ( 100 50 60) )
		self.smoke2 bind self.smoke2o

		self.smoke2o glue self
	}
	else // back
	{
		self.smoke1o = spawn script_origin
		self.smoke1o.origin = self.origin

		self.smoke1 = spawn "models/emitters/linger_smoke.tik"
		self.smoke1 notsolid
		self.smoke1 anim start
		self.smoke1.origin = (self.origin + ( -200 -50 60) )
		self.smoke1 bind self.smoke1o

		self.smoke1o glue self
	}

	thread debugtext ("END THREAD: tankdamage: self = " + self + ", local.smoke = " + local.smoke)
end

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


tankexplode:
	thread debugtext ("THREAD: tankexplode: self = " + self)

	self stop
	self.destroyed = 1

	local.origin = self.origin
	local.angles = self.angles

	thread debugtext ("  Vehicle location @ " + local.origin)
	thread debugtext ("  Vehicle angles = " + local.angles)

	self.gun2 = self QueryTurretSlotEntity 1
	if (self.gun2)
	{
		local.po = self.gun2.origin
		local.po[2] = local.po[2] + 50

		local.t2exp = spawn script_origin
		local.t2exp.origin = local.po
		local.t2exp.angles = local.angles

		thread debugtext ("  Add a turret2 explosion @ " + local.t2exp.origin)

		local.t2exp thread spawn_fx "fx/fx_tank_explosion.tik" 3
		local.t2exp playsound explode_tank
		radiusdamage local.t2exp.origin 200 200

		self.gun2 unlock
		self DetachTurretSlot 1 self.gun2.origin

		local.po = self.gun2.origin
		local.po[2] = local.po[2] + 0

		thread debugtext "  Add some fire to turret 2"

		local.fire2 = spawn script_origin
		local.fire2.origin = local.po
		local.fire2.angles = local.angles

		thread debugtext ("  Add some fire @ " + local.fire2.origin)

		local.fire2 thread spawn_fx "models/emitters/fire.tik"

		wait 1
		thread debugtext ("  remove turret 2 @ " + self.gun2.origin)
		self.gun2 remove
	
		wait 0.5
	}

	self.gun = self QueryTurretSlotEntity 0
	if (self.gun)
	{
		local.po = self.gun.origin
		local.po[2] = local.po[2] + 100

		local.exp = spawn script_origin
		local.exp.origin = local.po
		local.exp.angles = local.angles

		thread debugtext ("  Add a turret explosion @ " + local.exp.origin)

		local.exp thread spawn_fx "fx/fx_tank_explosion.tik" 5
		local.exp playsound explode_tank
		radiusdamage local.exp.origin 500 200

		self.gun unlock

		self DetachTurretSlot 0 self.gun.origin

		local.po = self.gun.origin
		local.po[2] = local.po[2] + 0

		thread debugtext "  Add some fire to turret 1"

		local.fire = spawn script_origin
		local.fire.origin = local.po
		local.fire.angles = local.angles

		thread debugtext ("  Add some fire @ " + local.fire.origin)

		local.fire thread spawn_fx "models/emitters/fire.tik"

		wait 1
		thread debugtext ("remove turret 1 @ " + self.gun.origin)
		self.gun remove
	}

	local.po = local.origin
	local.po[2] = local.po[2] + 250

	local.exp2 = spawn script_origin
	local.exp2.origin = local.origin
	local.exp2.angles = local.angles

	thread debugtext ("Add a main model explosion @ " + local.exp2.origin)

	local.exp2 thread spawn_fx "fx/wall_exploder.tik" 5

	local.exp2 playsound explode_tank
	radiusdamage local.exp2.origin 1000 200

	if (self.driver)
	{
		local.player = self.driver
		waitthread getoutoftank local.player
		local.player exec global/bullethit.scr (0 -1 0) 1000 50 1
	}

	iprintlnbold (self + " has been destroyed.")

	thread debugtext ("remove the model @ " + self.origin)
//	self remove
	self.health = 0
	self hide
	self.tankinuse = 1

	thread debugtext ("do a large screen jitter")
	thread jitter_large 0

	local.dam = spawn script_origin
	local.dam.origin = local.origin
	local.dam.angles = local.angles

	thread debugtext ("Spawn damaged model @ " + local.dam.origin)


////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////dead tank tik here////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////


	local.dam thread spawn_damaged "vehicles/allied_kingtank_d.tik"

/*
	//if (self.tankinuse == 1)
	//{
		thread debugtext ("exit the tank turret")

		wait 1
		thread debugtext ("  OPEN")
		local.dam.damaged anim open

		thread debugtext ("  OPEN_IDLE")
		local.dam.damaged anim open_idle

		thread debugtext "Spawn AI and do exit tank routine"

		local.temp = randomint 3
		local.temp = 0
		if (local.temp == 0)
			local.model_type = human/german_panzer_grenadier
		if (local.temp == 1)
			local.model_type = human/german_panzer_obershutze
		if (local.temp == 2)
			local.model_type = human/german_panzer_tankcommander

		thread debugtext ("spawn = " + local.temp + " which is = " + local.model_type)

		local.ent = spawn local.model_type
		local.ent.origin = local.dam.damaged gettagposition "tag_start"
		local.ent.angles = local.dam.damaged gettagangles "tag_start"
		
		local.ent noticescale 1
		local.ent sight 4500
		local.ent mindist 2024
		local.ent maxdist 2448
		local.ent leash 10000
		
		//if (level.dontdropweapons == 1)
			local.ent dontdropweapons
		
		local.ent exec global/disable_ai.scr
		local.ent notsolid

		local.ent anim_noclip tank_exit_1
		local.ent waittill animdone

		local.ent anim_noclip tank_exit_2
		local.ent waittill animdone

		local.ent anim_noclip tank_exit_3
		local.ent waittill animdone

		local.ent anim_noclip tank_exit_4
		local.ent waittill animdone

		wait .7
		thread debugtext "MAke solid enable AI"
		local.ent solid
		local.ent exec global/enable_ai.scr

		//wait 3
		//thread debugtext "Kill the Ai"
		//local.ent bedead
	//}
*/

	wait 5

	local.po = local.origin
	local.po[2] = local.po[2] + 200

	local.col = spawn script_origin
	local.col.origin = local.po
	local.col.angles = local.angles

	thread debugtext ("Add a mushroom column and big bang @ " + local.col.origin)

	local.col thread spawn_fx "fx/gas_mushroom_column.tik" //10

	local.col playsound explode_tank
	radiusdamage local.col.origin 500 200

	wait 5
	thread debugtext "Add a mushroom cloud"

	local.po = local.origin
	local.po[2] = local.po[2] + 750

	local.mush = spawn script_origin
	local.mush.origin = local.po
	local.mush.angles = local.angles

	thread debugtext ("Add a mushroom cloud @ " + local.mush.origin)

	local.mush thread spawn_fx "fx/gas_mushroom_cloud.tik" 5                       

	thread debugtext ("ENDTHREAD: tankexplode: local.parent = " + local.dam)
end

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


spawn_fx local.fx:
	thread debugtext ("THREAD: spawn_fx: self = " + self + ",local.fx = " + local.fx)
	local.temp = spawn script_model model local.fx
	local.temp.origin = self.origin
	local.temp anim start
	wait 5
	local.temp remove
end

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


spawn_damaged local.model:
	thread debugtext ("THREAD: jitter_large: self = " + self + ",local.model = " + local.model)
	local.damaged = spawn script_model model local.model
	local.damaged.origin = self.origin
	local.damaged.angles = self.angles

	self.smoke = spawn "models/emitters/linger_smoke.tik"
	self.smoke notsolid
	self.smoke anim start
	self.smoke.origin = (self.origin + (0 0 80))
	self.smoke glue self
end local.damaged

//******************************
// jitter large effect
// jitter_large [delay]
//******************************
jitter_large local.time:
	thread debugtext ("THREAD: jitter_large: self = " + self + ",local.time = " + local.time)

	if (local.time)
		wait local.time

	waitexec global/earthquake.scr .35 10 0 0
	waitexec global/earthquake.scr .23 6 0 0
	waitexec global/earthquake.scr 1 1 0 0
	waitexec global/earthquake.scr 1.25 .3 0 1
end

// text only output if debug mode is turned on
debugtext local.text:
	if (level.debug == 1)
		println ("DEBUG drivable_tanktut: " + local.text)
end

Please help me.
Post Reply