Jump to content

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


Diego5714
 Share

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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.

 Share

×
×
  • Create New...