help with script please
Ok here it is, its basicly the blitzschnee script but with extra tanks added in. This works well. But the problem is when I tank dies the game is over, just one. This is because the script was designed for just 1 tank per team.
What I want is for a team to win when they destroy "all" the opposite teams tanks, not just one.
Below is the script. Please help if you can.
Bye
// Blitzschnee
// CONCEPT MAPPING + ARCHITECTURE: Gary Lack (Small Sumo)
// SCRIPTING + AI: ? ? (Wombat)
// SCRIPTING + VEHICLES: Duncan Weir (Scorpio)
// August 2002
//
main:
thread debugtext " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~"
thread debugtext " dam1 "
thread debugtext " **************************************************
*********"
level.debug = 1
thread debugtext "THREAD main"
setcvar "g_obj_alliedtext1" "Destroy/capture the"
setcvar "g_obj_alliedtext2" "enemy parp to win."
setcvar "g_obj_alliedtext3" "Protect your tank."
setcvar "g_obj_axistext1" "Destroy/capture the"
setcvar "g_obj_axistext2" "enemy tank to win."
setcvar "g_obj_axistext3" "Protect your tank."
setcvar "g_scoreboardpic" "blitzschnee"
level.alliedtanks = 2
level.axistanks = 2
level.alliedtank_1alive = 1
level.axistank_2alive = 1
level.alliedtank_2alive = 1
level.axistank_1alive = 1
// **************************************************
****************************
// ************************************* VARS THAT CONTROL THE GAME *************
// setup default vars
// **************************************************
****************************
// **************************************************
****************************
level waittill prespawn
thread debugtext " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~"
thread debugtext " PRESPAWN ! "
thread debugtext " **************************************************
*********"
//*** Precache Dm Stuff
exec global/DMprecache.scr
level.script = maps/dam1.scr
thread debugtext "Loading script: ambient.scr"
exec global/ambient.scr mohdm1
// init the door locked sounds
exec global/door_locked.scr::lock
level waittill spawn
thread debugtext " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~"
thread debugtext " SPAWN ! "
thread debugtext " **************************************************
*********"
// set the parameters for this round/wave based match
level.dmrespawning = 0 // 1 **wave based** or 0 **round based**
level.dmroundlimit = 10 // 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 " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~"
$axistank_2 thread allies_win_tank
$alliedtank_2 thread axis_win_tank
$axistank_1 thread allies_win_tank
$alliedtank_1 thread axis_win_tank
thread debugtext "END THREAD main"
end
spawntanks:
thread debugtext "THREAD spawntanks"
local.alliedbase = spawn script_origin // store the tank position and orientation
local.alliedbase.origin = $alliedtank_1.origin
local.alliedbase.angles = $alliedtank_1.angles
local.alliedbase.targetname = "alliedbase" // setup the axis base, return here when captured enemy tank
$alliedtank_1 thread preptank "allies"
local.alliedbase = spawn script_origin // store the tank position and orientation
local.alliedbase.origin = $alliedtank_2.origin
local.alliedbase.angles = $alliedtank_2.angles
local.alliedbase.targetname = "alliedbase" // setup the axis base, return here when captured enemy tank
$alliedtank_2 thread preptank "allies"
local.axisbase = spawn script_origin // store the tank position and orientation
local.axisbase.origin = $axistank_1.origin
local.axisbase.angles = $axistank_1.angles
local.axisbase.targetname = "axisbase" // setup the axis base, return here when captured enemy tank
$axistank_1 thread preptank "axis"
local.axisbase = spawn script_origin // store the tank position and orientation
local.axisbase.origin = $axistank_2.origin
local.axisbase.angles = $axistank_2.angles
local.axisbase.targetname = "axisbase" // setup the axis base, return here when captured enemy tank
$axistank_2 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.captured = 0
self.destroyed = 0
self.driver = NULL
self.speed = 250
self.maxspeed = self.speed
self vehiclespeed self.speed
self removeondeath 0
self.inuse = 0
self.health = 2000
// 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"
local.bomb = $alliedtankbomb
local.bomb.target = self
local.alliedbomb = spawn script_origin
local.alliedbomb.origin = self.origin
local.bomb.origin = (self.origin + ( -280 0 60)) // move the bomb relative to self
local.bomb bind local.alliedbomb // bind it to parent, so it stays in relative position
local.alliedbomb glue self // glue the parent to self, note this will move the partent to self.origin
}
else
{
local.enemy = "allies"
local.bomb = $axistankbomb
local.bomb.target = self
local.axisbomb = spawn script_origin
local.axisbomb.origin = self.origin
local.bomb.origin = (self.origin + ( -280 0 60)) // move the bomb relative to self
local.bomb bind local.axisbomb // bind it to parent, so it stays in relative position
local.axisbomb glue self // glue the parent to self, note this will move the partent to self.origin
}
if (local.bomb.trigger)
{
local.bombtrigger = spawn script_origin
local.bombtrigger.origin = self.origin
local.bomb.trigger.origin = (self.origin + ( -280 0 60))
local.bomb.trigger bind local.bombtrigger
local.bombtrigger glue self
}
self.team = local.team
self.enemy = local.enemy
local.bomb thread waitfordetonate local.team local.enemy
thread debugtext ("END THREAD preptank = " + self + ", Team that can use this tank = " + local.team)
end
waitfordetonate local.team local.enemy:
thread debugtext ("THREAD waitfordetonate: bomb = " + self + ", attached to tank = " + self.target)
thread debugtext (" team = " + local.team + " , ememy = " + local.enemy)
self model items/pulse_explosive.tik
// local.player = parm.other
// while (local.player == NULL)
// {
// local.player = parm.other
// wait .1
// }
local.bombusefov = 120
local.bombusedistance = 150
local.bombsettime = 20 // 2 seconds
bomb_waittill_set:
thread debugtext ("LOOP bomb_waittill_set: bomb = " + self)
while ((self != NULL) && (self.target!=NULL))
{
thread debugtext ("waitfordetonate: waittill player has triggered " + self.trigger )
self.trigger waittill trigger
thread debugtext ("waitfordetonate: player has triggered " + self.trigger )
local.player = parm.other // get player
//"local.player.dmteam", can be 'spectator', 'freeforall', 'allies' or 'axis'
if (local.player.dmteam != local.enemy)
{
thread debugtext ("waitfordetonate: " + self + " failed dmteam check, player team = " + local.player.dmteam + ", should be " + local.enemy)
wait .1
goto bomb_waittill_set
}
else
thread debugtext ("waitfordetonate: player is on correct team to set bomb = " + self)
local.counter = 0
while ( (Isalive local.player) && (local.player cansee self local.bombusefov local.bombusedistance) && (local.player.useheld == 1) )
{
if (local.counter == 0)
local.player stopwatch (local.bombsettime * .1) // start the stopwatch
local.counter++
wait .1
if (local.counter >= local.bombsettime)
{
thread debugtext ("waitfordetonate: " + self + " has been planted on " + self.target + "!")
iprintlnbold ("A bomb has been planted on " + self.target + "!")
if (level.planting_team == "allies")
self playsound dfr_objective_o
else
self playsound den_objective_o
self.live = 1 // bomb primed
thread bomb_waittill_defuse local.team local.enemy // wait for someone to defuse it
thread bomb_waittill_explode // wait for it to explode
end // end this thread
}
}
if (local.counter > 0)
local.player stopwatch 0 // turn off the stopwatch
wait .1
}
thread debugtext ("waitfordetonate: self = " + self + ", self.target = " + self.target)
thread debugtext ("END THREAD waitfordetonate: bomb = " + self + ", attached to tank = " + self.target)
end
//***********************************************
bomb_waittill_defuse local.team local.enemy:
thread debugtext ("THREAD bomb_waittill_defuse: bomb = " + self + ", attached to tank = " + self.target)
thread debugtext (" team = " + local.team + " , ememy = " + local.enemy)
local.bombusefov = 120
local.bombusedistance = 150
local.bombdefusetime = 20
waittill_defuse:
thread debugtext ("LOOP waittill_defuse: bomb = " + self)
while ((self!=NULL) && (self.target!=NULL))
{
thread debugtext ("waitfordefuse: waittill player has triggered " + self.trigger )
self.trigger waittill trigger
thread debugtext ("waitfordefuse: player has triggered " + self.trigger )
local.player = parm.other // get player
//"local.player.dmteam", can be 'spectator', 'freeforall', 'allies' or 'axis'
if (local.player.dmteam != local.team)
{
thread debugtext ("waitfordefuse: bomb " + self + ", failed dmteam check. player is " + local.player.dmteam + ", should be " + local.team)
wait .1
goto waittill_defuse
}
else
thread debugtext ("waitfordefuse: player is on correct team to defuse bomb = " + self)
local.counter = 0
while ( (Isalive local.player) && (local.player cansee self local.bombusefov local.bombusedistance) && (local.player.useheld == 1) )
{
if (local.counter == 0)
local.player stopwatch (local.bombdefusetime * .1) // start the stopwatch
local.counter++
wait .1
if (local.counter >= local.bombdefusetime)
{
iprintlnbold ("waitfordefuse: A bomb has been defused on " + self.target + "!")
if (level.planting_team == "allies")
self playsound dfr_diffused_d
else
self playsound den_diffused_d
thread waitfordetonate local.team local.enemy //start first thread again
self.live = 0
end
}
}
if (local.counter > 0)
local.player stopwatch 0
wait .1
}
thread debugtext ("bomb_waittill_defuse: self = " + self + ", self.target = " + self.target)
thread debugtext ("END THREAD bomb_waittill_defuse: bomb = " + self + ", attached to tank = " + self.target)
end
//***********************************************
// third thread... times the bomb and makes it explode at the right time
//***********************************************
bomb_waittill_explode:
thread debugtext ("THREAD bomb_waittill_explode: bomb = " + self + ", attached to tank = " + self.target)
self model items/explosive.tik
self playsound plantbomb
self loopsound bombtick
local.time = 0
local.bomb_tick_time = 100
while (local.time < local.bomb_tick_time )
{
wait .1
local.time ++
if (self.live != 1)
{
self stoploopsound
end
}
if (local.time == local.bomb_tick_time - 40 )
{
self stoploopsound
self loopsound final_countdown
}
}
self stoploopsound
local.parent = spawn script_origin // store the tank position and orientation
local.parent.origin = self.origin
local.parent.angles = self.angles
local.parent thread spawn_fx "fx/fx_tank_explosion.tik"
local.parent playsound explode_tank
radiusdamage self.target.origin 500 300 // do the explosion
iprintlnbold ( self.target + "'s engine has been severly damaged.")
self.target vehiclespeed 20
self.target stop
wait 5
local.parent thread spawn_fx "fx/fx_tank_explosion.tik"
local.parent playsound explode_tank
radiusdamage self.target.origin 2100 300 // do the explosion
iprintlnbold ( self.target + " has taken massive damage from sticky bomb.")
self.target vehiclespeed 0
self.target stop
self hide
thread debugtext ("END THREAD bomb_waittill_explode: bomb = " + self + ", attached to tank = " + self.target)
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
tank_health_hud local.team local.player:
thread debugtext ("THREAD: tank_health_hud: = " + self + " for team = " + local.team)
level.subtitleX = 100
level.subtitleY1 = 90
level.subtitleY2 = 70
level.subtitleY3 = 50
local.oldhealth = self.health + 1
local.oldspeed = self.maxspeed + 1
local.starthealth = self.health
while ( (self.destroyed == 0) && (self.inuse == 1) && (IsAlive local.player))
{
if ( (local.starthealth - self.health) >= 500)
{
waitthread getoutoftank local.player
local.player exec global/bullethit.scr (0 -1 0) 1000 50 1
end
}
// if (local.player.dmteam == local.team)
// {
// thread debugtext ("hud: local.team should be = " + local.team + ", and is = " + local.player.dmteam)
local.string = ""
if (local.player.useheld == 1)
{
thread debugtext ("hud: 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) )
{
wait .1
local.time ++
}
thread debugtext ("hud: player held use for " + self + ", for time = " + local.time)
if (local.time <=1)
{
local.distance = vector_length(self.origin - local.player.origin)
thread debugtext ("hud: player is " + local.distance + " units away from " + self)
local.distance = vector_length(self.gun.origin - local.player.origin)
thread debugtext ("hud: player is " + local.distance + " units away from " + self.gun)
if (local.distance < 20)
{
local.oldhealth = self.health + 1
local.oldspeed = self.maxspeed + 1
locprint level.subtitleX level.subtitleY1 ( "Commander asked for report on " + self)
local.string = local.string + ( "Commander asked for report on " + self)
local.string = local.string + "\n"
}
}
}
// else
// thread debugtext ("hud: skipped commander request for " + self + "stats.")
if (local.oldhealth != self.health)
{
thread debugtext ("hud: local.team should be = " + local.team + ", and is = " + local.player.dmteam + " health is " + self.health)
if (self.health>0)
local.damage = 100.0 - ( (self.health/2000.0) * 100.0 )
else
local.damage = 100.0
locprint level.subtitleX level.subtitleY2 ( self + " Health = " + self.health + ", Bodywork sustained " + int (local.damage) + " percent damage")
local.string = local.string + ( self + " Health = " + self.health + ", Bodywork sustained " + int (local.damage) + " percent damage")
local.string = local.string + "\n"
local.oldhealth = self.health
}
// else
// thread debugtext ("hud: skipped health display for " + self)
if (local.oldspeed != self.maxspeed)
{
thread debugtext ("hud: local.team should be = " + local.team + ", and is = " + local.player.dmteam + " speed is " + self.maxspeed)
if (self.maxspeed>0)
local.damage = 100.0 - ( (self.maxspeed/self.speed) * 100.0 )
else
local.damage = 100.0
locprint level.subtitleX level.subtitleY3 ( self + " Max. speed = " + self.maxspeed + ", Engine sustained " + int (local.damage) + " percent damage")
local.string = local.string + ( self + " Max. speed = " + self.maxspeed + ", Engine sustained " + int (local.damage) + " percent damage")
local.string = local.string + "\n"
local.oldspeed = self.maxspeed
}
// else
// thread debugtext ("hud: skipped speed display for " + self)
if (local.string != "")
locprint level.subtitleX level.subtitleY1 local.string
// }
waitframe
}
thread debugtext ("THREAD: tank_health_hud: = " + self + " for team = " + local.team)
end
capturetank local.team local.player:
thread debugtext ("THREAD capturetank = " + self + ", team is = " + local.team)
// local.player = parm.other
if (local.team == "allies")
local.baseorigin = $alliedbase.origin
else
local.baseorigin = $axisbase.origin
iprintlnbold (local.team + " have captured " + self + " and are returning to there base !")
local.windistance = 500
while (IsAlive self)
{
local.distance = vector_length (local.player.origin - local.baseorigin)
if ( (local.distance < local.windistance) )
{
iprintlnbold (local.team + " captured " + self + " and returned it to there base.")
wait 3
if (local.team == "allies")
teamwin allies
else
teamwin axis
}
waitframe
}
thread debugtext ("END THREAD capturetank = " + self + ", team is = " + local.team)
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)
if (self.team == "axis")
self spawnturret 0 "vehicles/axis_kingcannon.tik"
else
self spawnturret 0 "vehicles/allied_kingcannon.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:
thread debugtext ("THREAD allies_win_tank for self = " + self)
while ( 1 )
{
wait 5
if (IsAlive self)
thread debugtext ("allies_win_tank for self = " + self + " is alive")
else
{
thread debugtext ("allies_win_tank for self = " + self + " is dead, allies win")
//teamwin allies
level.axistanks--
if (level.axistanks==0)
{
wait 5
teamwin allies
}
}
}
thread debugtext ("END THREAD allies_win_tank for self = " + self)
end
//*** --------------------------------------------
//*** "Axis Victory"
//*** --------------------------------------------
axis_win_tank:
thread debugtext ("THREAD axis_win_tank for self = " + self)
while ( 1 )
{
wait 5
if (IsAlive self)
thread debugtext ("axis_win_tank for self = " + self + " is alive")
else
{
thread debugtext ("axis_win_tank for self = " + self + " is dead, axis win")
//teamwin axis
level.alliedtanks--
if (level.alliedtanks==0)
{
wait 5
teamwin axis
}
}
}
thread debugtext ("END THREAD axis_win_tank for self = " + self)
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)
local.dam thread spawn_damaged "vehicles/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" 20 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 dam1: " + local.text)
end
help with script please
Moderator: Moderators
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
Just wait for every tank to be destroyed.
axis:
$axistank_1 waittill death
if(isAlive $axistank_2) $axistank_2 waittill death
teamwin allies
end
allies:
$alliedtank_1 waittill death
if(isAlive $alliedtank_2) $alliedtank_2 waittill death
teamwin axis
end
Put references to these threads in your main thread and get rid of all existing win code 8)
axis:
$axistank_1 waittill death
if(isAlive $axistank_2) $axistank_2 waittill death
teamwin allies
end
allies:
$alliedtank_1 waittill death
if(isAlive $alliedtank_2) $alliedtank_2 waittill death
teamwin axis
end
Put references to these threads in your main thread and get rid of all existing win code 8)
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
Hey JV instead of emailing you I thought I would just continue with this thread. I have one question and one favour to ask,
Question, how do I fix the problem with the turret being sean right trough buildings?
A favour. I want a cut down version of the script that has just the info needed to make a tank driveable, get in and outable, fireable and dieable. This would be great.
Mostly I just need the turret issue fixed.
Thanks mate.
Question, how do I fix the problem with the turret being sean right trough buildings?
A favour. I want a cut down version of the script that has just the info needed to make a tank driveable, get in and outable, fireable and dieable. This would be great.
Mostly I just need the turret issue fixed.
Thanks mate.
- small_sumo
- Lieutenant General
- Posts: 953
- Joined: Mon Jul 01, 2002 4:17 pm
- Contact:
Whaaaaat! hehe just kidding, I think I might have read it a thousand times. Ok the turret, your forgiven for not seeing it you need 2 players to get a look at it. Here is a pic of it in action. Just if you would hazard a guess most times you can sniff out the problem ......... you once sugested it might be a shader?? Anyway thanks to you I am going to release 2 maps in quick succession with tanks battles. Eh so what if its glitchy. I have to get these projects done so I can moove on. I will have the bot_bridge map done directly as well. Wont be long now, its gonna be rainin maps lol.


-
Guest
Yeah not my scripting, but anyway I am haveing a fiddle with panzer and tiger. Not much success just yet. Also I will not go near spearhead till the sdk comes. I tried to make a model of a ktiger with a sherman mesh but it crash mohaa 
I will keep yer posted on any success and will make a tut when I egt my head around it.
Bye
I will keep yer posted on any success and will make a tut when I egt my head around it.
Bye
