Jump to content

Recommended Posts

yea i know it's still a work in progress, but i want a single player version ready to play.

problem is, the game crashes and it doesn't really tell me whats wrong, it just says "moduntil crased at 56" or something

attachicon.gifNoonFish and others.zip

attachicon.giflog.txt

 

That should give you an idea of what is going wrong, actually.

 

scripts/modutil.lua:56: attempt to call upvalue 'postfn' (a nil value)

 

It suggests that you're using DoAddClassPostConstruct somewhere without declaring the postfn.

Link to comment
Share on other sites

That should give you an idea of what is going wrong, actually.

 

scripts/modutil.lua:56: attempt to call upvalue 'postfn' (a nil value)

 

It suggests that you're using DoAddClassPostConstruct somewhere without declaring the postfn.

ok i found the source of the problem and fixed it

Link to comment
Share on other sites

AddPrefabPostInit("sanity", function(inst)	local old = inst.components.sanity:GetMoistureDelta()	function m = self.inst.components.moiture			easing.insine(m:GetMoisture(), 0, TUNING.MOISTURE_SANITY_PENALTY_MAX, m.moitureclamp.max)			if m = self and m = self.prefab == "noonfish" then				local m = self.inst.components.moisture				return easing.inSine(m:GetMoisture(), 0, 140, m.moistureclamp.max)		end	endend)

this doesn't work, but it doesn't crash the game. .-.

im trying to get my character gain sanity from being wet

*rams head into wall*

Link to comment
Share on other sites

guys

inst.components.sanity.custom_rate_fn = function(inst)		local rain_delta = GetSeasonManager() and GetSeasonManager():IsRaining()		local mydelta = -(rain_delta * 1.5)		return mydeltaend 

does this look functional to you? for some reason the game says it's a boolean value(idk how but it happened) and im basically rolling my face on the keyboard at this point

NoonFish and others.zip

log.txt

Link to comment
Share on other sites

Follow the link for increasing sanity in rain.

 

Use this for wetness.

TUNING.MOISTURE_SANITY_MAX = -TUNING.MOISTURE_SANITY_PENALTY_MAX-- Can be whatever you wantfunction moisture_delta(inst)    local m = inst.components.moisture    return easing.inSine(m:GetMoisture(), 0, TUNING.MOISTURE_SANITY_MAX, m.moistureclamp.max)end-- ...-- where inst is the player instanceinst.components.sanity.custom_rate_fn = function(inst)    local negate_moisture_penalty = -(inst.components.sanity:GetMoistureDelta())    local moisture_rate = negate_moisture_penalty + moisture_delta(inst)    return moisture_rateend 
Link to comment
Share on other sites

@Blueberrys, the code you gave me doesn't work, so i assume it would only work once my character reaches the moist limit.... also 

AddComponentPostInit("temperature", function(self)    local old = self.OnUpdate    function self:OnUpdate(dt, applyhealthdelta)        old(self, dt, applyhealthdelta)        if self.inst.prefab == "noonfish" and applyhealthdelta and self.current < 0 and self.inst.components.health then            self.inst.components.health:DoDelta(self.hurtrate*dt*1.5, true, "cold")        end    endend)

this doesn't work, but i assume it's because of 

self.hurtrate*dt*1.5, true, "cold"
Link to comment
Share on other sites

Change the moisture_delta function and see if it has any effect.

 

You should modify the component through your prefab instead of using a component post init.

-- Where inst is your player instanceinst.components.temperature.OnUpdate = ...

But why not listen for the startfreezing event instead? It's pushed when the temperature reaches below 0.

 

And I'm not certain what you're trying to accomplish, but if you just want to change the hurtrate you can simply do something like this and it should work fine.

-- Doubles hurtrateinst.components.temperature.hurtrate = inst.components.temperature.hurtrate*2
Link to comment
Share on other sites

I'm trying to get my character to gain health while freezing instead of losing health, and i think the hurt rate is a negitive, so if i do

 would that make it healing instead of hurting?

Try it and let me know.

Edit (spoiler):

Hint: Think about this, what happens if you put a negative before a number?

e.g. (2) -> (-2)

or (-2) -> (-(-2)) -> (2)

Double negative

 

(also i found out the game cant add because i got  "unexpected symbol near '+'")

 

Please provide the relevant code, I can't fix what I can't see.

Have you tried to understand and use the information from the previous posts?

Link to comment
Share on other sites

Try it and let me know.

Edit (spoiler):

Hint: Think about this, what happens if you put a negative before a number?

e.g. (2) -> (-2)

or (-2) -> (-(-2)) -> (2)

Double negative

 

 

Please provide the relevant code, I can't fix what I can't see.

Have you tried to understand and use the information from the previous posts?

 

will try

 

yes i do try to understand and use the imformation in previous posts and other things, but it's hard swapping from DST and DS/RoG

that and im kinda bad at remembering things.

plus school is a thing

inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED * 1.2 + 1
Link to comment
Share on other sites

What are the lines before and after that? Are you sure you haven't missed a comma or bracket somewhere nearby?

ok nvm about that, it kinda works (it doesnt crash the game, yay)

but my character (still) doesn't gain sainty from rain or being soaked to the max

(she kinda gains health while freezing but i havent tested the new codes yet because i felt like drawing ;-; )

noonfish.lua

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