Birdskull Posted February 14, 2019 Share Posted February 14, 2019 Hello. Can someone tell me what I'm doing wrong, here? I'm working on a character who has a different build and features for day/dusk/night. I'd like for him to behave as if it is night while he is in the cave, but I can't for the life of me get anything I try to work. Here's my current iteration of failure. What am I missing? Spoiler local function phasecolor(inst, WorldState) if TheWorld.state.phase == "day" then inst.AnimState:SetBuild("wort") inst:AddTag("daywort") inst:RemoveTag("eveningwort") inst:RemoveTag("nightwort") inst:AddComponent("sanityaura") inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY local light = inst.entity:AddLight() inst.Light:Enable(false) elseif TheWorld.state.phase == "dusk" then inst.AnimState:SetBuild("eveningwort") inst:AddTag("eveningwort") inst:RemoveTag("daywort") inst:RemoveTag("nightwort") inst:RemoveComponent("sanityaura") local light = inst.entity:AddLight() inst.Light:Enable(true) inst.Light:SetFalloff(.5) inst.Light:SetIntensity(.9) inst.Light:SetRadius(1) inst.Light:SetColour(66/255, 105/255, 76/255) elseif TheWorld.state.phase == "night" or TheWorld.state.phase == "cavenight" or TheWorld.state.phase == "caveday" or TheWorld.state.phase == "cavedusk" then inst.AnimState:SetBuild("nightwort") inst:AddTag("nightwort") inst:RemoveTag("daywort") inst:RemoveTag("eveningwort") inst:AddComponent("sanityaura") inst.components.sanityaura.aura = -(TUNING.SANITYAURA_TINY * 50) local light = inst.entity:AddLight() inst.Light:Enable(true) inst.Light:SetFalloff(.5) inst.Light:SetIntensity(.9) inst.Light:SetRadius(1) inst.Light:SetColour(95/255, 151/255, 167/255) end end Wort TESTER.rar Link to comment Share on other sites More sharing options...
Ultroman Posted February 14, 2019 Share Posted February 14, 2019 What doesn't work? Does it crash? Does nothing happen? Did you do print-statements to debug what is going on? Link to comment Share on other sites More sharing options...
Birdskull Posted February 14, 2019 Author Share Posted February 14, 2019 (edited) Nothing happens. The character remains/reverts to his daytime version. I'll look into print-statements. I'm still a beginner and didn't know that was a thing, so thank you! Edited February 14, 2019 by Birdskull Link to comment Share on other sites More sharing options...
Ultroman Posted February 14, 2019 Share Posted February 14, 2019 I'm sure you'll figure it out. It's good practice If you can't figure it out, return with your findings, and I'll look at it Link to comment Share on other sites More sharing options...
Birdskull Posted February 14, 2019 Author Share Posted February 14, 2019 Thank you. I still haven't figured out why I couldn't get the build to change, but I was at least able to recognize that the other changes were being applied so the issue was all just visual. I fixed the problem by going into the x_none.lua and changing his normal_skin from the day to the night build. Link to comment Share on other sites More sharing options...
Ultroman Posted February 14, 2019 Share Posted February 14, 2019 Sounds weird, but if you're happy with the functionality, case closed Link to comment 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