Jump to content

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
https://forums.kleientertainment.com/forums/topic/50015-prefab-lights/
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).

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
×
  • Create New...