Jump to content

Event for changing light level? [Solved]


Recommended Posts

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 by Serpens
Link to comment
Share on other sites

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

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