Problem with counters
Posted: Tue Feb 11, 2014 12:22 am
Now I have a very odd problem. I'm working on a puzzle where in a set of 4 buttons each one has to be activated a given amount of times to open a door.
I have connected each button to a counter starting on 0, with the button increasing the counter by one. The counters are connected to a script entity, which they trigger on any event. There's a fifth button which only resets the counters in case the player made a mistake. Now this is my script:
The thing is, it only works when ending the sequence with one of the buttons which have to be pressed just once. I have a feeling that it's got to do with the counters being set to "any" - I did this because I understand counters only "activate" on 0, and by having the counters increase I don't need to worry about what happens when the player presses a button too often, as the door just won't open.
What's going on?
I have connected each button to a counter starting on 0, with the button increasing the counter by one. The counters are connected to a script entity, which they trigger on any event. There's a fifth button which only resets the counters in case the player made a mistake. Now this is my script:
Code: Select all
function door()
if counter_1:getValue() == 1 and
counter_2:getValue() == 2 and
counter_3:getValue() == 1 and
counter_4:getValue() == 3 then
dungeon_door_portcullis_2:open()
end
endWhat's going on?