I've been converting the Enemy Territory map to Spearhead and it's almost done...apart
form one or two little bits of scripting.
I have a working script but just need to add two things but I don't know
how to...so any help greatfully recieved.
Firstly the allies have to repair a tank.
I have a trigger use around the tank and when the allies use it
off the tank goes as it should.
I would like the player to have to hold the use key for 10 seconds with
a stopwatch counting down,with a 'reparing tank' message and then
a 'tank repaired' message before the tank moves...like when planting
a bomb in OBJ.
I've looked at how it's done in the dm_obj.scr and I just don't get how to
fit that into my script.
Secondly is the putting the crate on the truck.
When the ally player steals the crate I want only that player to be able
to put the crate on the truck.
If he dies the crate resets so it can be collecetd again.
I've modifed the undervocer script and it works but I just can't get it
to recognise the player with the crate.
Thirdly destroying the getaway truck.
I've given it a health value so when it gets shot it disappears.
how do I add an explsion to this, bearing in mind that the origin
of the truck is changing as it is in motion?
I've posted my complete script below so any help would be appreciated.
Code: Select all
main:
exec global/ai.scr
exec global/friendly.scr
setcvar "g_obj_alliedtext1" "Repair The Tank"
setcvar "g_obj_alliedtext2" "Steal The Crate"
setcvar "g_obj_alliedtext3" "Steal The Truck"
setcvar "g_obj_axistext1" "Stop The Aliies"
setcvar "g_obj_axistext2" "Stealing The Crate"
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "obj_goldrush"
level waittill prespawn
exec global/ambient.scr
thread global/exploder.scr::main
level.script = "maps/obj/obj_sh_goldrush.scr"
level.targets_to_destroy = 1
level.music = mohdm7
level.allieshascrate = 0
level waittill spawn
level.defusing_team = "axis"
level.planting_team = "allies"
level.bomb_damage = 200
level.bomb_explosion_radius = 1024
level.clockside = axis
$tank_speaker loopsound king_snd_idle
$truck_speaker loopsound opeltruck_snd_idle
$truck vehicleanim idlenolights
$truck health 1000
$tank nodamage
$tank speed 128
$crate_on_truck hide
$truck_clip bind $truck
$truck_speaker bind truck
$tank_speaker bind $tank
$bankdoor_destroyed hide
$bankwall_destroyed hide
level waittill roundstart
thread axis_win_timer
thread allies_get_crate
thread tank
thread truck
thread tank_bridge
thread tank_courtyard
thread escape
end
/////////////////////////////
// Steal the crate //
///////////////////////////
allies_get_crate:
$crate_trigger waittill trigger
local.player = parm.other
if (local.player.dmteam == "axis")
{
local.player iprint "You cannot use this!"
goto allies_get_crate
}
if ((local.player.dmteam == "allies") && (level.allieshascrate == 0))
$crate hide
$crate_trigger hide
iprintlnbold_noloc "The Allies have stolen the crate!"
local.thief = parm.other
{
local.thief iprint "Take the crate to the truck!"
level.allieshascrate++
while(level.allieshascrate>0)
{
if ((!isAlive local.thief)||(local.thief.dmteam !=allies))
{
level.allieshascrate--
println "[player local.thief died] level.allieshascrate = :" level.allieshascrate
$crate show
$crate_trigger show
thread allies_get_crate
break
}
wait 1
}
}
goto allies_get_crate
end
/////////////////////////////////////
// Put crate on the truck //////
///////////////////////////////////
truck:
$truck_trigger waittill trigger
local.player = parm.other
if (local.player.dmteam == "axis")
{
local.player iprint "You cannot use this!"
goto truck
}
if ((local.player.dmteam == "allies") && (level.allieshascrate == 1))
{
$truck_speaker stop loopsound
wait .1
$truck_speaker playsound opeltruck_snd_on
$crate_on_truck show
$crate_on_truck bind $truck
level.targets_destroyed++
iprintlnbold_noloc "The Truck is escaping!"
iprintlnbold_noloc "Stop the truck!!"
$truck vehicleanim idlelights
//wait 1
$truck_speaker loopsound opeltruck_snd_run
$truck drive $truckwap1
$truck waittill drive
wait 25
$truck stop
$truck_speaker stop loopsound
end
}
end
//////////////////////
// TANK Thread //
////////////////////
tank:
$tank_trigger waittill trigger
local.player = parm.other
if (local.player.dmteam == "axis")
{
local.player iprint "You must stop the Allies stealing this!"
goto tank
}
if (local.player.dmteam == "allies")
{
$tank setcollisionentity self.target // Set the tank collision mask
$tank stop loopsound
wait .1
$tank loopsound tank_snd_on
//wait 10
iprintlnbold_noloc "The Tank has been stolen!"
$tank drive $wap1
$tank waittill drive
$tank stop
$tank stop loopsound
wait 2
$tank.gun = $tank QueryTurretSlotEntity 0
$tank.gun setAimTarget $tank_target
$tank.gun waittill ontarget
wait 2
$tank.gun startFiring
wait .1
local.Exp1 = spawn "animate/fx_explosion_tank.tik"
local.Exp1.origin = $exp_origin
local.Exp1 playsound explode_tank
local.Exp1 anim start
$tank.gun stopFiring
$bankdoor_destroyed show
$bankwall_destroyed show
wait 1
local.Exp2 = spawn "animate/fx_explosion_flak88.tik"
local.Exp2.origin = $tank_target2
local.Exp2 playsound explode_tank
local.Exp2 anim start
$bankdoor remove
$bankwall remove
local.Exp1 anim stop
local.Exp1 remove
local.Exp2 anim stop
local.Exp2 remove
end
}
end
/////////////////////////
// Axis victory test //
///////////////////////
axis_win_timer:
level waittill axiswin
end
/////////////////////////////
// Vehicle marker threads //
///////////////////////////
escape:
$truck_escape_trigger waittill trigger
teamwin allies
end
tank_bridge:
$tank_bridge_trigger waittill trigger
iprintlnbold_noloc "The Tank is on the bridge!"
end
tank_courtyard:
$tank_courtyard_trigger waittill trigger
iprintlnbold_noloc "The Tank is approaching the courtyard!"
end

