Jump to content

Photo

Hamiltonian Path


  • Please log in to reply
8 replies to this topic

#1 Avaro

Avaro

    >w<

  • Members

Posted 10 April 2012 - 07:23 PM

QUOTE(Beefster @ Apr 10 2012, 09:48 PM) View Post
Hamiltonian Path (AKA painting the floor)
The idea of these is to step on every tile in an area exactly once. They're apparently possible to implement without scripting, though I don't have any idea how.

You can make them solvable by designing the solution, then building solid objects around that.
^ Read if you don't know what a Hamiltonian Path puzzle is.

I have written a setup for those who want to make such a puzzle. It only works in 2.5, because I'm using scripts.
A big pro is, that this doesn't use the secret system of ZC, so you could have a block puzzle or another trigger in the same screen if you want. Go to 4) to see how this will work.

1) The tiles
You need 3 tiles (not 3 combos, 3 graphics): A tile that has not been stepped on, the tile that is active, and a tile that has been stepped on already (the third is an unwalkable tile, so make it look like such). I used a green floor tile for the first, an orange floor tile for the second and a red for the third, but you can do the colours how you want.
You also need a tile for a block that disappears when the puzzle is solved.

2) Setting up the combos
This is how you set up the combos in the combo table. You can just ignore the "Explanations", if you want. You have to do it exactly as this, to prevent bugs.

All combos:
Restart Animation when Cycled To: Checked
Flag: 67 No Push Blocks (if you want)

1. combo:
Graphic: green tile
Combo Cycle: none
Frames: 0
Speed: 0
Type: Step->Next

2. combo:
Graphic: green tile
Combo Cycle: none
Frames: 0
Speed: 0
Type: none
Explanation: This combo is used for the sound effect to play when Link steps on the green tile. To determine what sfx you want to use, look at the script section.

3. combo: (this HAS to come after the 2. combo in the combo table)
Graphic: orange tile
Combo Cycle: to the 4. combo.
Frames: 1
Speed: 0
Type: none
Explanation: This combo is used to make the 4. combo restart it's animation, since it would not restart if it's changed to, by the sound combo script

4. combo:
Graphic: orange tile
Combo Cycle: to the 5. combo.
Frames: 1
Speed: 1
Type: none
Explanation: This combo is used for the script, to make the 5. combo change to the 6. combo if this combo is on screen

5. combo:
Graphic: orange tile
Combo Cycle: none
Frames: 0
Speed: 0
Type: none

6. combo: (this HAS to come after the 5. in the combo table)
You have to make this combo unwalkable, since Link is not allowed to step on it again.
Graphic: red tile
Combo Cycle: none
Frames: 0
Speed: 0
Type: none

7. combo:
Unwalkable
Graphic: the block that will disappear when the puzzle is solved
Combo Cycle: none
Frames: 0
Speed: 0
Type: none

8. combo: (this HAS to come after the 7. in the combo table)
Unwalkable
Graphic: the block that will disappear when the puzzle is solved
Combo Cycle: none
Frames: 0
Speed: 0
Type: none
Explanation: This combo is used for the secret sound effect, that plays when you have solved the puzzle

9. combo: (this HAS to come after the 8. in the combo table)
Graphic: the disappeared block (a normal floor tile or something like that)
Combo Cycle: none
Frames: 0
Speed: 0
Type: none

3) Setting up the scripts
You need 3 scripts for this. The "ChangeCombosIfFound" script, the "ChangeCombosIfNotFound", the "SoundCombo" script and the "GiveUp" script. Here they are:
Scripts

In every screen where you want to make such a puzzle, you have to place 4 FFC's with scripts attached to. If you want the player to be able to restart the puzzle you also need a 5. FFC. Give these FFC's an invisible graphic (Note: Do not use Combo 0). You don't have to place them somewhere on the screen, just leave them at the top left corner.

1. FFC:
Script: changeCombosIfFound
Arguments
D0: Combo ID of the 4. Combo
D1: Combo ID of the 5. Combo

2. FFC:
Script: changeCombosIfNotFound
Arguments
D0: Combo ID of the 1. Combo
D1: Combo ID of the 7. Combo

3. FFC:
Script: soundCombo
Arguments
D0: Combo ID of the 2. Combo
D1: The ID of the SFX to play when you step on a green tile

4. FFC:
Script: soundCombo
Arguments
D0: Combo ID of the 8. Combo
D1: The ID of the SFX to play when you have solved the puzzle (27 would be the secret sound)

5. FFC:
Script: giveUp
Arguments
none
This script will make it possible to reset the screen if L is pressed. It will warp you to the screen where you are, so you have to set the blue warp return point A.

4) Placing the Puzzle
You only need to place the 1. combo, to make the puzzle and the 7. combo for the block that will disappear when the puzzle is solved. Only place the combos on layer 0.

This is how it will work: When Link steps on one of the green tiles, it will turn into an orange tile. The orange is still walkable. Now if Link steps on another green tile, the orange tile will turn into the red unwalkable tile. When Link has stepped on all green tiles, the block will disappear. You can still use secrets in this screen. That means you could combine this puzzle with a normal block puzzle in the same screen if you want.

I know, there might be easier ways to do this via scripts, but this will work without any problems.
Now make some puzzles ;D

Edited by Avataro, 14 April 2012 - 09:53 AM.


#2 judasrising

judasrising

    I play guitar

  • Members
  • Location:Sweden but born in Finland

Posted 11 April 2012 - 01:19 PM

icon_smile.gif

Hi Avataro

Do you might have a test quest about that stuff?


#3 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 11 April 2012 - 01:46 PM

Thanks for the tutorial! I might even use this in my project. I would recommend that this be moved to the Tutorials forum, since this is essentially a tutorial.

You're welcome for the scripts, by the way.

#4 cavthena

cavthena

    Apprentice

  • Members
  • Real Name:Clayton
  • Location:I wish I knew

Posted 11 April 2012 - 02:33 PM

QUOTE(Avataro @ Apr 10 2012, 05:23 PM) View Post

6. combo: (this HAS to come after the 5. in the combo table)
You have to make this combo unwalkable, since Link is not allowed to step on it again.
Graphic: red tile
Combo Cycle: none
Frames: 0
Speed: 0
Type: none


Shouldn't this be set to rest room type? Currently its possible to get Link stuck if the player messes up at the puzzle and finds them self surrounded by red tiles.

#5 Avaro

Avaro

    >w<

  • Members

Posted 11 April 2012 - 04:11 PM

QUOTE(cavthena @ Apr 11 2012, 09:33 PM) View Post

Shouldn't this be set to rest room type? Currently its possible to get Link stuck if the player messes up at the puzzle and finds them self surrounded by red tiles.

If the 6. combo would be a reset room type combo, then it would be walkable. That means it would be possible to cheat if diagonal walking is enabled, because the reset room type combos are not sensitive enough. I have also though about changing the red combos into instant death combo types, but that would not make any sense.

#6 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 11 April 2012 - 11:01 PM

You know, I bet I could script this using a single FFC script and much fewer combos. I'll post it here when it's done.

Update: Just for starters, here's an emergency reset script in case the puzzle can get you stuck. Press L (or replace "PressL" with another button name) to warp to the screen you're on, effectively resetting the puzzle.
GiveUp script


Also, here's a modification of changeIfNotFound that uses screen secrets instead of changing combos manually (removes the need for combos 7-9)
secretsIfNotFound


Update 2: I'm having trouble with this combined script. Argh.
Update 3: All done! This one only needs three, count 'em, THREE combos (the barrier is handled by screen secrets), and one, count 'em, ONE FFC to work.
Complete script below

Once I'm done testing it, Avataro, would you mind if I submitted it to the DB?

Edited by MoscowModder, 13 April 2012 - 06:42 PM.


#7 Avaro

Avaro

    >w<

  • Members

Posted 12 April 2012 - 05:41 AM

I think the 9 combo version is better, because is does not use the secret system, but still makes the secret sound play. It allows for more advanced puzzles.

I wouldn't mind if you submit yours, though.
Thank you so much for the GiveUp script. I'll add it to the tutorial. And yes this thread should be moved to the tutorial submissions.

#8 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 12 April 2012 - 09:29 AM

My version should be more efficient since it reduces the number of times every combo is checked per frame. But since you mentioned it, here's a version that can work like the old one. Check the documentation for D4 to see how it works.

With this version, the number of combos needed rises to five (unless you set D4 to 0 or -1 for secrets mode, in which case it's still 3).

Update: Tested and enhanced. Now it prevents Link from jumping over non-activated tiles, too. Please bugtest if you want to see this in the DB!
Updated version

Edited by MoscowModder, 13 April 2012 - 08:08 PM.


#9 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 April 2012 - 06:44 PM

I updated the script above. You should try it out.

Found a bug: Doesn't re-apply the combo change if you use Screen->D[] mode, finish the puzzle, and then leave and re-enter the room. Working on it... Fixed! Note that I changed the values for the permanence option so that you can use all 8 Screen->D[] values.

Edited by MoscowModder, 13 April 2012 - 08:09 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users