Jump to content

Help TheWorld.state.isfullmoon not working for me


Recommended Posts

 Hey all.  

 I'm having some issues with my fullmoon transformation it was working in DS  put cant seem to get it working in DST 

 And another thing i noticed is when I'm in the caves it just stays on night setting even while standing under light where the clock is showing Day,dust and night. Is this just buged atm or am i missing something here also

 

Thanks

 

Here is what i got


local function updatestats(inst)
if TheWorld.state.isday then
inst.AnimState:SetBuild("wou")
inst.components.talker:Say ("Oink light ball... Shhh!!! another day of this!")
inst.components.sanity.maxsanity = 100
inst.components.sanity.dapperness = .07

elseif TheWorld.state.isdusk then
inst.AnimState:SetBuild("wou")
inst.components.talker:Say ("I can feel it pulling at me")
inst.components.sanity.dapperness = -.16

elseif TheWorld.state.isnight then
if TheWorld.state.isfullmoon then
inst.components.talker:Say ("Ooh NOO... It feels like..... is it looking at us")
inst.components.sanity.maxsanity = 50
inst.components.sanity.dapperness = -.05
inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3)
inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3)
inst.AnimState:SetBuild("were_wou")
--inst.components.health.maxhealth = 200
end

inst.AnimState:SetBuild("wou")
inst.components.talker:Say ("ahhh. No full moon in sight")
inst.components.sanity.dapperness = .20
end
end

local function master_postinit(inst)
--inst.components.inventory:GuaranteeItems(prefabs)
inst:WatchWorldState("startday", function() updatestats(inst) end , TheWorld)
inst:WatchWorldState("startdusk", function() updatestats(inst) end , TheWorld)
inst:WatchWorldState("startnight", function() updatestats(inst) end , TheWorld)
updatestats(inst)



-- Stats
--inst.components.eater:SetCarnivore(true)
inst.components.health:SetMaxHealth(100)
inst.components.hunger:SetMax(200)
inst.components.sanity:SetMax(100)
inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE*1.2)
inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1)
inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.1)
inst.components.sanity.neg_aura_mult = 1.5

return inst
end
wou.lua Edited by dungdodger
Link to comment
Share on other sites

I'm having some issues with my fullmoon transformation it was working in DS put cant seem to get it working in DST

 

It is working, except that during the full moon night, what happens is

        if TheWorld.state.isfullmoon then            inst.components.talker:Say ("Ooh NOO... It feels like..... is it looking at us")            inst.components.sanity.maxsanity = 50            inst.components.sanity.dapperness = -.05            inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3)            inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3)            inst.AnimState:SetBuild("were_wou")            --inst.components.health.maxhealth = 200        end        inst.AnimState:SetBuild("wou")        inst.components.talker:Say("ahhh. No full moon in sight")        inst.components.sanity.dapperness = .20

The SetBuild("wou") happens regardless of the full moon because it isn't inside an ELSE.

 

 

And another thing i noticed is when I'm in the caves it just stays on night setting even while standing under light where the clock is showing Day,dust and night. Is this just buged atm or am i missing something here also

 

Correct. Caves have constant world night.

 

What you see in the caves are the cavephases: caveday, cavedusk and cavenight.

Link to comment
Share on other sites

I think if would be if elseif elseif else

 

 

OK ITS WORKING THANKS DarkXero    It Was the order i see now i think what you meant

 

 

I tried replacing the if with else  i got an error saying expecting a = near then  I tried a few things with else but nothing seemed to work.

 

 

 

The SetBuild("wou") happens regardless of the full moon because it isn't inside an ELSE

 

elseif TheWorld.state.isnight then

if TheWorld.state.isfullmoon then

inst.components.talker:Say ("Ooh NOO... It feels like..... is it looking at us")

inst.components.sanity.maxsanity = 50

inst.components.sanity.dapperness = -.05

inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3)

inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3)

inst.AnimState:SetBuild("were_wou")

--inst.components.health.maxhealth = 200

end

inst.AnimState:SetBuild("wou")

inst.components.talker:Say ("ahhh. No full moon in sight")

inst.components.sanity.dapperness = .20

 

This doesn't count "wou" as being in a else?  the elseif TheWorld.state.isnight then This is just the order i see on another mod   

 

I did some rearranging trying to figured out why "wou" wasn't in a else.

And the strangest thing I get the Text and - dapperness but not the -sanity   if i log off and back on under a full moon

Then when morning phase starts i get the Build change but still no -sanity

then i log off and back on and its back to the normal cycle

 

Any ideas I'm sure yall can tell im pretty new to this coding moding stuff

Here is new order

local function updatestats(inst)  if TheWorld.state.isday then   inst.AnimState:SetBuild("wou")   inst.components.talker:Say ("Oink light ball... Shhh!!! another day of this!")   inst.components.sanity.maxsanity = 100   inst.components.sanity.dapperness = .07     elseif TheWorld.state.isdusk then   inst.AnimState:SetBuild("wou")   inst.components.talker:Say ("I can feel it pulling at me")   inst.components.sanity.dapperness = -.16     elseif TheWorld.state.isnight then   inst.AnimState:SetBuild("wou")   inst.components.talker:Say ("ahhh. No full moon in sight")   inst.components.sanity.dapperness = .20  end    if TheWorld.state.isfullmoon then       inst.components.talker:Say ("Ooh NOO... It feels like..... is it looking at us")    inst.components.sanity.maxsanity = 50    inst.components.sanity.dapperness = -.05    inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3)    inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3)    inst.AnimState:SetBuild("were_wou")     --inst.components.health.maxhealth = 200   end  end 
Edited by dungdodger
Link to comment
Share on other sites

@dungdodger:

local function updatestats(inst)	-- If it is day then	if TheWorld.state.isday then		inst.AnimState:SetBuild("wou")		inst.components.talker:Say ("Oink light ball... Shhh!!! another day of this!")		inst.components.sanity.maxsanity = 100		inst.components.sanity.dapperness = .07	-- It wasn't day, so, if it is dusk then	elseif TheWorld.state.isdusk then		inst.AnimState:SetBuild("wou")		inst.components.talker:Say ("I can feel it pulling at me")		inst.components.sanity.dapperness = -.16	-- It wasn't dusk either, so, if it is night then	elseif TheWorld.state.isnight then		-- If this night has a full moon then		if TheWorld.state.isfullmoon then 			inst.components.talker:Say ("Ooh NOO... It feels like..... is it looking at us")			inst.components.sanity.maxsanity = 50			inst.components.sanity.dapperness = -.05			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3)			inst.AnimState:SetBuild("were_wou") 			--inst.components.health.maxhealth = 200		-- There isn't a full moon inside this night, so, then		else			inst.AnimState:SetBuild("wou")			inst.components.talker:Say ("ahhh. No full moon in sight")			inst.components.sanity.dapperness = .20		end	endend
Link to comment
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
 Share

×
  • Create New...