For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Issue #40. Common ScriptedPawn bugs related to attacking friendly creatures

Report bugs, read about fixes, new features and ask questions about the Unreal 227 patch here. Place comments and commit suggestions.
Post Reply
User avatar
Masterkent
OldUnreal Member
Posts: 1469
Joined: Fri Apr 05, 2013 12:41 pm

Issue #40. Common ScriptedPawn bugs related to attacking friendly creatures

Post by Masterkent »

When two ScriptedPawns are initially friendly to each other and one of them triggers the other, the triggered pawn considers the instigator as an enemy and attacks it. The attacked pawn still preserves friendly attitude towards the attacker, and this looks a bit silly: A similar behavior (not related to bIsPlayer) also appears on ExtremeCore.

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);
}
with

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;
      }
}
This also eliminates possible transitions from ATTITUDE_Frenzy to ATTITUDE_Fear that are not supposed to happen (ATTITUDE_Frenzy is intended to be a fearless analog of ATTITUDE_Hate).
Last edited by Masterkent on Sun Dec 18, 2016 6:06 pm, edited 1 time in total.
Post Reply

Return to “Unreal 227”