Author Topic: Puzzle problems  (Read 8794 times)

Cthulhu

  • Posts: 6
  • Pot Breaker
    • View Profile
Puzzle problems
« on: October 12, 2013, 02:02:09 PM »
So here's the deal, i want to make a pretty simple puzzle, but i can't seem to figure out how to do it.  :/

Mainly, it's a simple button puzzle, you press the buttons in the correct order and that opens a certain door.



I can do some decent scripting but this is where i need help :D
Before you judge a man, walk a mile in his shoes; after that, who cares?! He's a mile away and you've got his shoes!

NekoBaron

  • Posts: 124
  • Scripting Wizard
    • View Profile
Re: Puzzle problems
« Reply #1 on: October 12, 2013, 02:34:29 PM »
You will want 2 counters, 1 counter will track how many have been pressed and the other counts how many were correct.

Each time a button is pressed:
Check the button counter is equal to the order you want it pressed in (IE on the first button you want to be correct use a check to see if the button counter is = 0, if true add 1 to the correct counter)
Use a disable element on the area check so the button cant be repressed again instantly.
Add 1 to the button counter with a delay of 100.
Check if button counter is = 5 with a delay of 200

If true then all buttons have been pressed, so on the true output you do a check to see if the correct counter =  5.

If its true you can activate whatever you want.

If its false you set both counters back to 0
change the buttons doodads to pop back up, you can link a single change doodadstate to all of em. Add a delay of 1000
use enable element on all of the area checks so they buttons can be pressed again, with a delay of 1100.


I'm not brilliant at explaining it in words but if you can follow it you should have a functioning puzzle.
If you want it random every play through it becomes a bit more complexed but its possible, just a lot harder to explain in chat.

Cthulhu

  • Posts: 6
  • Pot Breaker
    • View Profile
Re: Puzzle problems
« Reply #2 on: October 12, 2013, 03:21:59 PM »
Thank you so much for having the time to answer :D I'm gonna give it a shot and see what comes out of it :P
Before you judge a man, walk a mile in his shoes; after that, who cares?! He's a mile away and you've got his shoes!

NekoBaron

  • Posts: 124
  • Scripting Wizard
    • View Profile
Re: Puzzle problems
« Reply #3 on: October 12, 2013, 04:04:35 PM »
I will probably do a tutorial for a 3 button one at some point for the wiki.

Made a few complexed puzzle my self http://hammerwatch.com/forum/index.php?topic=1739.0 theyre a total mess to look at if you saw em in the editor.

Cthulhu

  • Posts: 6
  • Pot Breaker
    • View Profile
Re: Puzzle problems
« Reply #4 on: October 12, 2013, 04:14:28 PM »
You will want 2 counters, 1 counter will track how many have been pressed and the other counts how many were correct.

Each time a button is pressed:
Check the button counter is equal to the order you want it pressed in (IE on the first button you want to be correct use a check to see if the button counter is = 0, if true add 1 to the correct counter)
Use a disable element on the area check so the button cant be repressed again instantly.
Add 1 to the button counter with a delay of 100.
Check if button counter is = 5 with a delay of 200

If true then all buttons have been pressed, so on the true output you do a check to see if the correct counter =  5.

If its true you can activate whatever you want.

If its false you set both counters back to 0
change the buttons doodads to pop back up, you can link a single change doodadstate to all of em. Add a delay of 1000
use enable element on all of the area checks so they buttons can be pressed again, with a delay of 1100.


I'm not brilliant at explaining it in words but if you can follow it you should have a functioning puzzle.
If you want it random every play through it becomes a bit more complexed but its possible, just a lot harder to explain in chat.

Hmm... i tried it but i can't seem to wrap my head around it...
Is it possible for you to do a quick map with the scripting in it? If you have the time of course :)
Before you judge a man, walk a mile in his shoes; after that, who cares?! He's a mile away and you've got his shoes!

Cthulhu

  • Posts: 6
  • Pot Breaker
    • View Profile
Re: Puzzle problems
« Reply #5 on: October 12, 2013, 04:16:40 PM »
I will probably do a tutorial for a 3 button one at some point for the wiki.

Made a few complexed puzzle my self http://hammerwatch.com/forum/index.php?topic=1739.0 theyre a total mess to look at if you saw em in the editor.

Ah yes, i looked at this and it looked really complicated :D But great work! I can't really do anything like that with this little knowledge i have about scripting XD
Before you judge a man, walk a mile in his shoes; after that, who cares?! He's a mile away and you've got his shoes!

NekoBaron

  • Posts: 124
  • Scripting Wizard
    • View Profile
Re: Puzzle problems
« Reply #6 on: October 12, 2013, 05:04:30 PM »
Took a bit, and made a few mistakes since I made all of it before testing but it works now, only 4 buttons though and not randomised.

https://www.dropbox.com/s/cid0a73dqsxfbcz/puzzle_I.xml

Cthulhu

  • Posts: 6
  • Pot Breaker
    • View Profile
Re: Puzzle problems
« Reply #7 on: October 12, 2013, 08:33:36 PM »
Took a bit, and made a few mistakes since I made all of it before testing but it works now, only 4 buttons though and not randomised.

https://www.dropbox.com/s/cid0a73dqsxfbcz/puzzle_I.xml

That is just the script i need :D
I need to figure out how you did that so i can learn to do it myself too :P

I can however reduce the buttons to 4 in my puzzle and use your script on it for the time being if that's okay?
Before you judge a man, walk a mile in his shoes; after that, who cares?! He's a mile away and you've got his shoes!

NekoBaron

  • Posts: 124
  • Scripting Wizard
    • View Profile
Re: Puzzle problems
« Reply #8 on: October 12, 2013, 09:40:32 PM »
Just leave a lil credit note somewhere and its fine, I intend to release my puzzle pack for free at some point anyway.

Plus I like playing with the scripting objects anyway.

Cthulhu

  • Posts: 6
  • Pot Breaker
    • View Profile
Re: Puzzle problems
« Reply #9 on: October 12, 2013, 10:20:53 PM »
Just leave a lil credit note somewhere and its fine, I intend to release my puzzle pack for free at some point anyway.

Plus I like playing with the scripting objects anyway.

I will :P Thanks a lot for helping ^^

I really need to start studying these scripts and try to make something more complicated out of them...
Before you judge a man, walk a mile in his shoes; after that, who cares?! He's a mile away and you've got his shoes!