dennis Posted May 7, 2012 Share Posted May 7, 2012 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? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted May 7, 2012 Share Posted May 7, 2012 I assume the objects are linked correctly? Parent and child etc. Quote Link to comment Share on other sites More sharing options...
dennis Posted May 8, 2012 Author Share Posted May 8, 2012 Yes I did. But i kinda solved it. But now it's only responding when i push the E key while pointing at the switch at the very bottom corner at the sides. Why is this so? Now i have the trigger working but the model or something is acting strange Quote Link to comment Share on other sites More sharing options...
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.