Announcement: Why not try our official idea generator for inspiration when making puzzles?


Caravel Forum : DROD Boards : Architecture : How to Script a Challenge (The End command is not your friend.)
New Topic New Poll Post Reply
Poster Message
Dragon Fogel
Level: Smitemaster
Rank Points: 2482
Registered: 06-21-2014
IP: Logged
icon How to Script a Challenge (+4)  
As fun as it can be to include challenges in your hold, it's easy to get it wrong. I've done it myself. So I thought it would be good to put down some sample code for people to look at in order to avoid common problems.

These are the main common pitfalls in challenge scripting, put in a spoiler so that you don't have to scroll past them when checking for the sample script:

Click here to view the secret text


So how can you avoid those issues? Well, here's some sample code. (I based this example on the scripting for Xindaris' entry The Persistence of Briar in the Arky's Revenge contest.)

For a challenge that involves "don't do something":

Click here to view the secret text


It's not hard to vary that for a challenge that involves doing something and then clearing the room. For convenience I've copied the code and made the appropriate tweaks.

Click here to view the secret text


If you're checking for multiple things (for instance, a challenge that involves not turning your sword and also stepping on a pressure plate), then have a separate version of Character 1 for each thing you're checking, obviously using different variables for each. That will be easier than trying to make one character do a bunch of different checks. You can then just check all the conditions at once when the room is clear.

If a challenge isn't directly checking if the player does or doesn't do something, it might be checking whether or not something is true (say, a door is closed) at the end of the room. In that case, you would use the Character 2 code and do a check for whatever else you're looking at before awarding the challenge.

If you're doing some weird other check, well, I don't know what that might be, but you can probably adapt the structure of the example regardless.

How the code works:
Click here to view the secret text



[Last edited by Dragon Fogel at 10-30-2019 07:44 PM]
10-14-2019 at 05:39 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Architecture : How to Script a Challenge (The End command is not your friend.)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.