Jump to content

Recommended Posts

My custom character can eat nightmare fuel which for them restores health but drains sanity. I want to add a temporal damage buff (50%+ damage for 20 s) activated by the activity of eating nightmare fuel.
Another thing I need help with is sanity drain of 2 per second for 10 second upon killing anything other than mobs tagged prey.

It's my first mod ever so that might seem like a lot. Thanks for any help ^^

I think i fixed the second problem, here's my code. haven't checked if it's working yet

 

local function SanitysFall(inst, ini_time)          
    if inst.components.sanity then          
        inst.components.sanity:DoDelta(-1)      
    end            
    if GLOBAL.GetTime() > ini_time + 20 then            
        inst.lose_sanity_task:Cancel()          
        inst.lose_sanity_task = nil    
    end
 
local function OnKill(inst, data)
    local victim = data.victim
    if victim and not victim:HasTag("prey") and not victim:HasTag("pigman") and inst.components.sanity then
        if inst.lose_sanity_task ~= nil then
            inst.lose_sanity_task:Cancel() end      
            inst.lose_sanity_task = nil            
            inst.lose_sanity_task = inst:DoPeriodicTask(1, SanitysFall, nil, GLOBAL.GetTime())  
        end    
    end
end

--in common_postinit :

inst:ListenForEvent("killed", OnKill)
Edited by al6ren

update it's not

not even launching, auto compile doesn't happen, not starting. Logs return this

 FrontendLoadMod    orion mod    
[00:07:18]: Could not load mod_config_data/modconfiguration_orion mod    
[00:07:18]: Fontend-Loading mod: orion mod Version: (No modinfo.lua, using defaults... )    
[00:07:18]: Mod: orion mod    Loading modservercreationmain.lua    
[00:07:18]: Mod: orion mod      Mod had no modservercreationmain.lua. Skipping.    
[00:07:18]: Mod: orion mod    Loading modworldgenmain.lua    
[00:07:18]: Mod: orion mod      Mod had no modworldgenmain.lua. Skipping.    

please help

On 1/14/2025 at 5:53 AM, yanecc said:

I suggest using debuff method to do this. You can refer to the foodbuffs.lua and compostwrap.lua files for guidance.

Thank you and sorry for not replying earlier! I opted for another mechanic but it was still useful 

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
×
  • Create New...