Page 1 of 1
test post
Posted: Thu Nov 25, 2004 6:02 am
by tltrude
Having trouble posting code. I tried to post the entire multiplayer script for the mp_bridge_inv map for study, but I get a fatal error that says it took longer than 30 seconds. This post is working, so my guess is that this forum can't handle large amounts of code yet. I will try a smaller amount.
Code: Select all
// if developer mode is on, start when anyone
// enters the game.
if (int (getcvar developer))
waitthread wait_for_anyone
// otherwise start when there is at least 1
// person on each team.
else
level waittill roundstart
end
//-----------------
wait_for_anyone:
//-----------------
// this thread terminates when anyone has selected a
// team and before their weapon is selected.
// spin loop here until at least 1 player has
// joined a team.
while (1)
{
for (local.i=1; local.i<=$player.size; local.i++)
{
if ($player[local.i].dmteam == "axis" || $player[local.i].dmteam == "allies")
end
}
waitframe
}
end
That is from the script, I did not add any comments of my own. I think they have added this so we don't have to comment out "level waittill roundstart" anymore, to test objective (invasion) scripts!
Posted: Thu Nov 25, 2004 4:23 pm
by jv_map
Yay the test is a succes

.. how big is the code (how many lines) that is giving you the error?
lines
Posted: Thu Nov 25, 2004 6:26 pm
by tltrude
I think it is about a thousand lines, if you include the blank ones. Sounds like a lot, but that looks to be fairly typical for mohpa multiplayer scripts.
Posted: Thu Nov 25, 2004 7:13 pm
by Surgeon
Can u break the code up ? I have some stuff explaining the basics of a script from EA - again I have to hunt it down
internet
Posted: Thu Nov 25, 2004 8:20 pm
by tltrude
Maybe is was just my internet connection running slow (I have ADSL), I'll try again.
Code: Select all
// ---------------------------------------------------------------------------
// mp_bridge_inv
//
// Mission 6 for MOHPA invader game type
//
// Level scripted by ccaron for TKO-software 3/2004
//
// 05.26.04 scosgrave added tutorials and time announcements
//
// ---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////
//
// Cutscene Variables!
//
// cutscene_wait_after_fadeout:
// This is how long we wait while the screen is black
//
// cutscene_wait_after_fadein:
// This is how long we wait after the fadein happens to start doing our explosion stuff
//
// cutscene_wait_before_hiding_idle_bridge:
// This is how long the newest gr2 will be shown before we swap in the animating bridge and make it explode
//
// cutscene_wait_for_anim_time:
// this is how long we'll wait for the bridge animation to run before swapping
// in the static destroyed model
//
// cutscene_wait_after_swap:
// this is how long we stick around soaking up the abmience after the swap has
// happened, before we fade out
//
level.cutscene_wait_after_fadeout = 2.5
level.cutscene_wait_after_fadein = 0.0
//level.cutscene_wait_before_hiding_idle_bridge = 0.00
level.cutscene_wait_for_anim_time = 6.5
level.cutscene_wait_after_swap = .10
//
//////////////////////////////////////////////////////////////////////////////////
// Init level variables
// the axis are the attackers in this map (set to zero for
// axis attackers)
level.gametype = int( getcvar( g_gametype ) )
level.alliedAttackers = 0
level.attackers = "axis"
level.defenders = "allies"
level.spawnSetCount = 4 // no. of spawn point groups in this map
level.script = maps/dm/mp_bridge_inv.scr
level.dm_mgMaxHealth = 2100
level.explosiveFuseTime = 30
level.explosiveArmTime = 10
level.explosiveDisarmTime = 5
level.explosion_trigger = spawn trigger_multiple
level.dmroundlimit = int( getcvar( "timelimit" ) )
//level.current_objective = 1
level.music = "bridge"
level HUDMap 185 290 355 166 -2693 -5321 4857 -395
setcvar "com_inv_obj_1" "-2677 -5884"
setcvar "com_inv_obj_2" "2802 -5073"
setcvar "com_inv_obj_3" "4443 -752"
setcvar "com_inv_obj_4" "279 1194"
level.RailcarExplosiveFuseTime = 30 // amount of fuse time on the railcar
if (level.gametype != 0)
exec global/mp_auto.scr
setcvar "g_scoreboardpic" "mp_jabbott_inv"
if (level.gametype == 6) {
// invader game initialization
waitthread init_objectives
exec global/mp_invader.scr
}
else if (level.gametype == 1) {
level.reuseInvaderSpawns = 0
exec global/mp_ffa.scr
} else {
level.reuseInvaderSpawns = 0
exec global/mp_teamdeathmatch.scr
}
if (level.gametype > 2)
level.clockside = allies // set to axis, allies, kills, or draw
// DScott: post-fx values must be set BEFORE prespawn
// default effect modifiers
setcvar "dm_def_cc_sat" ".8"
setcvar "dm_def_cc_add" ".00 0.0 -0.027"
setcvar "dm_def_cc_mul" ".712 .603 .603"
setcvar "dm_def_mono_blur" "0.0"
level waittill prespawn
thread global/mp_invader.scr::init_init_spawn_set
exec global/mp_sunflare.scr
level waittill spawn
exec global/mp_fx.scr
exec global/mp_ambience.scr
// made the victory flythrough null so that we continue to look at the fallen bridge
level.cameraPathObjWin[1] = "obj1_path"
level.cameraPathObjWin[2] = "obj2_path"
level.cameraPathObjWin[3] = "obj3_path"
level.cameraPathObjWin[4] = "obj4_path"
level.cameraPathObjFail[1] = "obj1_path"
level.cameraPathObjFail[2] = "obj2_path"
level.cameraPathObjFail[3] = "obj3_path"
level.cameraPathObjFail[4] = "obj4_path"
level.cameraPathVictory = NULL
level.cameraPathFlythrough = "victory_path"
exec global/camerafly.scr
if (level.gametype == 0)
end
// create dialog queues for each team, no matter which gametype it is
level.alliesDialogQueue = thread global/mp_dialog_queue.scr::initialize "allies"
level.axisDialogQueue = thread global/mp_dialog_queue.scr::initialize "axis"
// start time announcements playing on the dialog queues
thread global/mp_announcements.scr::initialize level.dmroundlimit level.gametype level.axisDialogQueue level.alliesDialogQueue
// start tutorial
thread global/mp_tutorial.scr::player_tutorial
waitthread global/mp_guns.scr::init_model92 16
waitthread global/mp_guns.scr::init_model92 10
waitthread global/mp_guns.scr::init_model92 101
waitthread global/mp_guns.scr::init_model92 102
waitthread global/mp_guns.scr::init_model92 105
waitthread global/mp_guns.scr::init_model92 106
//setting the objective turrent health to be different than other MG health
//it should now take about 11 grenades to blow the MG
$model92_10_turret0.brinkOfDeathHealth = 2100
//Also setting it's ammo higher.
$model92_10_turret0 internalammo 90 45 level.dm_mgSupplyMaxCount level.dm_mgSupplyCount
// don't let the actual MG get hurt by bullets, grenades, etc, that is what the hurt trigger is for
$model92_10_turret0 immune bullet fast_bullet bash impale
$model92_10_turret0 immune shotgun aagun bulletlarge
waitthread global/mp_guns.scr::activate_model92 16
waitthread global/mp_guns.scr::activate_model92 10
waitthread global/mp_guns.scr::activate_model92 101
waitthread global/mp_guns.scr::activate_model92 102
waitthread global/mp_guns.scr::activate_model92 105
waitthread global/mp_guns.scr::activate_model92 106
for (local.i=1; local.i<=100; local.i++)
{
local.mg = $("mg" + local.i)
if (local.mg != NIL && local.mg != NULL)
{
local.turret = $("mg"+ local.i + "_turret0")
local.turret.set = local.mg.set
local.mg thread init_mg local.turret
}
}
exec global/mp_pointy_fence.scr
// START THE MUSIC
//exec global/mp_ambient_explosions.scr
local.string = ("music/" + level.music + ".mus")
soundtrack local.string
dprintln ("playing " + local.string)
forcemusic normal normal
// init the objective items, needed for all game types
// so that mp_destroyable::remove works correctly
waitthread init_objective_items
if( level.gametype == 6 )
{
exec global/mp_flags.scr
exec global/mp_medic_tent.scr
//waitthread wait_for_anyone
// if developer mode is on, start when anyone enters the game
if (int (getcvar developer))
waitthread wait_for_anyone
else // otherwise start when there is at least 1 person on each team
level waittill roundstart
// --------------------------------
// OBJECTIVES BEGIN
// --------------------------------
level.regularSpawning = 0
thread switch_to_regular_spawnpoints
trigger level.startObjTrigger[1]
waitthread doObj1
if(level.regularSpawning)
waitthread global/mp_invader.scr::progress_spawn_set 2
waitthread global/mp_invader.scr::progress_objectives
trigger level.startObjTrigger[2]
waitthread doObj2
if(level.regularSpawning)
waitthread global/mp_invader.scr::progress_spawn_set 3
waitthread global/mp_invader.scr::progress_objectives
trigger level.startObjTrigger[3]
waitthread doObj3
if(level.regularSpawning)
waitthread global/mp_invader.scr::progress_spawn_set 4
waitthread global/mp_invader.scr::progress_objectives
trigger level.startObjTrigger[4]
waitthread doObj4
// wait for a few seconds
//wait 5
// end the game
waitthread global/mp_invader.scr::progress_objectives
}
else
{
// obj1
$obj1_occupy_trigger nottriggerable
// obj2
$model92_10_turret0 waitthread global/mp_destroyable.scr::remove 0
$obj3_barrier waitthread global/mp_destroyable.scr::remove 1
// obj3
$obj3_occupy_trigger nottriggerable
// obj4
$obj4_bomb1_destroyable waitthread global/mp_destroyable.scr::remove 1
$obj4_bomb2_destroyable waitthread global/mp_destroyable.scr::remove 1
$obj4_plunger remove
$obj4_plunger_trigger nottriggerable
}
end
//-----------------
wait_for_anyone:
//-----------------
// this thread terminates when anyone has selected a team and
// before their weapon is selected.
// spin loop here until at least 1 player has joined a team
while (1)
{
for (local.i=1; local.i<=$player.size; local.i++)
{
if ($player[local.i].dmteam == "axis" || $player[local.i].dmteam == "allies")
end
}
waitframe
}
end
//-----------------
switch_to_regular_spawnpoints:
//-----------------
wait 20
level.regularSpawning = 1
switch (level.currentObjective)
{
case 1:
waitthread global/mp_invader.scr::progress_spawn_set 1
break
case 2:
waitthread global/mp_invader.scr::progress_spawn_set 1
waitthread global/mp_invader.scr::progress_spawn_set 2
break
case 3:
waitthread global/mp_invader.scr::progress_spawn_set 1
waitthread global/mp_invader.scr::progress_spawn_set 2
waitthread global/mp_invader.scr::progress_spawn_set 3
break
case 4:
waitthread global/mp_invader.scr::progress_spawn_set 1
waitthread global/mp_invader.scr::progress_spawn_set 2
waitthread global/mp_invader.scr::progress_spawn_set 3
waitthread global/mp_invader.scr::progress_spawn_set 4
break
default:
dprintln "bad obj number for switch from _init spawn points"
break
}
end
//-----------------
init_objective_items:
//-----------------
// obj2
$model92_10_turret0.showObjectiveStatus = 1
$model92_10_turret0.objectiveStatusName = "BRIDGE:Obj2StatusName"
$model92_10_turret0.destroyType = "built_in"
$model92_10_turret0.destroyAnim = "models/fx/m2fgrenadeexplosion_nodamage.tik"
$model92_10_turret0 waitthread global/mp_destroyable.scr::init $obj2_trigger_hurt NULL $obj2bomb level.script::obj2_callback level.alliedAttackers level.script::bomb_armed level.script::bomb_disarmed 15 level.explosiveArmTime level.explosiveDisarmTime
// obj3
$obj3_barrier_d hide
$obj3_barrier_d notsolid
$obj3_barrier.showObjectiveStatus = 0
$obj3_barrier.destroyType = "fx"
$obj3_barrier.destroyAnim = "models/fx/hellcat_bomb_explosion.tik"
$obj3_barrier waitthread global/mp_destroyable.scr::init $obj3_barricade_damage NULL $obj3_barricade_bomb level.script::obj3_barrier_explode level.alliedAttackers level.script::bomb_armed level.script::bomb_disarmed 15 level.explosiveArmTime level.explosiveDisarmTime
// obj4
local.bomb1 = $obj4_explosive_trigger1.target
local.bomb2 = $obj4_explosive_trigger2.target
local.fxOrigin1 = local.bomb1.origin
local.fxOrigin2 = local.bomb2.origin
// setting these internal fields disables the bombtick functionality in mp_defuse_bomb
local.bomb1.usePlunger = 1
local.bomb2.usePlunger = 1
// needed a temp destroyable object to make objective status work
local.destroyableBomb1 = spawn script_origin
local.destroyableBomb1 targetname "obj4_bomb1_destroyable"
local.destroyableBomb1.origin = local.bomb1.origin
local.destroyableBomb1.angles = local.bomb1.angles
local.destroyableBomb1.showObjectiveStatus = 1
// needed a temp destroyable object to make objective status work
local.destroyableBomb2 = spawn script_origin
local.destroyableBomb2 targetname "obj4_bomb2_destroyable"
local.destroyableBomb2.origin = local.bomb2.origin
local.destroyableBomb2.angles = local.bomb2.angles
local.destroyableBomb2.showObjectiveStatus = 1
waitthread init_explosive $obj4_explosive_trigger1 0 local.destroyableBomb1
waitthread init_explosive $obj4_explosive_trigger2 0 local.destroyableBomb2
end
//----------------------------------------------------------------------------
test_flythrough local.path:
//-----------------
//wait 5
//dprintln "Doing the flythrough"
local.cam = spawn func_camera
cuecamera local.cam
while (1) {
waitthread global/camerafly.scr::camera_flyby local.path local.cam
}
cueplayer
end
//----------------------------------------------------------------------------
init_mg local.turret:
//-----------------
dprintln "mg classname = " self.classname
dprintln "mg turret classname = " local.turret.classname
dprintln "init " self " with turret " local.turret
// self refers to the base
if (local.turret == NIL || local.turret == NULL)
end
local.turret target self.target
local.turret userdistance 128
//local.turret thread global/mp_guns.scr::init_mg
self thread global/mp_guns.scr::init_mg_base
end
//----------------------------------------------------------------------------
doObj1:
//-----------------
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_off_obj1_stmt 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:br_off_obj1_stmt"
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj1_stmt 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj1_stmt"
// clear the objective status text
waitthread global/mp_objective_status.scr::clear
waitthread global/mp_invader.scr::set_objective_position $obj1_occupy_trigger.origin
$obj1_occupy_trigger waitthread global/mp_occupation.scr::init level.attackers 10 "BRIDGE:Obj1Name" level.script::obj1_completed_callback NULL 0 0 level.script::obj1_occupied // TODO : put a dialog sound here
$obj1_occupy_trigger setthread global/mp_occupation.scr::occupation
spawn trigger_relay targetname "obj1_relay_trigger"
$obj1_relay_trigger waittill trigger
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_off_obj1_ach 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:br_off_obj1_ach"
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj1_fail 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj1_fail"
// allow bigtext to be read, and not clobbered by the next bigtext
wait 5
end
//-----------------
obj1_occupied:
//-----------------
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj1_atk 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj1_atk"
end
//-----------------
obj1_completed_callback:
//-----------------
trigger $obj1_relay_trigger
end
//----------------------------------------------------------------------------
doObj2:
//-----------------
// Destroy river defensive gun
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_off_obj2_stmt 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:br_off_obj2_stmt"
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj2_stmt 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj2_stmt"
// clear the objective status text
waitthread global/mp_objective_status.scr::clear
waitthread global/mp_invader.scr::set_objective_position $obj2bomb_trigger.origin
$model92_10_turret0 thread global/mp_destroyable.scr::activate
wait 1
level.explosion_trigger waittill trigger
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_off_obj2_ach 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:br_off_obj2_ach"
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj2_fail 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj2_fail"
// allow bigtext to be read, and not clobbered by the next bigtext
wait 5
end
//----------------------------------------------------------------------------
doObj3:
//-----------------
//let the players know the next objective
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_off_obj3_stmt 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:br_off_obj3_stmt"
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj3_stmt 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj3_stmt"
// clear the objective status text
waitthread global/mp_objective_status.scr::clear
// Set the compass to point at the occupy trigger
waitthread global/mp_invader.scr::set_objective_position $obj3_occupy_trigger.origin
$obj3_barrier thread global/mp_destroyable.scr::activate
// init the occupy trigger
spawn trigger_relay targetname "obj3_relay_trigger"
$obj3_occupy_trigger waitthread global/mp_occupation.scr::init level.attackers 15 "BRIDGE:Obj3Name" level.script::obj3_completed_callback NULL 0 0 level.script::obj3_occupied // TODO : put a dialog sound here
$obj3_occupy_trigger setthread global/mp_occupation.scr::occupation
// init the railcar
//$switch_railcar_paths thread wait_for_path_switch_trigger $railcar_primary_path $railcar_secondary_path
// init the railcar
//exec maps/dm/railcar_logic.scr
//thread railcar_manager
// wait for the trigger to get tripped
$obj3_relay_trigger waittill trigger
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_off_obj3_ach 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:DENJP_7_3_ACHV_JPS02"
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog DFRUS_7_3_FAIL_RS002 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:DFRUS_7_3_FAIL_RS002"
// allow bigtext to be read, and not clobbered by the next bigtext
wait 5
end
//----------------------------------------------------------------------------
obj3_barrier_explode:
//----------------------------------------------------------------------------
$obj3_barrier_d show
$obj3_barrier_d solid
// dont play, it indicates players are in the yard, when they might not be
//level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj3_fail 5
// local.barrier = spawn script_model model "models/MP_Bridge/manmade/trn_barricade_d.gr2"
// local.barrier.origin = $obj3_barrier.origin
// local.barrier.angles = $obj3_barrier.angles
end
//-----------------------------------------------------------------------------
wait_for_path_switch_trigger local.primary local.secondary:
//dprintln "Hit the use key inside the shack to switch tracks"
level.currentSwitch = local.primary
while (1)
{
self waittill trigger
self playsound plantbomb
dprintln "The Railcar switch has been thrown!"
if (level.currentSwitch == local.primary)
{
level.currentSwitch = local.secondary
$obj3_track_section3 anim switch_left
$obj3_track_section3 waittill animdone
}
else
{
level.currentSwitch = local.primary
$obj3_track_section3 anim switch_right
$obj3_track_section3 waittill animdone
}
dprintln "switching railcar path too " level.currentSwitch
wait 2.0
}
end
//-----------------
obj3_occupied:
//-----------------
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj3_fail 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj3_fail"
end
//-----------------
obj3_completed_callback:
//-----------------
trigger $obj3_relay_trigger
end
//----------------------------------------------------------------------------
doObj4:
//-----------------
// Axis must plant 2 explosive on the bridge and then detonate them with the plunger
// the explosives cannot be detonated until both explosives are planted
// clear the objective status text
waitthread global/mp_objective_status.scr::clear
//$obj4_plunger.showObjectiveStatus = 1
//$obj4_plunger.objectiveStatusName = "Bridge"
$obj4_plunger.objStatus = waitthread global/mp_objective_status.scr::general_objective_add_item $obj4_plunger "BRIDGE:PlungerNotReady" "BRIDGE:PlungerReady"
//let the players know the next objective
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_off_obj4_stmt 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:br_off_obj4_stmt"
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj4_stmt 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj4_stmt"
$obj4_bomb1_destroyable thread global/mp_destroyable.scr::activate
$obj4_bomb2_destroyable thread global/mp_destroyable.scr::activate
thread plunger_check
$obj4_plunger_trigger setthread plunger_trigger_thread
spawn trigger_relay targetname "obj4_relay_trigger"
// scan the explosives to make sure the compass points to
// the explosives or the plunger
thread do_obj4_compass
$obj4_relay_trigger waittill trigger
//request by Yogi for this release (-scosgrave 6-24-04)
thread remove_bridge_props
// play dialog saying the bridge is gonna blow for Allies
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog DFRUS_7_4_FAIL_RS002 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:DFRUS_7_4_FAIL_RS002"
waitthread bridge_cutscene
// play dialog saying the bridge has fallen for the Axis
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog DENJP_7_4_ACHV_JPS02 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:DENJP_7_4_ACHV_JPS02"
end
//-----------------
plunger_check:
//-----------------
local.notificationHappened = 0
while(1)
{
//if both bombs are armed
if ($obj4_explosive_trigger1.bombPlanted == 1 && $obj4_explosive_trigger2.bombPlanted == 1)
{
//if we haven't been notified theat we're ready for hot plunger action
if(local.notificationHappened == 0)
{
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_off_obj4_ach 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:br_off_obj4_ach"
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog DFRUS_7_4_ACHV_RS001 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:DFRUS_7_4_ACHV_RS001"
local.notificationHappened = 1
}
}
else
{
//both bombs aren't active so either we've never been notified, or we'll need to be notified again.
local.notificationHappened = 0
}
waitframe
}
end
//-----------------
bridge_cutscene:
//-----------------
fadeout 2.0 0 0 0 1
wait level.cutscene_wait_after_fadeout
local.hud = int( getcvar( ui_hud ) )
if( local.hud )
{
drawhud 0
setcvar "ui_hud" "0"
}
local.obj2 = spawn script_object
//set camera properties
local.cam = spawn func_camera
local.cam.origin = (920 590 1697)
local.cam.angles = (15 137 0)
local.cam showquakes 1
//angle calculation stuff for an origin (not needed anymore)
//look at the bridge
//local.v = angles_toforward $obj4_cam.angles
//local.o = local.cam.origin + local.v * 100
//local.obj2.origin = local.o
//local.idleBridge = spawn script_model model "models/mp_bridge/manmade/Bridge_AllinOne_d.gr2"
//local.idleBridge.origin = $obj4_bridge.origin
//local.idleBridge.angles = $obj4_bridge.angles
$obj4_bridge hide
//switch view to camera while we are faded out
level.view = "camera"
cuecamera local.cam
fadein 2.0 0 0 0 1
wait level.cutscene_wait_after_fadein
local.fxOrigin1 = $obj4_explosive_trigger1.origin
local.fxOrigin2 = $obj4_explosive_trigger2.origin
//make the bridge blow up
local.bridgeExplFX = models/fx/bridge_explosion1.tik
local.bridgeExplFX = models/fx/bridge_explosion2.tik
//kill people on bridge so that we can see them go flying
//right now this is actually making them not take damage
waitthread kill_bridge_goers
// make radius damage starting at fx origin, with radius of 500, causing gradually decreasing damage of 2000
waitthread global/mp_fx.scr::spawn_fx local.fxOrigin1 local.bridgeExplFX 1.2 //boom!
thread global/mp_extra.scr::playsound_team satchel_charge_explo01 axis
thread global/mp_extra.scr::playsound_team satchel_charge_explo01 allies
radiusdamage local.fxOrigin1 2000 500 0 //people go flying
level earthquake 0.090 0.090 0 0 local.fxOrigin1 1024 //rumble!
//thread global/vfx.scr::oneshotfx_nodelete local.bridgeFireFX local.fxOrigin1 //bridge on fire
thread global/mp_extra.scr::playsound_team satchel_charge_explo01 axis
thread global/mp_extra.scr::playsound_team satchel_charge_explo01 allies
waitthread global/mp_fx.scr::spawn_fx local.fxOrigin1 local.bridgeExplFX 1.2 //some more fx
wait level.cutscene_wait_before_hiding_idle_bridge
local.destroyedBridge = spawn script_model model "models/mp_bridge/manmade/Bridge_Destroyed.hag"
local.destroyedBridge.origin = $obj4_bridge.origin
local.destroyedBridge.angles = $obj4_bridge.angles
$obj4_bridge hide
$obj4_bridge notsolid
$obj4_bridge remove
local.destroyedBridge anim explode
local.destroyedBridge notsolid
waitthread global/mp_fx.scr::spawn_fx local.fxOrigin2 local.bridgeExplFX 1.2
radiusdamage local.fxOrigin2 2000 500 0
level earthquake 0.090 0.090 0 0 local.fxOrigin2 1024
//thread global/vfx.scr::oneshotfx_nodelete local.bridgeFireFX local.fxOrigin2
waitthread global/mp_fx.scr::spawn_fx local.fxOrigin2 local.bridgeExplFX 1.2
//local.destroyedBridge waittill animdone
//wait for big ol' explosion animation to happen
wait level.cutscene_wait_for_anim_time
//spawn the static bridge
local.staticDestroyedBridge = spawn script_model model "models/mp_bridge/manmade/Bridge_AllinOne_Rubble.hag" origin local.destroyedBridge.origin angles local.destroyedBridge.angles
local.staticDestroyedBridge notsolid
local.destroyedBridge hide
//just chill and look at it all before fading out
wait level.cutscene_wait_after_swap
if( local.hud )
{
drawhud 1
setcvar "ui_hud" "1"
}
end
//-----------------
kill_bridge_goers:
//-----------------
//keep them alive for now
for( local.i = 1; local.i <= $player.size; local.i++ )
{
if( $player[local.i] isinside $bridge_death )
{
$player[local.i] hurt 9999
}
else
$player[local.i] nodamage
}
end
//-----------------
plunger_trigger_thread local.player:
//-----------------
// called by setthread when a player enters the trigger
// self is the trigger multiple
//if there's not enough bombs, or the player in the trigger isn't supposed to blow up the bridge
if ($obj4_explosive_trigger1.bombPlanted != 1 || $obj4_explosive_trigger2.bombPlanted != 1 || local.player.dmteam != "axis")
end
self nottriggerable
while (isalive local.player && !local.player.incapacitated && !local.player.isspectator && local.player isinside self)
{
local.player useslot "plunger"
if (local.player.useheld == 1)
{
trigger $obj4_relay_trigger
$obj4_plunger anim depress
local.player removeuseslot "plunger"
wait 2 // allow anim to play
end
}
waitframe
}
local.player removeuseslot "plunger"
self triggerable
end
//-----------------
do_obj4_compass:
//-----------------
while (level.currentObjective == 4)
{
if ($obj4_explosive_trigger1.bombPlanted != 1)
{
waitthread global/mp_invader.scr::set_objective_position $obj4_explosive_trigger1.origin
$obj4_plunger.objStatus thread global/mp_objective_status.scr::general_item_not_threatened
}
else if ($obj4_explosive_trigger2.bombPlanted != 1)
{
waitthread global/mp_invader.scr::set_objective_position $obj4_explosive_trigger2.origin
$obj4_plunger.objStatus thread global/mp_objective_status.scr::general_item_not_threatened
}
else
{
waitthread global/mp_invader.scr::set_objective_position $obj4_plunger_trigger.origin
$obj4_plunger.objStatus thread global/mp_objective_status.scr::general_item_threatened
}
wait 0.5
}
dprintln "ending compass thread"
end
//-----------------
remove_bridge_props:
//-----------------
for( local.i = 1; local.i <= $obj4_remove_me.size; local.i++ )
$obj4_remove_me[local.i] remove
end
//----------------------------------------------------------------------------
init_objectives:
//-----------------
level.attackerObjective[1] = "BRIDGE:OffenseObj1"
level.attackerObjective[2] = "BRIDGE:OffenseObj2"
level.attackerObjective[3] = "BRIDGE:OffenseObj3"
level.attackerObjective[4] = "BRIDGE:OffenseObj4"
level.attackerObjective[5] = ""
level.defenderObjective[1] = "BRIDGE:DefenseObj1"
level.defenderObjective[2] = "BRIDGE:DefenseObj2"
level.defenderObjective[3] = "BRIDGE:DefenseObj3"
level.defenderObjective[4] = "BRIDGE:DefenseObj4"
level.defenderObjective[5] = ""
end
//-----------------------------------------------------------------------------
init_explosive local.trigger local.showUpOnRadar local.destroyable:
//-----------------
// self is unused
// local.trigger is the proximity trigger
// local.trigger.target is the bomb
// local.trigger.target.target is the object to be destroyed
dprintln "Initializing explosive " local.trigger
if (level.gametype < 6)
{
local.trigger.target.target remove
local.trigger.target remove
local.trigger remove
end
}
local.bomb = local.trigger.target
if (local.bomb == NIL || local.bomb == NULL)
{
dprintln "Explosive trigger " local.trigger " does not target its bomb!"
end
}
local.bomb.showUpOnRadar = local.showUpOnRadar
local.bomb settutorial use_explosive 500
local.object = local.bomb.target
if (local.object == NIL || local.object == NULL)
dprintln "Explosive charge " local.bomb " does not target object to destroy!"
local.trigger.object = local.object
local.bomb.target = local.trigger
local.destroyable waitthread global/mp_destroyable.scr::init NULL NULL local.bomb level.script::bomb_explodes level.alliedAttackers level.script::bomb_armed level.script::bomb_disarmed level.explosiveFuseTime level.explosiveArmTime level.explosiveDisarmTime
end
//------------------
bomb_armed local.player:
//------------------
thread global/mp_message.scr::all_objective_message "INVADER:PlayerArmedBomb" local.player.netname_noloc
if( level.currentObjective == 2 )
{
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj2_atk 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj2_atk"
}
else if( level.currentObjective == 4 )
{
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog DFRUS_7_4_STRD_RS001 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:DFRUS_7_4_STRD_RS001"
}
end
//------------------
bomb_disarmed local.player:
//------------------
thread global/mp_message.scr::all_objective_message "INVADER:PlayerDisarmedBomb" local.player.netname_noloc
if( level.currentObjective == 4 )
{
wait 5
// apparently this means the Allies defused a charge:
level.alliesDialogQueue thread global/mp_dialog_queue.scr::queue_dialog br_def_obj4_fail 5
thread global/mp_bigtext.scr::post_bigtext "allies" "SUBTITLE:br_def_obj4_fail"
// tell the Axis a charge was defused
level.axisDialogQueue thread global/mp_dialog_queue.scr::queue_dialog DENJP_7_4_FAIL_JPS01 5
thread global/mp_bigtext.scr::post_bigtext "axis" "SUBTITLE:DENJP_7_4_FAIL_JPS01"
}
end
//------------------
barricade_bomb_armed local.player:
//------------------
thread global/mp_message.scr::all_objective_message "INVADER:PlayerArmedBomb" local.player.netname_noloc
end
//------------------
barricade_bomb_explodes:
//------------------
dprintln "barricade bomb explode, self: " self
// spawn some smoke
//for (local.i=0; local.i<4; local.i++)
//{
// local.rand = (0 0 0)
// local.rand[0] = 100 - (randomfloat 200)
// local.rand[1] = 100 - (randomfloat 200)
// local.rand[2] = 100 - (randomfloat 200)
// self.object thread delayed_spawn_fx models/emitters/plane_smoke.tik
// wait (1 + randomfloat 2)
//}
//self.object.destroyed = 1
//self.object.target remove
//self.object remove
//self.bomb remove
//self remove
//trigger level.explosion_trigger
end
//------------------
bomb_explodes:
//------------------
// self refers to the trigger
// self.bomb is the bomb
// self.object is object to destroy
if( self.object != NIL && self.object != NULL && self.object)
self.object.destroyed = 1
//dprintln "bomb_explodes"
//dprintln "self = " self
//dprintln "self.object = " self.object
//dprintln "self.object.destroyed = " self.object.destroyed
trigger level.explosion_trigger
self thread delayed_spawn_fx models/emitters/explosion_tank.tik
// spawn some smoke
for (local.i=0; local.i<4; local.i++)
{
local.rand = (0 0 0)
local.rand[0] = 100 - (randomfloat 200)
local.rand[1] = 100 - (randomfloat 200)
local.rand[2] = 100 - (randomfloat 200)
if( self )
{
if( self.object != NIL && self.object != NULL && self.object)
self.object thread delayed_spawn_fx models/emitters/plane_smoke.tik
}
wait (1 + randomfloat 2)
}
end
//------------------
obj2_callback:
//------------------
$model92_10_ammo remove
trigger level.explosion_trigger
//self thread bomb_explodes
end
//-----------------------------------------------------------------------------
delayed_spawn_fx local.fx:
//------------------
local.origin = self.origin
wait (0.1 + (randomfloat(1)))
local.temp = spawn script_model model local.fx
local.temp notsolid
local.temp.origin = local.origin
local.temp anim start
local.temp notsolid
local.temp waittill animdone
local.temp remove
end
error
Posted: Thu Nov 25, 2004 8:26 pm
by tltrude
Here is the error I get.
Fatal error: Maximum execution time of 30 seconds exceeded in /z/www/map/cgi-bin/mohaa/forum/includes/functions_search.php on line 62
The script (mp_bridge_inv.scr) is in the Pak5.rez file. If you extract it with the rez utility, it will automatticaly go into the main/maps/dm folder.
Posted: Thu Nov 25, 2004 8:29 pm
by jv_map
Hmm just a wild guess culprit might be the world filter... your code seems to have been posted successfully though

... hold on I'll disable the word filter in a few seconds - if you don't mind waiting see if you still get this error
Edit: ok, disabled

hmmm
Posted: Thu Nov 25, 2004 8:33 pm
by tltrude
That's funny, it posted it and gave me the error page too! Didn't do that last time. Anyway, now people can at least see what an MOHPA multiplayer script looks like.
I noticed that the thread title "main:" is missing! TKO must of forgot to add it.
I don't see the point of posting it again because it showed up with the word filter on.
Posted: Sat Dec 04, 2004 5:21 am
by HDL_CinC_Dragon
Lol i got MOH:PA for my birthday on wednesday (it is now 20 minutes into Saturday. me = lifeless) and i found that that i only have 254 total RAM (not 256 total which is weird) and MOH:PA has a minimum requirement of 512

so i kinda went on Ebay and baught a gig of RAM from Canada. I should be set for a while. anywho, just thought id express my excitement and funny story in an already off-topic-ish thread so that way i techincally wouldnt be spamming... dont hurt me...
Posted: Sun Dec 05, 2004 7:46 pm
by MasterMind
lol
