Have you tried checking the console (scroll up near top)? You'll find the offending code that will be breaking the script.
I did notice you had some parts that broke it e.g. 'thread debugtext' because there was no debugtext thread in the code. Make sure the script is loading as everything else will be failing (e.g. flags not hiding etc).
Should
Code:
init_objectives:
$Obj_pole1.ControlledBy == 2)
$Obj_pole2.ControlledBy == 2)
$Obj_pole3.ControlledBy == 2)
$Obj_pole4.ControlledBy == 2)
end
Be
Code:
init_objectives:
$Obj_pole1.ControlledBy = 2
$Obj_pole2.ControlledBy = 2
$Obj_pole3.ControlledBy = 2
$Obj_pole4.ControlledBy = 2
end
And even then, ControlledBy is readonly so it can't be set. Do you need this thread?
You need to populate the 'level.gametype' variable too:
Code:
//If this is a tug of war game then we init all the TOW stuff
level.gametype = int( getcvar( g_gametype ) )
if( level.gametype == 5 )
{
//init the objectives
//thread init_objectives
//Setup the team objectives
thread set_objectives
level.bRoundStarted = 1
}
For set_objectives you can use a loop if you wish, but not required:
Code:
set_objectives:
for (local.i=1;local.i;local.i++)
{
local.flagpole = $("Obj_pole" + local.i)
if !(local.flagpole == NULL)
{
local.controlledby = local.flagpole.ControlledBy
switch (local.controlledby)
{
case 0:
local.flagpole SetCurrent 0 //do these need swapping? e.g. .ControlledBy == 0 so SetCurrent = 1 ???
case 1:
local.flagpole SetCurrent 1
}
}
else
break
}
end
Just to confirm, the 'obj_flagpoles' are func_TOWObjectives?