Jump to content

light setting


xana
 Share

Recommended Posts

Hello, when creating my project I've realized that it was possible to change the color of a light via the editor, is there a way to change or draws a switch activated on / off light.

In my example it is for doors that changes from red to green.

Link to comment
Share on other sites

Here we go:

 

tzgw8qM.png

 


Script.enabled = true --bool "Enabled"

Script.on = true --bool "Start on"

Script.coloron = Vec3(255,255,255) --color "Color On"

Script.coloroff = Vec3(0,0,0) --color "Color Off"

 

 

function Script:Start()

if self.on == true then

self:On()

else

self:Off()

end

end

 

 

function Script:On() -- in

self.entity:SetColor(self.coloron.x,self.coloron.y,self.coloron.z,255)

self.component:CallOutputs("On")

end

 

function Script:Off() --in

self.entity:SetColor(self.coloroff.x,self.coloroff.y,self.coloroff.z,255)

self.component:CallOutputs("Off")

end

 

 

function Script:Enable()--in

if self.enabled==false then

self.enabled=true

self.component:CallOutputs("Enable")

self.entity:Show()

end

end

 

function Script:Disable()--in

if self.enabled then

self.enabled=false

self.component:CallOutputs("Disable")

self.entity:Hide()

end

end

Link to comment
Share on other sites

This works on lights:

http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitysetcolor-r162

 

To turn a light off you should hide it so it won't be rendered (unless you actually want to change colors).

Thank you for this tip is if I was originally a Pannels slipping and red cover and green

Here we go:

 

tzgw8qM.png

 

Thank you very much thanks to you I can create my light system

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...