Diego5714 Posted March 23, 2016 Share Posted March 23, 2016 I'm in the process of making my first game, so i went to Leadwerks and started creating things. The problem comes when I want to make that a door opens when 2 pressure plates are activated. So, i wrote this code to create a "switch" that requires 2 inputs to output a signal to the door (in the flowgraph editor), but it doesn't work... function Script:Start() bool1 = false bool2 = false end function Script:Input1() --in bool1 = true end function Script:Input2() --in bool2 = true end if (bool1 == true and bool2 == true) then self.component:CallOutputs("Output") end what i'm doing wrong? i'm very new in programming Quote Link to comment Share on other sites More sharing options...
Rick Posted March 23, 2016 Share Posted March 23, 2016 1st I'd say your bool1 and bool2 are global variables and you don't want to do that. Add self. to them. Next I'd say where are you doing that if check? It's outside of any function. Ideally you'd make a function in that script and check call it inside both Input1() and Input2(). Quote Link to comment Share on other sites More sharing options...
Diego5714 Posted March 24, 2016 Author Share Posted March 24, 2016 Ok, thanks. I managed to get it work 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.