Hi, iam still not getting the hang of it. I understand if you dont have the time, but i assume u are the best person to ask.
Iam getting this error message:
Failed to call hook 'OnEntityTakeDamage' on plugin 'Biplane v1.0.2' (NullReferenceException: Object reference not set to an instance of an object)
at Oxide.Plugins.Biplane.OnEntityTakeDamage (BaseEntity entity, HitInfo info, UnityEngine.Rigidbody rigidbody, ModularCar modularCar) [0x00014] in <4c56633b7e3a49d69e6a187890c517f7>:0
at Oxide.Plugins.Biplane.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00192] in <4c56633b7e3a49d69e6a187890c517f7>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <60c318df79ed41688ea59335e48d61ad>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <50629aa0e75d4126b345d8d9d64da28d>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <50629aa0e75d4126b345d8d9d64da28d>:0
the code refferanced would be:
object OnEntityTakeDamage(BaseEntity entity, HitInfo info, Rigidbody rigidbody, ModularCar modularCar)
{
rigidbody = modularCar.rigidBody;
float speed = rigidbody.velocity.magnitude;
if (entity == null || info == null) return null;
if ((entity.ShortPrefabName.Contains("kayak")&&(speed <=14)) || (entity.ShortPrefabName.Contains("boogieboard")&&(speed <=14)) || (entity.ShortPrefabName.Contains("engine")&&(speed <=14)))
{
BiplaneComponent biplaneComponent = biplanes.FirstOrDefault(x => x.subEntities.Contains(entity));
if (biplaneComponent == null) return null;
biplaneComponent.modularCar.Hurt(info);
NextTick(() =>
{
var damagetaken = info.damageTypes.Total();
if (damagetaken >= 15)
{
Effect.server.Run("assets/content/vehicles/minicopter/debris_effect.prefab", entity.transform.position);
var fireball = GameManager.server.CreateEntity("assets/bundled/prefabs/fireball.prefab", entity.transform.position);
if (fireball == null) return;
fireball.Spawn();
biplaneComponent.modularCar.Kill();
}
});
return true;
}
else if ((entity.ShortPrefabName.Contains("kayak")&&(speed >=15)) || (entity.ShortPrefabName.Contains("boogieboard")&&(speed >=15)) || (entity.ShortPrefabName.Contains("engine")&&(>
{
return null;
}
return null;
}