IanSchot Posted June 24, 2018 Share Posted June 24, 2018 Im looking to make a electric blanket item that uses a OnCreate: recipe_. i can't seem to get it to referance the Hyperthmeria/Hypothermia Stats. (Bordem, Unhappy stats seem to work fine.) What am i doing wrong? (Lua Code) --Raise Temperature function recipe_raisebodytemp(items, result, player) local unhappy = 5; local hyperthermia = 50; HCDoStats(player, unhappy , hyperthermia); end (Lua Code) Link to comment Share on other sites More sharing options...
nater Posted June 25, 2018 Share Posted June 25, 2018 (edited) I'm not sure if you are aware, but 'HCDoStats' is a Hydrocraft function. So if you do not want your mod to rely on Hydrocraft, I would just copy the function into your own file: function HCDoStats(player, b, u) player:getBodyDamage():setBoredomLevel(player:getBodyDamage():getBoredomLevel() - b); player:getBodyDamage():setUnhappynessLevel(player:getBodyDamage():getUnhappynessLevel() - u); end At the moment, you are passing the incorrect parameters to the HCDoStats function (unless you've changed it from the default Hydrocraft function). This function expects 3 parameters, player, boredom, and unhappyness. You are passing player for player, which is correct, then you're passing unhappy which actually changes boredom, and 'hyperthermia' which actually changes unhappyness level. To fix this, you'll need to add another line to this function called player:SetTemperature(player:GetTemperature() - hypothermia). This line will subtract 'hypothermia' from the player's current temperature. You'll then need to add another parameter (probably called hypothermia) inside of the HCDoStats parenthesis to both the function and the function call. So you should have something similar to this: function HCDoStats(player, b, u, hypothermia) player:getBodyDamage():setBoredomLevel(player:getBodyDamage():getBoredomLevel() - b); player:getBodyDamage():setUnhappynessLevel(player:getBodyDamage():getUnhappynessLevel() - u); player:setTemperature(player:getTemperature() - hypothermia) end To call the function, you would then use: HCDoStats(player, boredom, unhappy, hypothermia); Edited June 26, 2018 by nater Link to comment Share on other sites More sharing options...
IanSchot Posted June 25, 2018 Author Share Posted June 25, 2018 Thank you for the help, with this i will be able to do some neat shit with this. Link to comment Share on other sites More sharing options...
nater Posted June 26, 2018 Share Posted June 26, 2018 No problem, I look forward to it! 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