IsFriend

From ZDoom Wiki
Jump to navigation Jump to search

Actor

native clearscope bool IsFriend(Actor other) const

Usage

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

Parameters

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

Return values

The function performs a sequence of checks based on game mode:

In team deathmatch, the function returns true if ANY of the below conditions are met:
  • other is the calling actor's teammate
  • The calling actor and other are allied to different players, but those players are teammates (the allied players are determined by the value of the actors' FriendPlayer fields)
If none of the conditions are met, returns false.
In other game modes, the function returns true if ANY of the below conditions are met:
  • The game mode is NOT deathmatch
  • Both the calling actor and other are allied to the same player (determined by the value of their FriendPlayer fields)
  • The calling actor is not allied to any players (its FriendPlayer field is 0)
  • The other actor is not allied to any players (its FriendPlayer field is 0)
  • The calling actor and other are allied to different players, but those players 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 false.

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