NPC (22)

All currently available hooks that are found in Carbon. Most hooks would be ones compatible with Oxide, although there are Carbon-only ones as well.

  • Called when a NPC attempts to eat another entity.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches BaseNpc.WantsToEat of Assembly-CSharp.dll.

Example
object CanNpcEat(BaseNpc self)
{
    Puts("CanNpcEat was called!");
    return (bool) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is Carbon-only compatible.

  • Patches BaseAIBrain.SwitchToState of Assembly-CSharp.dll.

Example
object OnAIBrainStateSwitch(BaseAIBrain self, BaseAIBrain self1, BaseAIBrain.BasicAIState newState)
{
    Puts("OnAIBrainStateSwitch was called!");
    return (bool) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is Carbon-only compatible.

  • Patches BaseAIBrain.SwitchToState of Assembly-CSharp.dll.

Example
void OnAIBrainStateSwitched(BaseAIBrain self, BaseAIBrain self1)
{
    Puts("OnAIBrainStateSwitched was called!");
}

This hook requires OnAIBrainStateSwitch, which loads alongside OnAIBrainStateSwitched.

  • Called when an NPC player corpse is about to be populated with loot.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches HumanNPC.CreateCorpse of Assembly-CSharp.dll.

Example
object OnCorpsePopulate(HumanNPC self, NPCPlayerCorpse local1)
{
    Puts("OnCorpsePopulate was called!");
    return (BaseCorpse) null;
}
  • Called when an NPC player corpse is about to be populated with loot.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches FrankensteinPet.CreateCorpse of Assembly-CSharp.dll.

Example
object OnCorpsePopulate(FrankensteinPet self, NPCPlayerCorpse local1)
{
    Puts("OnCorpsePopulate was called!");
    return (BaseCorpse) null;
}
  • Called when an NPC player corpse is about to be populated with loot.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ScarecrowNPC.CreateCorpse of Assembly-CSharp.dll.

Example
object OnCorpsePopulate(ScarecrowNPC self, NPCPlayerCorpse local2)
{
    Puts("OnCorpsePopulate was called!");
    return (BaseCorpse) null;
}
  • Called when an NPC player corpse is about to be populated with loot.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches GingerbreadNPC.CreateCorpse of Assembly-CSharp.dll.

Example
object OnCorpsePopulate(GingerbreadNPC self, NPCPlayerCorpse local2)
{
    Puts("OnCorpsePopulate was called!");
    return (BaseCorpse) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ScientistNPC.Alert of Assembly-CSharp.dll.

Example
object OnNpcAlert(ScientistNPC self)
{
    Puts("OnNpcAlert was called!");
    return (object) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches BaseNpc.StartAttack of Assembly-CSharp.dll.

Example
object OnNpcAttack(BaseNpc self, BaseNpc self1)
{
    Puts("OnNpcAttack was called!");
    return (object) null;
}
  • Called right after a player has ended an NPC conversation.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches NPCTalking.OnConversationEnded of Assembly-CSharp.dll.

Example
void OnNpcConversationEnded(NPCTalking self)
{
    Puts("OnNpcConversationEnded was called!");
}
  • Called when a player chooses an NPC conversation response.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches NPCTalking.Server_ResponsePressed of Assembly-CSharp.dll.

Example
object OnNpcConversationRespond(NPCTalking self, BasePlayer local0, ConversationData local3, ConversationData.ResponseNode local4)
{
    Puts("OnNpcConversationRespond was called!");
    return (object) null;
}
  • Called right after a player's chosen NPC conversation response has been processed.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches NPCTalking.Server_ResponsePressed of Assembly-CSharp.dll.

Example
void OnNpcConversationResponded(NPCTalking self, BasePlayer local0, ConversationData local3, ConversationData.ResponseNode local4)
{
    Puts("OnNpcConversationResponded was called!");
}

This hook requires OnNpcConversationRespond, which loads alongside OnNpcConversationResponded.

  • Called when a player tries to start a conversation with an NPC.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches NPCTalking.Server_BeginTalking of Assembly-CSharp.dll.

Example
object OnNpcConversationStart(NPCTalking self, BasePlayer ply, ConversationData local0)
{
    Puts("OnNpcConversationStart was called!");
    return (object) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches HumanNPC.SetDucked of Assembly-CSharp.dll.

Example
object OnNpcDuck(HumanNPC self)
{
    Puts("OnNpcDuck was called!");
    return (object) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ScientistNPC.EquipWeapon of Assembly-CSharp.dll.

Example
object OnNpcEquipWeapon(ScientistNPC self, Item local1)
{
    Puts("OnNpcEquipWeapon was called!");
    return (object) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches NPCPlayer.EquipWeapon of Assembly-CSharp.dll.

Example
object OnNpcEquipWeapon(NPCPlayer self, Item local0)
{
    Puts("OnNpcEquipWeapon was called!");
    return (object) null;
}
  • Called before a non-player controlled vending machine (at outpost etc.) gives the player the item they purchased.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches NPCVendingMachine.GiveSoldItem of Assembly-CSharp.dll.

Example
object OnNpcGiveSoldItem(NPCVendingMachine self, Item soldItem, BasePlayer buyer)
{
    Puts("OnNpcGiveSoldItem was called!");
    return (object) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches ScientistNPC.PlayRadioChatter of Assembly-CSharp.dll.

Example
object OnNpcRadioChatter(ScientistNPC self)
{
    Puts("OnNpcRadioChatter was called!");
    return (object) null;
}
  • Called when an NPC targets another entity.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches HumanNPC.GetBestTarget of Assembly-CSharp.dll.

Example
object OnNpcTarget()
{
    Puts("OnNpcTarget was called!");
    return (object) null;
}
  • Called when an NPC targets another entity.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches AIBrainSenses.GetNearest of Assembly-CSharp.dll.

Example
object OnNpcTarget()
{
    Puts("OnNpcTarget was called!");
    return (object) null;
}
  • Called when an NPC becomes aware of another entity.

  • Returning a non-null value cancels default behavior.

  • This hook is compatible within Carbon and Oxide.

  • Patches SimpleAIMemory.SetKnown of Assembly-CSharp.dll.

Example
object OnNpcTargetSense(BaseEntity owner, BaseEntity ent, AIBrainSenses brainSenses)
{
    Puts("OnNpcTargetSense was called!");
    return (object) null;
}

Last updated