Skip to content

KAI_UniversalFunctions

inkoalawetrust edited this page May 1, 2023 · 1 revision

KAI_UniversalFunctions

This is a mixin class that contains functions and variables that can be used by any actor, including ones not based on KAI_Actor. Currently it just contains code for preventing allies from being harmed by explosions.

Variables:

  • TempAllyList: An array that stores actor pointers to every actor caught by MakeAlliesImmuneToExplosion(). Keeps track of actors that were temporarily given +NORADIUSDMG to remove the flag from them (If it wasn't on already) after the explosion occurs.

Functions

MakeAlliesImmuneToExplosion()

Parameters:

  • Source: The actor that is considered the source of the explosion. Which actors caught in the blast are allies is checked relative to this actor.
  • Radius: The radius in which to prevent friends of the Source from being harmed. This is generally as large as the blast radius itself.

Return type(s):

  • None

Function:

Gives the +NORADIUSDMG flag to any friends of the Source actor that are within the specified radius, unless they have the flag already. If the Source is a non-KAI actor, then hostility is checked with IsHostile(), if Source is a KAI NPC however, it's tested with the IsActorHostile() virtual.

RemoveAllyExplosionImmunity()

Parameters:

  • None

Return type(s):

  • None

Function:

  • Removes +NORADIUSDMG from any actors in the TempAllyList array, and clears the array.

Example

This is an explosion that does not produce friendly fire by calling MakeAlliesImmuneToExplosion() right before A_Explode, then after the explosion runs, calls RemoveAllyExplosionImmunity() to make the allies vulnerable to blast damage again, if they were vulnerable before.

				MakeAlliesImmuneToExplosion (Target, 128);
				A_Explode (96,128,XF_EXPLICITDAMAGETYPE,True,32,damagetype:'Explosive');
				RemoveAllyExplosionImmunity();
Clone this wiki locally