I've finished some map where I placed in small spots little tiny small... PoliteNode. They have the following code:
Code: Select all
class PoliteNode expands NavigationPoint;
var() int RadiusCheck;
var bool bCloserPlayer, bCloserMonster;
event PostBeginPlay()
{
if (RadiusCheck <= 0)
{
log (Self.Name@">> bork::RadiusCheck = 0. Please refrain from doing trash.");
RadiusCheck = 512;
}
}
function Actor SpecialHandling(Pawn Other)
{
bCloserMonster = False;
bCloserPlayer = False;
if ( Bot(Other) != None && Bot(Other).Health > 0 )
{
// log (Self.Name@"SpecialHandling");
if ( Bot(Other).Enemy != None )
return Self;
CheckNearbySouls( Other );
if ( bCloserPlayer )
{
// log ("None for"@Other.GetHumanName());
Bot(Other).MoveTarget = None;
Other.ClearPaths();
Bot(Other).GoToState('Wandering');
return None;
}
if ( bCloserMonster )
{
// log ("Enemy for"@Other.GetHumanName());
return Self;
}
return Self;
}
return Self;
}
final function CheckNearbySouls( Pawn Checker )
{
local Pawn P;
if ( Checker == None )
{
bCloserMonster = False;
bCloserPlayer = False;
return;
}
foreach RadiusActors( class 'Pawn', P, RadiusCheck, Location )
{
if ( P == Checker )
continue;
if ( P.bIsPlayer && P.Health > 0 && !P.bHidden && P.Mesh != None )
{
if (VSize(Checker.Location-Location) > VSize(P.Location-Location))
{
bCloserPlayer = True;
break;
}
}
if ( !P.bIsPlayer && P.Health > 0 && !P.bHidden && P.Mesh != None )
{
Checker.Enemy = P;
bCloserMonster = True;
break;
}
}
// log (Self.Name@"Grant bCloserMonster ="@bCloserMonster@"and bCloserPlayer ="@bCloserPlayer);
}
defaultproperties
{
RadiusCheck=380
Style=STY_Translucent
Texture=Texture'UnrealShare.S_Message'
DrawScale=0.700000
bCollideWhenPlacing=False
CollisionRadius=20.000000
CollisionHeight=42.000000
}
When a player or a Bot is closer to this Node than a Bot roamer, Bot active seeker would go wander if it's not called in combat more exactly when doesn't have any enemy or else it moves ahead or back (retreat if needed) because permission to pass it's accepted.
Chapter 1)
Default UT with default MonsterHunt - everything works like a charm - of course Bot in combat has no mother and no father;
But 90% I'm comfortable to not see them bunching and blocking my moves when I'm about to retreat - there are reasons for that.
Chapter 2)
XC_Engine 24b game server and XC_MonsterHunt - it works between certain rooms NOT everywhere, and it's the same instance in the same spot - like totally ignoring that SpecialHandling. Here Bot can figure enemy or simply that distance check return some funky result - in the same MAP.
That check is similar to SetEnemy, the closer is next one. This means even SetEnemy goes screwed here if such a simple check is flawed.
I'm not sure how many problems has map because it should be aligned. I removed some useless bytes trying to gain it more clean as possible.