Jump to content

Prefab & Lights


Recommended Posts

Okay, so i want my buildable prefab to emit light, only in caves, and only during day time.

I tried coding it but for some reason the day things doesnt work. The cave only seems to be working.

    local light = inst.entity:AddLight()       if GetWorld():IsCave() and GetClock():IsDay() then        light:SetFalloff(0.5)        light:SetIntensity(.8)        light:SetRadius(2)        light:SetColour(237/255, 237/255, 209/255)        light:Enable(true)    end

Any ideas how to do the day only script?

 

 

Link to comment
Share on other sites

you are checking for whether it's day only when the if clause fires, since you are adding light in the code snippet I assume that is when the prefab loads. As seronis suggested, listen for the daytime and dusktime events, to toggle light with those too (ideally make turnon/turnoff functions).

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