WhiteAutumn Posted October 9, 2019 Share Posted October 9, 2019 (edited) Hello! Is there an event that gets fired upon the player moving between areas of different light levels, for example walking out into darkness or walking closer to a fire? Thanks in advance! Edited October 9, 2019 by WhiteAutumn Link to comment Share on other sites More sharing options...
Serpens Posted October 9, 2019 Share Posted October 9, 2019 (edited) there is a "inst.LightWatcher" for every player. Search all game files with eg notepad++ and see if you find a function from it that helps you. One example would be inst.LightWatcher:IsInLight() edit: and there is inst.LightWatcher:GetLightValue() , maybe this is already what you need. In wisecracker.lua, the thing that makes your character talk so much, is this code: if nightvision or self.inst.LightWatcher:IsInLight() then if not self.inlight and (nightvision or self.inst.LightWatcher:GetTimeInLight() >= 0.5) then self.inlight = true if self.inst.components.talker ~= nil and not self.inst:HasTag("playerghost") then self.inst.components.talker:Say(GetString(self.inst, "ANNOUNCE_ENTER_LIGHT")) is_talker_busy = true end end elseif self.inlight and self.inst.LightWatcher:GetTimeInDark() >= 0.5 then self.inlight = false if self.inst.components.talker ~= nil then self.inst.components.talker:Say(GetString(self.inst, "ANNOUNCE_ENTER_DARK")) is_talker_busy = true end end within OnUpdate. So my guess would be there is no event fired, but you have to check the lightvalue periodically, eg with DoPeriodicTask(1,..) Edited October 9, 2019 by Serpens Link to comment Share on other sites More sharing options...
WhiteAutumn Posted October 9, 2019 Author Share Posted October 9, 2019 3 minutes ago, Serpens said: there is a "inst.LightWatcher" for every player. Search all game files with eg notepad++ and see if you find a function from it that helps you. One example would be inst.LightWatcher:IsInLight() edit: and there is inst.LightWatcher:GetLightValue() , maybe this is already what you need. Yes thanks, I can make it work with that! 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