Hello all,
Today I followed one of aggror's tutorials on using triggers and events.
I tried to make a light that actually could flick on and off.
I wrote one, that didn't work.
so I wrote one exactly as his and that even didn't work,,,
Why isn't it working for me?
I use this code for the switch:
require("scripts/class")
local class=CreateClass(...)
function class:CreateObject(model)
local object=self.super:CreateObject(model)
function object:Update()
if KeyHit(KEY_E) ==1 then
for n = 0,7 do
target = self.model:GetTarget(n)
if target ~= nil then
target:SendMessage("trigger_light", self.model,0)
end
end
end
end
end
for my light I'll spare the pre-written code for u and just go on to trigger part
function object:ReceiveMessage(message, delay)
if message == "trigger_light" then
if self.active == 1 then
--hide the light
object.light:Hide()
self.active = 0
elseif self.active == 0 then
--show the light
object.light:Show()
self.active = 1
end
end
end
Why isn't this working?