Jump to content

Recommended Posts

i kinda try a bit of everything. i m not even a beginner with coding.

 

i copied part of the fileyou mentioned, in particular the part that talkabout spark (that i think it s about the rain so i deleted it).

 

here s the text i copied, if it can help you help me:

 

(first try)

 

 

       local prefabs = 
       {
        "sparks"
}
 
.....
 
 
         local function onpreload(inst, data)
if data then
if data.level then
inst.level = data.level
applyupgrades(inst)
--re-set these from the save data, because of load-order clipping issues
if data.health and data.health.health then inst.components.health.currenthealth = data.health.health end
if data.hunger and data.hunger.hunger then inst.components.hunger.current = data.hunger.hunger end
if data.sanity and data.sanity.current then inst.components.sanity.current = data.sanity.current end
inst.components.health:DoDelta(0)
inst.components.hunger:DoDelta(0)
inst.components.sanity:DoDelta(0)
end
end
 
end
 
local function onload(inst, data)
if data then
 
if data.charge_time then
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
 
onupdate(inst, 0)
inst.charged_task = inst:DoPeriodicTask(1, onupdate, nil, 1)
end
 
end
end
 
local function onsave(inst, data)
data.level = inst.level
data.charge_time = inst.charge_time
end
 
local function onlightingstrike(inst)
inst.charge_time = inst.charge_time + TUNING.TOTAL_DAY_TIME*(.5 + .5*math.random())
 
inst.components.health:DoDelta(TUNING.HEALING_SUPERHUGE,false,"lightning")
inst.components.sanity:DoDelta(-TUNING.SANITY_LARGE)
inst.components.talker:Say(GetString("wx78", "ANNOUNCE_CHARGE"))
 
inst.SoundEmitter:KillSound("overcharge_sound")
inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/charged", "overcharge_sound")
inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
 
if not inst.charged_task then
onupdate(inst, 0)
inst.charged_task = inst:DoPeriodicTask(1, onupdate, nil, 1)
end
end
  
 
 
 
tnx for your time, by the way :)
 

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...