QuickShot010 Posted January 30, 2015 Share Posted January 30, 2015 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) endAny ideas how to do the day only script? Link to comment Share on other sites More sharing options...
seronis Posted January 30, 2015 Share Posted January 30, 2015 Exact same way that other posters are recently asking about doing things only during the rain. You listen for the proper events and react accordingly. Link to comment Share on other sites More sharing options...
Mobbstar Posted January 31, 2015 Share Posted January 31, 2015 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 More sharing options...
Recommended Posts
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.