Jump to content

Addin WX ability to personal character?


Nirvh

Recommended Posts

yo,

 

so i was trying to ad wx ability to charge with lightning (without the rain debuff) to my charater,

but i m having some problems and the games crash all the time.

 

does anyone know what part of the code i have to copy?

Link to comment
Share on other sites

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 :)
 
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...