MarshallMabee Posted May 2, 2015 Share Posted May 2, 2015 I've been incessantly updating my character Pith the Pyromancer and ran into a few problems. My character mod, Pith the Pyromancer, was created just a few weeks before DST ROG came out. Later I updated him so he can be played in Reign of Giants. A few errors have occurred which I have been eagerly trying to fix. But this one leaves me stumped. In the normal DST Pith takes rain damage similar to WX-78, however I realized WX-78's coding is different in ROG compared to the original. I tried to look in the forums to see if the same problem occurred for someone else and found nothing. So, I'm looking for a code that I can simply paste in. I need to know which file, and which section inside the file. Thanks for your help. Link to comment https://forums.kleientertainment.com/forums/topic/53458-character-mod-rain-damage-for-reign-of-giants-rog/ Share on other sites More sharing options...
DarkXero Posted May 2, 2015 Share Posted May 2, 2015 (edited) This is WX's code:local function dorainsparks(inst, dt) if inst.components.moisture ~= nil and inst.components.moisture:GetMoisture() > 0 then local t = GetTime() -- Raining, no moisture-giving equipment on head, and moisture is increasing. Pro-rate damage based on waterproofness. if inst.components.inventory:GetEquippedMoistureRate(EQUIPSLOTS.HEAD) <= 0 and inst.components.moisture:GetRate() > 0 then local waterproofmult = ( inst.components.sheltered ~= nil and inst.components.sheltered.sheltered and inst.components.sheltered.waterproofness or 0 ) + ( inst.components.inventory ~= nil and inst.components.inventory:GetWaterproofness() or 0 ) if waterproofmult < 1 and t > inst.spark_time + inst.spark_time_offset + waterproofmult * 7 then inst.components.health:DoDelta(TUNING.WX78_MAX_MOISTURE_DAMAGE, false, "rain") inst.spark_time_offset = 3 + math.random() * 2 inst.spark_time = t local x, y, z = inst.Transform:GetWorldPosition() y = y + 1 + math.random() * 1.5 end elseif t > inst.spark_time + inst.spark_time_offset then -- We have moisture-giving equipment on our head or it is not raining and we are just passively wet (but drying off). Do full damage. inst.components.health:DoDelta( inst.components.moisture:GetRate() >= 0 and TUNING.WX78_MAX_MOISTURE_DAMAGE or TUNING.WX78_MOISTURE_DRYING_DAMAGE, false, "water") inst.spark_time_offset = 3 + math.random() * 2 inst.spark_time = t local x, y, z = inst.Transform:GetWorldPosition() y = y + .25 + math.random() * 2 end endendlocal function onisraining(inst, israining) if israining then if inst.spark_task == nil then inst.spark_task = inst:DoPeriodicTask(.1, dorainsparks, nil, .1) end elseif inst.spark_task ~= nil then inst.spark_task:Cancel() inst.spark_task = nil endendlocal function onbecamepyro(inst) if not inst.watchingrain then inst.watchingrain = true inst:WatchWorldState("israining", onisraining) onisraining(inst, TheWorld.state.israining) endendlocal function onbecameghost(inst) if inst.spark_task ~= nil then inst.spark_task:Cancel() inst.spark_task = nil end if inst.watchingrain then inst.watchingrain = false inst:StopWatchingWorldState("israining", onisraining) endendlocal function master_postinit(inst) -- other master_postinit code goes here inst:ListenForEvent("ms_respawnedfromghost", onbecamepyro) inst:ListenForEvent("ms_becameghost", onbecameghost) onbecamepyro(inst)end Edited May 2, 2015 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/53458-character-mod-rain-damage-for-reign-of-giants-rog/#findComment-634079 Share on other sites More sharing options...
MarshallMabee Posted May 4, 2015 Author Share Posted May 4, 2015 I entered what I was told and received a glitch. I have a picture posted Link to comment https://forums.kleientertainment.com/forums/topic/53458-character-mod-rain-damage-for-reign-of-giants-rog/#findComment-634542 Share on other sites More sharing options...
DarkXero Posted May 4, 2015 Share Posted May 4, 2015 Yes, sorry. This should be it:local function master_postinit(inst) -- other master_postinit code goes here inst.charged_task = nil inst.charge_time = 0 inst.spark_task = nil inst.spark_time = 0 inst.spark_time_offset = 3 inst.watchingrain = false inst:ListenForEvent("ms_respawnedfromghost", onbecamepyro) inst:ListenForEvent("ms_becameghost", onbecameghost) onbecamepyro(inst)end Link to comment https://forums.kleientertainment.com/forums/topic/53458-character-mod-rain-damage-for-reign-of-giants-rog/#findComment-634549 Share on other sites More sharing options...
MarshallMabee Posted May 4, 2015 Author Share Posted May 4, 2015 It works! Thankyou for your help. Link to comment https://forums.kleientertainment.com/forums/topic/53458-character-mod-rain-damage-for-reign-of-giants-rog/#findComment-634557 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now