Help with check if all of one condition is satisfied.

120 views
Skip to first unread message

Blake Regehr

unread,
Apr 20, 2018, 6:49:23 PM4/20/18
to PuzzleScript
Hi! I'm making a game where you need to put a jewel onto three podiums. Once there is a jewel on each podium, the vines retreat. How do I check if all three podiums have been filled, and them set off an event?

Stephen Lavelle

unread,
Apr 20, 2018, 7:07:11 PM4/20/18
to Blake Regehr, PuzzleScript
you could have three gem types (even if they all look the same), using the fact that the random keyword causes a rule to be applied at most once (at random)

in the legend section:

gemmarker = G1 or G2 or G3


late random [podium gem no gemMarker ] -> [ podium G1 ]
late random [podium gem no gemMarker] -> [ podium G2 ]
late random [podium gem no gemMarker] -> [ podium G3 ]

(remove vines)
late random [G1] [G2] [G3] [vine] -> [G1] [G2] [G3] [no vine]

(remove gem markers)
late [gemmarker]->[]

2018-04-21 0:49 GMT+02:00 Blake Regehr <family...@gmail.com>:
Hi! I'm making a game where you need to put a jewel onto three podiums. Once there is a jewel on each podium, the vines retreat. How do I check if all three podiums have been filled, and them set off an event?

--
You received this message because you are subscribed to the Google Groups "PuzzleScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stephen Lavelle

unread,
Apr 20, 2018, 7:09:06 PM4/20/18
to Blake Regehr, PuzzleScript
(by gem types i mean gem marker types i guess! just as temporary placeholders that only exist during computations, so the player never sees them)

Chyme

unread,
Apr 20, 2018, 7:12:30 PM4/20/18
to PuzzleScript
You can check for multiple objects in one line, so if you made each podium unique you could maybe do something like this:

[ Jewel Podium1 ] [ Jewel Podium2 ] [ Jewel Podium3 ] [ Vines ] -> [ Jewel Podium1 ] [ Jewel Podium2 ] [ Jewel Podium3 ] [  ] 

I'm pretty new to puzzlescript so hopefully that works... and if it doesn't maybe someone can correct it and help you out. But give that a try!

Blake Regehr

unread,
Apr 20, 2018, 9:27:54 PM4/20/18
to PuzzleScript
Thank you for all of your responses! I forgot to add that in some levels there are different amounts of podiums and gems, so having a set number of markers wouldn't work. Is there a way to check if all gems are on all podiums?

Alan Hazelden

unread,
Apr 21, 2018, 12:12:50 AM4/21/18
to Blake Regehr, PuzzleScript
If all gems are on podiums, that means there is no gem that is not on a podium (assuming the same number of each).

So you can do something like this:

[ Gem ] -> [ action Gem ] (mark all gems)
[ Gem no Podium ] [ action Gem ] -> [ Gem ] [ stationary Gem ] (if there is any gem not on a podium, unmark all gems)
[ action Gem ] [ Vine ] -> [ action Gem ] [ RetreatingVine ] (if there is any marked gem, make vines retreat)

--

Hand-E-Food

unread,
Apr 21, 2018, 2:41:54 AM4/21/18
to PuzzleScript
I completely agree with Alan's answer.  Just realise it won't work if you do it in late clauses.  You may need your own moving code.  Or you can replace action with an object named something like Ready.

That Scar

unread,
Apr 21, 2018, 7:04:43 AM4/21/18
to PuzzleScript
If you can have the level end right there, you can just add a rule to the win conditions such as "all gem on podium" or "all podium on gem" or both.
Ending a level does not mean it has to instantly transition to the next but it does mean the levels have to be all linear and the player has to stand in a specific spot or they will get teleported.
The Flames is a very good example of this: when you start the game and when you move between levels, the camera slowly shifts with you but that is an illusion! What's really happening is that each time the player reaches the rightmost tile, the win condition is satisfied and the next level is loaded but it looks exactly the same and the player is in the same place, except the camera is shifted slightly.
This approach might be easier if you don't understand puzzlescript "rules" that well but, otherwise, all the other suggestions were pretty good.
Reply all
Reply to author
Forward
0 new messages