Eremus007 Posted February 7, 2016 Share Posted February 7, 2016 (edited) Hello again, I am trying to make an edible prefab for an ale that doubles the amount of damage dealt by my character. Unfortunately it crashes when my character eats it. It says something like: Can't use math problems on a nil value. (at least that was what I understood). This is the 'problem' code: inst.components.edible.oneaten = function(inst, eater) if eater.prefab == "skyminer" then eater.components.hunger:DoDelta(7) eater.components.sanity:DoDelta(-5) eater.dwarvenaleresttime = 30 * 6.5 eater.components.sanity.dapperness = eater.components.sanity.dapperness - TUNING.DAPPERNESS_MED eater.components.combat.damagemultiplier = eater.components.combat.damagemultiplier + TUNING.WILSON_DAMAGE_MULT end if eater.components.inventory ~= nil then local item = SpawnPrefab("woodenmug") eater.components.inventory:GiveItem(item) inst:Remove() end end I tried changing the mult into something else but I keep the same problem. It's weird because the same code works fine within the Witcher Geralt mod. If someone could tell me what I am doing wrong, that would be very helpful again Many thanks. Edited February 7, 2016 by Eremus007 Link to comment https://forums.kleientertainment.com/forums/topic/63954-help-my-edible-prefab-crashes-the-game/ Share on other sites More sharing options...
zUsername Posted February 7, 2016 Share Posted February 7, 2016 First I didn't see the value of TUNING.WILSON_DAMAGE_MULT in tuning.lua. Second have you set damagemultiplier and dapperness before Eaten execute ? Link to comment https://forums.kleientertainment.com/forums/topic/63954-help-my-edible-prefab-crashes-the-game/#findComment-718963 Share on other sites More sharing options...
Eremus007 Posted February 7, 2016 Author Share Posted February 7, 2016 4 hours ago, zUsername said: First I didn't see the value of TUNING.WILSON_DAMAGE_MULT in tuning.lua. Second have you set damagemultiplier and dapperness before Eaten execute ? Oh, I don't know how I got on that, I set the damagemultiplier in the character prefab to 1 and then it worked. Of course if TUNING.WILSON_DAMAGE_MULT doesn't exist then the game can't multiply it... Well, lesson learned: Check the tuning file before you do something. Link to comment https://forums.kleientertainment.com/forums/topic/63954-help-my-edible-prefab-crashes-the-game/#findComment-719101 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