IsHostile

From ZDoom Wiki
Jump to navigation Jump to search

Actor

native clearscope bool IsHostile(Actor other) const

Usage

Checks if the calling actor is hostile to the other actor. This is meant to be run on monsters to determine their allegiance.

This is not a direct opposite of IsFriend, since the set of checks is slightly different.

Parameters

  • Actor other
Pointer to the actor, whose allegiance should be compared to.

Return values

If neither the calling actor, nor the other actor has the FRIENDLY flag, the function returns false. They can still become hostile to each other under specific conditions, the infighting rules allow it.

If at least one of the actors has the FRIENDLY the function performs a sequence of checks, similar to the inverted IsFriend:

In team deathmatch, the function returns false if ANY of the below conditions are met:
  • The calling actor and other are teammates
  • The calling actor and other are allied players who are teammates (the allied players are determined by the value of the actors' FriendPlayer fields)
In other game modes, the function returns false if ANY of the below conditions are met:
  • The game mode is NOT deathmatch
  • The calling actor and other are allied to the same player
  • The calling actor and other are allied players who are teammates (the allied players are determined by the value of the actors' FriendPlayer fields)

If none of the above mentioned conditions were met, the function returns true.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.


See also