Additionally, it seems odd that you can build a team of mutually friendly monsters that would otherwise hate each other (e.g. SkaarjBerserkers + Titan), but you cannot make a friendly team consisting of ScriptedPawns that would ignore each other by default (e.g. SkaarjWarrior + Krall). Two ScriptedPawns that share the same TeamTag are supposed to be friends who ignore damage from each other and may attack enemies of allies, but this works only for ScriptedPawns that would hate each other without grouping.
Both issues have a common reason: a friendly creature is assigned to ScriptedPawn.Hated (see functions ScriptedPawn.Trigger and ScriptedPawn.damageAttitudeTo) that makes ScriptedPawn.AttitudeTo return ATTITUDE_Hate. Hence there are two ways to resolve them: either by suppressing all unreasonable assignments to Hated or by tweaking AttitudeTo. I'd suggest the latter approach:
In class UnrealShare.ScriptedPawn, replace
Code: Select all
function eAttitude AttitudeTo(Pawn Other)
{
if( Other==None )
return ATTITUDE_Ignore;
else if( Other.bIsPlayer )
{
if ( bIsPlayer && Level.Game.bTeamGame && (Other.PlayerReplicationInfo != none) && (Team == Other.PlayerReplicationInfo.Team) )
return ATTITUDE_Friendly;
else if ( (Intelligence > BRAINS_None) &&
((AttitudeToPlayer == ATTITUDE_Hate) || (AttitudeToPlayer == ATTITUDE_Threaten)
|| (AttitudeToPlayer == ATTITUDE_Fear)) ) //check if afraid
{
if (RelativeStrength(Other) > Aggressiveness)
AttitudeToPlayer = AttitudeWithFear();
else if (AttitudeToPlayer == ATTITUDE_Fear)
AttitudeToPlayer = ATTITUDE_Hate;
}
return AttitudeToPlayer;
}
else if (Hated == Other)
{
if (RelativeStrength(Other) >= Aggressiveness)
return AttitudeWithFear();
else
return ATTITUDE_Hate;
}
else if ( (TeamTag != '') && (ScriptedPawn(Other) != None) && (TeamTag == ScriptedPawn(Other).TeamTag) )
return ATTITUDE_Friendly;
else
return AttitudeToCreature(Other);
}
Code: Select all
function EAttitude AttitudeTo(Pawn Other)
{
local EAttitude Attitude;
if( Other==None )
return ATTITUDE_Ignore;
else if( Other.bIsPlayer )
{
if ( bIsPlayer && Level.Game.bTeamGame && (Other.PlayerReplicationInfo != none) && (Team == Other.PlayerReplicationInfo.Team) )
return ATTITUDE_Friendly;
else if ( (Intelligence > BRAINS_None) &&
((AttitudeToPlayer == ATTITUDE_Hate) || (AttitudeToPlayer == ATTITUDE_Threaten)
|| (AttitudeToPlayer == ATTITUDE_Fear)) ) //check if afraid
{
if (RelativeStrength(Other) > Aggressiveness)
AttitudeToPlayer = AttitudeWithFear();
else if (AttitudeToPlayer == ATTITUDE_Fear)
AttitudeToPlayer = ATTITUDE_Hate;
}
return AttitudeToPlayer;
}
else if ( (TeamTag != '') && (ScriptedPawn(Other) != None) && (TeamTag == ScriptedPawn(Other).TeamTag) )
return ATTITUDE_Friendly;
else
{
Attitude = AttitudeToCreature(Other);
if (Attitude == ATTITUDE_Frenzy || Attitude >= ATTITUDE_Friendly || Hated != Other)
return Attitude;
if (RelativeStrength(Other) >= Aggressiveness)
return AttitudeWithFear();
else
return ATTITUDE_Hate;
}
}