Sign in to follow this  
MarshallMabee

Character Mod (Rain Damage for Reign of Giants) ROG

Recommended Posts

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.

Share this post


Link to post
Share on other sites
DarkXero    2889

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 by DarkXero

Share this post


Link to post
Share on other sites
DarkXero    2889

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

Share this post


Link to post
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
Sign in to follow this