xana Posted August 20, 2015 Posted August 20, 2015 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. Quote
Josh Posted August 20, 2015 Posted August 20, 2015 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). Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Einlander Posted August 20, 2015 Posted August 20, 2015 I have a script EXACTLY for this, give me 24 hours to post it since I'm not at home. Quote
Einlander Posted August 21, 2015 Posted August 21, 2015 Here we go: 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 Quote
xana Posted August 21, 2015 Author Posted August 21, 2015 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: Thank you very much thanks to you I can create my light system Quote
xana Posted August 21, 2015 Author Posted August 21, 2015 I know I ask of you too but you do not have a code for bedtime lowers or character? Quote
xana Posted August 23, 2015 Author Posted August 23, 2015 Basically I create doors that only open a half-and therefore to spend must be kneeling or code fpsplayer.lua code is not contien Quote
Recommended Posts
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.