Use item to create another item.. need help :P
Posted: Mon Sep 21, 2015 3:11 am
Ive been trying to create item, that once use it , it will be replaced by another item. This is how I'm trying it but not successfully lol. I am a total scripting newb! so this will probably look very wrong 
Every time I use the item I get.
bad argument #2 to 'insertItem' (ItemComponent expected, got ???)
Code: Select all
defineObject{
name = "glass_ball",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/power_gem.fbx",
},
{
class = "Item",
uiName = "Tome of Health",
description = "A thick glass ball, somthing seems to be inside.",
gfxIndex = 157,
weight = 2.0,
traits = { "ball" },
},
{
class = "UsableItem",
sound = "level_up",
onUseItem = function(self, champion)
hudPrint(champion:getName().."found an Iron Key")
champion:insertItem(7, iron_key)
return true
end,
},
},
}
bad argument #2 to 'insertItem' (ItemComponent expected, got ???)