NPC/Disposition

From Garry's Mod
Jump to: navigation, search
 NPC:Disposition( )

Contents

Description

Returns the way the NPC "feels" about the entity.

Arguments

Entity ent

The entity to get the disposition from.

Returns

number

The NPCs disposition, see D_ Enums.

Examples

Example

If a player is hurt by a friendly NPC, announce it.

function FriendlyFireAnnouncement( ply, atk )
   if atk:IsNPC() and atk:Disposition(ply) == D_LI then --like
      PrintMessage("A "..atk:GetClass().." attacked "..ply:Nick().."!", HUD_PRINTTALK)
   end
end

hook.Add( "PlayerHurt", "FriendlyFire", FriendlyFireAnnouncement )

Output:

Prints "A ____ attacked ____!" to everyones chat.
Personal tools
Navigation