1. Hi!
    How i can check entity in OnEntityTakeDamage event?
    Need to proove that entity is High External Stone Wall
     
  2. I haven't tested this but it should point you in the right direction:

    Code:
    void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info)
    {
         Item item = entity.GetItem();
         if (item.info.itemid == -496055048) // High ext stone wall id
         {
              // Do something
         }
    }
    Be sure to check out the docs.
     
  3. Code:
    [Oxide] 2:30 AM [Error] Failed to call hook 'OnEntityTakeDamage' on plugin 'SACore v0.1.0' (NullReferenceException: Object reference not set to an instance of an object)
    [Oxide] 2:30 AM [Debug] at Oxide.Plugins.SACore.OnEntityTakeDamage (.BaseCombatEntity entity, .HitInfo info) [0x00000] in <filename unknown>:0 at Oxide.Plugins.SACore.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (System.Reflection.MethodInfo method, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0
    [DOUBLEPOST=1456098036][/DOUBLEPOST]Okay, i found the solution
    if (entity.name.Contains("wall.external.high.stone"))
     
    Last edited by a moderator: Feb 21, 2016
  4. Calytic

    Calytic Community Admin Community Mod

    Be advised that OnEntityTakeDamage is called very often. There is a substantial benefit to checking by prefabID rather than doing a string operation.

    Code:
    void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info)
    {
         if (entity.prefabID == entityPrefabID) // High ext stone wall id
         {
              // Do something
         }
    }
    You can find the entityPrefabID fairly easily..
    Code:
    void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info)
    {
         PrintWarning(entity.prefabID);
    }