Jump to content

How do you change Warly's foods temperature duration?


Recommended Posts

SOLVED

I'm making a few changes to Warly's recipes to make them congruent.
So far, I've managed to change his attack, absorption and moisture immunity buffs. But the temperature duration seems to work differently, and I have no idea how to change it.
"Show me" says both Gazpacho and Dragon Chili Salad still give +40 for 5 minutes instead of the 4 days I want it to last.
 

local TUNING = GLOBAL.TUNING

AddPrefabPostInit("frogfishbowl", function(inst)
	inst.components.edible.healthvalue = 20
	inst.components.edible.hungervalue = 37.5
	inst.components.edible.sanityvalue = 10
	inst.components.perishable.perishtime = 7200
	end)

AddPrefabPostInit("glowberrymousse", function(inst)
	inst.components.perishable.perishtime = 7200
	end)

AddPrefabPostInit("voltgoatjelly", function(inst)
	inst.components.perishable.perishtime = 7200
	end)
	
AddPrefabPostInit("dragonchilisalad", function(inst)
	inst.components.edible.healthvalue = 3
    temperatureduration = 1920
	end)
	
AddPrefabPostInit("gazpacho", function(inst)
    temperatureduration = 1920
	end)
	
TUNING.BUFF_ATTACK_DURATION = 300
TUNING.BUFF_PLAYERABSORPTION_DURATION = 300
TUNING.BUFF_MOISTUREIMMUNITY_DURATION = 960
TUNING.BUFF_FOOD_TEMP_DURATION = 1920

 

Edited by Juanasdf
Link to comment
Share on other sites

12 hours ago, Juanasdf said:

AddPrefabPostInit("dragonchilisalad", function(inst) inst.components.edible.healthvalue = 3 temperatureduration = 1920 end) AddPrefabPostInit("gazpacho", function(inst) temperatureduration = 1920 end)

Changing it to "inst.components.edible.temperatureduration = TUNING.BUFF_FOOD_TEMP_DURATION" works for a test world i have but crashes on my main world with this crash log

[00:08:27]: [string "../mods/AAA - Warly QOL/modmain.lua"]:21: attempt to index field 'edible' (a nil value)
LUA ERROR stack traceback:
        ../mods/AAA - Warly QOL/modmain.lua(21,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(168,1) in function 'mod'
        scripts/mainfunctions.lua(309,1)

Changing "temperatureduration" to inst.components.temperatureduration = TUNING.BUFF_FOOD_TEMP_DURATION gives me this error on both worlds.

[00:13:12]: [string "scripts/mainfunctions.lua"]:581: attempt to index local 'v' (a number value)
LUA ERROR stack traceback:
    scripts/mainfunctions.lua:581 in () ? (Lua) <561-587>
    =[C]:-1 in (method) SetPosition (C) <-1--1>
    scripts/mainfunctions.lua:372 in (global) SpawnSaveRecord (Lua) <363-405>
    scripts/components/inventory.lua:193 in (method) OnLoad (Lua) <188-220>
    scripts/entityscript.lua:1602 in () ? (Lua) <1593-1610>
    =(tail call):-1 in ()  (tail) <-1--1>
    scripts/mainfunctions.lua:1651 in () ? (Lua) <1647-1659>
    =[C]:-1 in (method) SendResumeRequestToServer (C) <-1--1>
    scripts/prefabs/world_network.lua:30 in (field) fn (Lua) <19-34>
    scripts/scheduler.lua:177 in (method) OnTick (Lua) <155-207>
    scripts/scheduler.lua:371 in (global) RunScheduler (Lua) <369-377>
    scripts/update.lua:185 in () ? (Lua) <164-243>

Link to comment
Share on other sites

AddPrefabPostInit("dragonchilisalad", function(inst) 
    if not GLOBAL.TheWorld.ismastersim then
      	return inst
    end
    inst.components.edible.healthvalue = 3 
    inst.components.edible.temperatureduration = 1920
end) 

AddPrefabPostInit("gazpacho", function(inst) 
    if not GLOBAL.TheWorld.ismastersim then
      	return inst
    end
    inst.components.edible.temperatureduration = 1920
end)

If you have a server, the client doesn't have the edible component, that's why you must check for the server before changing things in the edible component.

  • Like 2
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...