SetFriendPlayer

From ZDoom Wiki
Jump to navigation Jump to search

Actor

native void SetFriendPlayer(PlayerInfo player)

Usage

Sets the calling actors' friendplayer field, which contains the number of the player the actor is supposed to be friendly to. Keep in the mind that changing an actors' friendplayer is only really relevant in multiplayer games.

Parameters

  • PlayerInfo Player
Pointer to the PlayerInfo of the specific player to the set the actors' friendplayer to.

Examples

This Imp is friendly to players. But will defect to whichever player pressed use on him.

class DefectingImp : DoomImp replaces DoomImp
{
	Default
	{
		+FRIENDLY
	}

	override bool Used (Actor user)
	{ 		
		if (user && user.player)
		{
			SetFriendPlayer (user.player);
		}
		
		return Super.Used(user);
	}
}