is there anyway i can get this dude to drop random loot on his body when getting killed i dont want to do the long process of making kits for 20 ish npcs lol
Rust NPC loot drops
Discussion in 'Plugin Requests' started by Wombat, Jul 1, 2017.
-
Code:
void OnEntityDeath(BaseCombatEntity entity, HitInfo info) { if (entity.ShortPrefabName == "zombie") { var random = ListLootZombie.GetRandom(); ItemManager.CreateByItemID(random.itemID, random.count).Drop(new Vector3(0, 2f, 0f)+ entity.transform.position, new Vector3(0, -0.005f, 0)); } } ListLootZombie.Add(new ZombieLoot() { itemID = -533875561, count = 10 }); class ZombieLoot { public int itemID { get; set; } public int count { get; set; } } List<ZombieLoot> ListLootZombie = new List<ZombieLoot>();
-
where would i put this bud ? -
Wulf Community Admin
-
-
ok getting somewhere with help from @Kappasaurus (Thanks for helping me ) but getting this error in console if anyone has any pointers
Code:(18:18:03) | [Oxide] 18:18 [Error] Failed to call hook 'OnKillNPC' on plugin 'NPCRewards v1.0.0' (InvalidCastException: Cannot cast from source type to destination type.) (18:18:03) | [Oxide] 18:18 [Stacktrace] at Oxide.Plugins.NPCRewards.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod 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 hook, System.Object[] args) [0x00000] in <filename unknown>:0