Spoiler
Code: Select all
function bool RestartPlayer( pawn aPlayer )
{
local NavigationPoint startSpot, NewSpot;
local bool foundStart, bCollisionWarning, bNewSpotBusy;
local Pawn P, Ps, Mp;
if ( MonsterReplicationInfo2(GameReplicationInfo).bUseLive )
{
if( bRestartLevel && Level.NetMode!=NM_DedicatedServer && Level.NetMode!=NM_ListenServer )
return true;
if ( aPlayer.PlayerReplicationInfo.Deaths < 1 )
{
BroadcastMessage(aPlayer.PlayerReplicationInfo.PlayerName$" has been lost!", true, 'MonsterCriticalEvent');
For ( P=Level.PawnList; P!=None; P=P.NextPawn )
{
if ( P != None && P.PlayerReplicationInfo != None && (P.PlayerReplicationInfo.Deaths >= 1) )
P.PlayerReplicationInfo.Deaths += 0.00001;
}
if ( aPlayer.IsA('Bot') )
{
aPlayer.PlayerReplicationInfo.bIsSpectator = true;
aPlayer.PlayerReplicationInfo.bWaitingPlayer = true;
aPlayer.GotoState('GameEnded');
return false;
}
}
startSpot = FindPlayerStart(None, 255);
if( startSpot == None )
return false;
//------- Screwing a bit because looks stupid - AddOn March 05-06 2016
if (bStartMatch)
log (aPlayer.GetHumanName()@is seeking a startSpot.);
foreach startSpot.RadiusActors(class'Pawn',Ps,22)
{
if ( Ps != aPlayer )
{
if (bStartMatch)
log (startSpot.Name@has a nearby Pawn > @Ps.GetHumanName());
startSpot.taken = True;
bCollisionWarning = True;
}
if ( bCollisionWarning )
{
if (bStartMatch)
log( "Telefrag danger at "$startSpot.Name$" as long as "$aPlayer.GetHumanName()$" attempts using that spot too." );
break;
}
}
if (!bCollisionWarning)
{
if (bStartMatch)
log (aPlayer.GetHumanName()@attempts spawning at@startSpot.Name);
startSpot.taken = True;
}
if ( bCollisionWarning )
{
foreach startSpot.RadiusActors(class'NavigationPoint',NewSpot,500)
{
if (bStartMatch)
log ("Testing a New spot"@NewSpot.Name);
bNewSpotBusy = False;
foreach NewSpot.RadiusActors(class'Pawn',Mp,22)
{
if ( Mp != aPlayer )
{
if (bStartMatch)
log ( NewSpot.Name@has in range@Mp.GetHumanName());
bNewSpotBusy = True;
break;
}
}
if (!bNewSpotBusy)
{
startSpot = NewSpot;
startSpot.Taken = True;
if (bStartMatch)
log (aPlayer.GetHumanName()@will be moved at@NewSpot.Name);
break;
}
}
}
//----------- End of AddOn March 05-06 2016
foundStart = aPlayer.SetLocation(startSpot.Location);
if( foundStart )
{
startSpot.PlayTeleportEffect(aPlayer, true);
aPlayer.SetRotation(startSpot.Rotation);
aPlayer.ViewRotation = aPlayer.Rotation;
aPlayer.Acceleration = vect(0,0,0);
aPlayer.Velocity = vect(0,0,0);
aPlayer.Health = aPlayer.Default.Health;
aPlayer.ClientSetRotation( startSpot.Rotation );
aPlayer.bHidden = false;
aPlayer.DamageScaling = aPlayer.Default.DamageScaling;
aPlayer.SoundDampening = aPlayer.Default.SoundDampening;
if ( aPlayer.PlayerReplicationInfo.Deaths < 1 )
{
aPlayer.bHidden = true;
aPlayer.PlayerRestartState = 'PlayerSpectating';
}
else
{
aPlayer.SetCollision( True, False, False );
AddDefaultInventory(aPlayer);
}
}
return foundStart;
}
else
return Super.RestartPlayer(aPlayer);
}
Spoiler
ScriptLog: ME is seeking a startSpot.
ScriptLog: ME attempts spawning at PlayerStart4
ScriptLog: Sarena is seeking a startSpot.
ScriptLog: PlayerStart2 has a nearby Pawn > Visse
ScriptLog: Telefrag danger at PlayerStart2 as long as Sarena attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: PlayerStart1 has in range Necroth
ScriptLog: Testing a New spot PlayerStart2
ScriptLog: PlayerStart2 has in range Visse
ScriptLog: Testing a New spot PlayerStart4
ScriptLog: PlayerStart4 has in range ME
ScriptLog: Testing a New spot A_PathNode0
ScriptLog: Sarena will be moved at A_PathNode0
ScriptLog: Archon is seeking a startSpot.
ScriptLog: PlayerStart3 has a nearby Pawn > Raynor
ScriptLog: Telefrag danger at PlayerStart3 as long as Archon attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: PlayerStart1 has in range Necroth
ScriptLog: Testing a New spot PlayerStart3
ScriptLog: PlayerStart3 has in range Raynor
ScriptLog: Testing a New spot PlayerStart4
ScriptLog: PlayerStart4 has in range ME
ScriptLog: Testing a New spot A_PathNode1
ScriptLog: Archon will be moved at A_PathNode1
ScriptLog: Liche is seeking a startSpot.
ScriptLog: PlayerStart3 has a nearby Pawn > Raynor
ScriptLog: Telefrag danger at PlayerStart3 as long as Liche attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: PlayerStart1 has in range Necroth
ScriptLog: Testing a New spot PlayerStart3
ScriptLog: PlayerStart3 has in range Raynor
ScriptLog: Testing a New spot PlayerStart4
ScriptLog: PlayerStart4 has in range ME
ScriptLog: Testing a New spot A_PathNode1
ScriptLog: A_PathNode1 has in range Archon
ScriptLog: Testing a New spot InventorySpot2
ScriptLog: Liche will be moved at InventorySpot2
ScriptLog: Necroth is seeking a startSpot.
ScriptLog: PlayerStart3 has a nearby Pawn > Raynor
ScriptLog: Telefrag danger at PlayerStart3 as long as Necroth attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: Necroth will be moved at PlayerStart1
ScriptLog: Arachne is seeking a startSpot.
ScriptLog: PlayerStart3 has a nearby Pawn > Raynor
ScriptLog: Telefrag danger at PlayerStart3 as long as Arachne attempts using that spot too.
ScriptLog: Testing a New spot PlayerStart1
ScriptLog: PlayerStart1 has in range Necroth
ScriptLog: Testing a New spot PlayerStart3
ScriptLog: PlayerStart3 has in range Raynor
ScriptLog: Testing a New spot PlayerStart4
ScriptLog: PlayerStart4 has in range ME
ScriptLog: Testing a New spot A_PathNode1
ScriptLog: A_PathNode1 has in range Archon
ScriptLog: Testing a New spot InventorySpot2
ScriptLog: InventorySpot2 has in range Liche
ScriptLog: Testing a New spot InventorySpot3
ScriptLog: Arachne will be moved at InventorySpot3
ScriptLog: Visse is seeking a startSpot.
ScriptLog: Visse attempts spawning at PlayerStart2
ScriptLog: Raynor is seeking a startSpot.
ScriptLog: Raynor attempts spawning at PlayerStart3
ScriptLog: MH_A_V1.MonsterHunt game-mod has been initialized and started
ScriptLog: Detected TickRate at 30
ScriptLog: Tick interval is around 33 ms.
Edit: No worries for Maps with 1 Playerstart and Nothing else around, enjoy your death in retarded empty cubes if pathing is not your way. I'm no longer using any trash with 0 options. So to speak everything must be good if exist PathNodes, Weapons Ammo, around PlayerStarts.
Potential Bugs: See teleporters around and avoid them - it's your turn.
Edit2:
Not a super duper update but V2 can spawn some additional starting option (at least 5 Starts in Levels with 1 start). It's a nonsense to put such a map for 1 player in servers addressing 6+ players. However we might have teams took in account and depending on locations new spots are available. Adding spots should stop if number of locations are already 16 (they can be more - depending on Level...)
EDIT: V3 can be downloaded from this page... viewtopic.php?f=15&t=11350&start=15#p98642