Jump to content
Diego5714

How to make a door open by more than 1 switch?

Recommended Posts

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

Share this post


Link to post

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().

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...