Crash on Nali.AdjustHitLocation()

Discussions about Coding and Scripting
Post Reply
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Crash on Nali.AdjustHitLocation()

Post by Barbie »

Recently the server crashed with
NaliSB MH-NekonekoHouse.NaliSB42 (Function UnrealShare.Nali.AdjustHitLocation:0000) Infinite script recursion (250 calls) detected
(AdjustHitLocation is not overwritten in "NaliSB", only Killed())
FYI NaliSB.uc

Code: Select all

class NaliSB extends Nali;

function Killed(pawn Killer, pawn Other, name damageType)
{
	if ((Nali(Other) != None) && Killer != None && Killer.bIsPlayer)
		AttitudeToPlayer = ATTITUDE_Fear;
	Super(ScriptedPawn).Killed(Killer, Other, damageType);
}


defaultproperties {
	MenuName="Nali"
}
So I had a look at the stock code for Nali.AdjustHitLocation() but there is no loop and I did not find any UC function call in there.
Stock code of Nali.AdjustHitLocation

Code: Select all

function bool AdjustHitLocation(out vector HitLocation, vector TraceDir)
{
	local float adjZ, maxZ;

	TraceDir = Normal(TraceDir);
	HitLocation = HitLocation + 0.5 * CollisionRadius * TraceDir;

	if ( (GetAnimGroup(AnimSequence) == 'Ducking') && (AnimFrame > -0.03) )
	{
		if ( AnimSequence == 'Bowing' )
			maxZ = Location.Z - 0.2 * CollisionHeight;
		else
			maxZ = Location.Z + 0.25 * CollisionHeight;
		if ( HitLocation.Z > maxZ )
		{
			if ( TraceDir.Z >= 0 )
				return false;
			adjZ = (maxZ - HitLocation.Z)/TraceDir.Z;
			HitLocation.Z = maxZ;
			HitLocation.X = HitLocation.X + TraceDir.X * adjZ;
			HitLocation.Y = HitLocation.Y + TraceDir.Y * adjZ;
			if ( VSize(HitLocation - Location) > CollisionRadius )	
				return false;
		}
	}
	return true;
}
Why an infinite script recursion can occur there? Or does the error message mean that that function is called more than 250 times in a row?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Post Reply