Jump to content

Ryfoxx

Member
  • Posts

    8
  • Joined

  • Last visited

Ryfoxx's Achievements

  1. Okay, I found it: getPlayer():getStats():setPain(0);Or, to lower pain one level: local pstats = getPlayer():getStats()pstats:setPain(math.max(pstats:getPain()-1,0)); -- Make sure that the pain is at minimum 0.Ethanwdp helped me with this, so make sure to thank him. Only problem is, you still can't make new splints.
  2. Ryfoxx

    Change Moodle Level

    getPlayer():getStats():setPain(0); setPain would be the set function for the moodle, for example setHunger. They have dedicated set functions. They go up to 4, each increasing level is an increase in severity. Oh man, thank you SO MUCH!
  3. This just screams "Abuse". Start a world with Sandbox (or even the new Creative Mode), set all loot to abundant, no zombies. Go around stuffing all the loot you want into the bag. Go onto a hard server, unload all your bags full of food, weapons, and water. Repeat. How would you prevent this from being abused on servers? (Although I guess a good idea would be to just not install it on the server...)
  4. Okay, so I've been wondering about this for a while. I recently found the docs for moodles, and I thought about all the shenanigans that could be had if I was able to use these functions. However, I cannot understand at all how this will work. Is this just for Java, or is there a Lua equivalent?
  5. This is a slightly old post, but there's still hope. (I know you're no longer working on your mod, but still.) You can try using Lua functions to get and set the moodle level. However, I don't know if these functions work in Lua, or just Java. You could also have stronger painkillers cause fatigue or exhaustion, too, to balance it.
  6. Try using getModData(); it'll provide you more flexibility.
  7. Okay, I've got it. Maybe. I think. function fillBottle() local weapon = player:getPrimaryHandItem(); local weapons = player:getSecondaryHandItem(); if weapon then local wtype = weapon:getType(); if player:isOutside() and RainManager:isRaining() then if wtype == "WaterPopBottle" then weapon:setUses(weapon:getUses()+1); -- Adds a use, I think elseif wtype == "PopBottleEmpty" then local container = weapon:getContainer(); weapon:getContainer():Remove(weapon); -- Removes empty bottle local bottle = container:AddItem("Base.WaterPopBottle"); -- and fills it bottle:setUses(1); end end end if weapons then -- repeat it again for the second weapon local wtype = weapons:getType(); if player:isOutside() and RainManager:isRaining() then if wtype == "WaterPopBottle" then weapons:setUses(weapons:getUses()+1); elseif wtype == "PopBottleEmpty" then local container = weapons:getContainer(); weapons:getContainer():Remove(weapons); -- Removes empty bottle local bottle = container:AddItem("Base.WaterPopBottle"); -- and fills it bottle:setUses(1); end end endendEvent.OnPlayerUpdate.Add(fillBottle); However, I'm not exactly sure if this will work. I'll try it, though.
  8. I believe you need to modify the waterAmount of the bottle, but I'm just a beginner to modding. Maybe something like this? local weapon = player:getPrimaryHandItem();local weapons = player:getSecondaryHandItem();if weapon then local wtype = weapon:getType(); if wtype ~= "PopBottleEmpty" then return; elseif wtype == "PopBottleEmpty" and player:isOutside() and RainManager.isRaining() then weapon.waterAmount=weapon.waterAmount+1 endendHowever, I think it might fill up too much. Assuming you're running it every tick, you can either use an RNG to determine when to fill it up, or fill it up every X seconds via a timer.
×
×
  • Create New...