This routine was pinched from a BreakThrough MP obj map that I modded some time ago, the routine was an existing one in the existing scr. I have looked over it countless times and it still dosn't make sense to me.
Could some script guru's have a look and explain in simplistic step by step terms how it is supposed to switch spawns over?
Check to see if you have enities with the targetname axisspawn or alliesspawn if not end
if(!($axisspawn) || !($alliedspawn))
End
// local.axis is the number of entities with the targetname axisspawn
local.axis = $axisspawn.size //local.allies is the number of entities with the targetname alliedspawn
local.allies = $alliedspawn.size if there are more $axisspawn then $alliedspawn do this
if(local.axis > local.allies)
{ // do a for loop from 1 to then number of $alliedspawn
for(local.a = 1; local.a <= local.allies; local.a++)
{ // save the origin of the $axisspawn number local.a
local.temporigin = $axisspawn[local.a].origin // save the angles of the $axisspawn number local.a
local.tempangles = $axisspawn[local.a].angles // move the origin of $axisspawn[local.a] to the origin of $alliedspawn[local.a]
$axisspawn[local.a].origin = $alliedspawn[local.a].origin // give the angles of $axisspawn[local.a] the angles of $alliedspawn[local.a]
$axisspawn[local.a].angles = $alliedspawn[local.a].angles
// move the $alliedspawn[local.a] to the coords of $axisspawn[local.a] that where saved at the start of the loop befor $axisspawn[local.a] was moved
$alliedspawn[local.a].origin = local.temporigin // give the $alliedspawn[local.a] the angles of $axisspawn[local.a] that where saved at the start of the loop
$alliedspawn[local.a].angles = local.tempangles
} // these two lines disable the extra $axisspawn spawnpoints if there are more of them than $alliedspawn spawnpoints
for(local.b = local.allies + 1; local.b <= local.axis; local.b++)
$axisspawn[local.a] disablespawn
} This next part is the same only the other way around
else
{
for(local.a = 1; local.a <= local.axis; local.a++)
{
local.temporigin = $axisspawn[local.a].origin
local.tempangles = $axisspawn[local.a].angles
$axisspawn[local.a].origin = $alliedspawn[local.a].origin
$axisspawn[local.a].angles = $alliedspawn[local.a].angles
Wow thanks BD, that's exactly the type of response I was after! The disableling of spawns was one thing that had me stumped, also let me get this right.....
// local.axis is the number of entities with the targetname axisspawn
local.axis = $axisspawn.size
Is this looking at the actual info_player spawn object or is it looking for an actual player spawning in it? This is my other problem.. to me it is only looking at the actual info_player spawn entities, not the players themselves. ? is that correct? If so then this routine will never work if both sides have the same number of spawn locations.. ??
Grassy
An ambiguous question will get a similar answer...
$axisspawn is the targetname of the axis spawnpoints info_player_axis and yes it will run because if the first thing is not true
if(local.axis > local.allies)
....
else
....
then the second part after the else will run the only thing that will make it end is
if(!($axisspawn) || !($alliedspawn))
if(not($axisspawn) or not($alliedspawn))
if one of those is true in other words if there are no axis spawnpoints with the targetname $axisspawn or no allied spawn points with the targetname $alliedspawn then the script just ends to avoid errors , just make sure to use those targetnames for the spawnpoints .