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.

CanDeployScientists

  • Returning a non-null value cancels default behavior.

  • This hook is Carbon-only compatible.

  • Patches BradleyAPC.CanDeployScientists of Assembly-CSharp.dll.

Example
object CanDeployScientists(BradleyAPC BradleyAPC )
{
    Puts("CanDeployScientists was called!");
    return (bool) null;
}

CanNpcEat

  • 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 BaseNpc )
{
    Puts("CanNpcEat was called!");
    return (bool) null;
}

OnAIBrainStateSwitch

  • 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 BaseAIBrain , BaseAIBrain BaseAIBrain , BaseAIBrain.BasicAIState BasicAIState )
{
    Puts("OnAIBrainStateSwitch was called!");
    return (bool) null;
}

OnAIBrainStateSwitched

  • 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 BaseAIBrain , BaseAIBrain BaseAIBrain )
{
    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 NPCPlayer.CreateCorpse of Assembly-CSharp.dll.

Example
object OnCorpsePopulate(NPCPlayer NPCPlayer , NPCPlayerCorpse NPCPlayerCorpse )
{
    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 ScientistNPC )
{
    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 BaseNpc , BaseNpc BaseNpc )
{
    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 NPCTalking )
{
    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 NPCTalking , BasePlayer BasePlayer , ConversationData ConversationData , ConversationData.ResponseNode ResponseNode )
{
    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 NPCTalking , BasePlayer BasePlayer , ConversationData ConversationData , ConversationData.ResponseNode ResponseNode )
{
    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 NPCTalking , BasePlayer BasePlayer , ConversationData ConversationData )
{
    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 HumanNPC )
{
    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 ScientistNPC , Item Item )
{
    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 NPCPlayer , Item Item )
{
    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 NPCVendingMachine , Item Item , BasePlayer BasePlayer )
{
    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 ScientistNPC )
{
    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
void OnNpcTarget()
{
    Puts("OnNpcTarget was called!");
}
  • 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
void OnNpcTarget()
{
    Puts("OnNpcTarget was called!");
}
  • 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 BaseEntity , BaseEntity BaseEntity , AIBrainSenses AIBrainSenses )
{
    Puts("OnNpcTargetSense was called!");
    return (object) null;
}
  • Returning a non-null value cancels default behavior.

  • This hook is Carbon-only compatible.

  • Patches BradleyAPC.InitScientist of Assembly-CSharp.dll.

Example
void OnScientistInitialized(BradleyAPC BradleyAPC , ScientistNPC ScientistNPC , UnityEngine.Vector3 Vector3 )
{
    Puts("OnScientistInitialized was called!");
}
  • Returning a non-null value cancels default behavior.

  • This hook is Carbon-only compatible.

  • Patches BradleyAPC.OnScientistMounted of Assembly-CSharp.dll.

Example
void OnScientistRecalled(BradleyAPC BradleyAPC )
{
    Puts("OnScientistRecalled was called!");
}

Last updated