logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Issue #69. Potentially missing call to SetEnemy in state ScriptedPawn.TriggerAlarm (Read 105 times)
Masterkent
Developer Team
Offline



Posts: 1258
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Issue #69. Potentially missing call to SetEnemy in state ScriptedPawn.TriggerAlarm
Mar 25th, 2019 at 4:17pm
Print Post  
When a ScriptedPawn is in state TriggerAlarm and reaches the target pawn, pursuing the target pawn may be finished by calling Touch

Code
Select All
	function Touch(actor Other)
	{
		if (Other == OrderObject)
			AlarmDone();
	}
 


without calling Bump

Code
Select All
	function Bump(actor Other)
	{
		local vector VelDir, OtherDir;
		local float speed;

		if ( Health <= 0 || bDeleteme )
			return;
		if (Other == OrderObject)
		{
			AlarmDone();
			if ( (Pawn(Other) != None) && SetEnemy(Pawn(Other)) )
				GotoState('MeleeAttack');
			return;
		} 


which is supposed to try to set the reached pawn as the new enemy. For example, on level Ruins, there is a SkaarjScout with mission to kill the Nali which opens the secret door. Sometimes, this Skaarj fails to accomplish his goal because of the aforementioned issue:
https://www.youtube.com/watch?v=D_x5sc-JfuA

Suggested resolution:

Define ScriptedPawn.TriggerAlarm.Touch as follows:

Code
Select All
	function Touch(actor Other)
	{
		if (Other == OrderObject)
		{
			AlarmDone();
			if (IsAlivePawn(Pawn(Other)))
				SetEnemy(Pawn(Other));
		}
	} 


where IsAlivePawn is new suggested function defined as

Code
Select All
final static function bool IsAlivePawn(Pawn Pawn)
{
	return bool(Pawn) && !Pawn.bDeleteMe && Pawn.Health > 0;
} 


in Engine.Actor.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo