Kjulo Posted September 16, 2013 Share Posted September 16, 2013 Kmod_Addition_Traits.OnMakeItem = function(result,resultItem,recipe) if getPlayer():HasTrait("kjulo_armsexpert") then if recipe == "Gun_Parts.Disassemble" or resultItem == "Gun_Parts.GunParts" or result == "Gun_Parts.GunParts" then getPlayer():getInventory():AddItem("Gun_Parts.GunParts"); getPlayer():getInventory():AddItem("Gun_Parts.GunParts"); end endendEvents.OnMakeItem.Add(Kmod_Addition_Traits.OnMakeItem);What i want to do is to give more items (In this case a custom item) when a specific recipe is made. As you can see i've made it check every variable to see if even one is accepted, but nothing happens. Link to comment Share on other sites More sharing options...
RoboMat Posted September 16, 2013 Share Posted September 16, 2013 Did you check if the event fires at all? I remember reading about this event having issues ... Link to comment Share on other sites More sharing options...
Kjulo Posted September 16, 2013 Author Share Posted September 16, 2013 Did you check if the event fires at all? I remember reading about this event having issues ...Without any checks about the recipe / item it works. Link to comment Share on other sites More sharing options...
RoboMat Posted September 16, 2013 Share Posted September 16, 2013 Ah I think I know what your problem is. OnMakeItem doesn't give you string-parameters but instead the Java Objects:result InventoryItemresultItem InventoryItemrecipe Recipeso result:getName() should work. Kjulo 1 Link to comment Share on other sites More sharing options...
Kjulo Posted September 16, 2013 Author Share Posted September 16, 2013 Ah I think I know what your problem is. OnMakeItem doesn't give you string-parameters but instead the Java Objects:result InventoryItemresultItem InventoryItemrecipe Recipeso result:getName() should work.result and resultItem still diden't work, but recipe did.if recipe:getName() == "Disassemble" thenThis is the final code i used, Thanks for the help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now