Oops. I meant to include a section on how to script the challenge in-game. I’ll just do that here. There are many different ways to do this, so I’ll just write out how I would do it.
To use DRODscript, you need to first place a scripting character somewhere in the room. This is the green-haired citizen at the bottom-right of the monster tab. This character is normally invisible, so the player won’t see it while playing the room. Put it wherever you want.
Adding a variable to your hold:
Click here to view the secret text
×Also, while it’s not necessary in this case, I like to use a variable to track challenge success and failure, so I’ll also walk through creating a variable and will use it for this example. To create a variable (let’s call it ChallengeFail) click on the scripting character to open the script screen. Next click “Add Command” and go to “Set var”. Type “ChallengeFail” into the Variable Name textbox and click the Add button. We now have a ChallengeFail variable that we can use throughout the hold. Cancel out of everything until you are back in the initial scripting screen.
Scripting the challenge:
I’m going to just list the lines of code that I would use here. Every new line begins with >
for ease of reading this text. Comments will follow each line explaining why I am using it. Comment lines begin with // and don’t need to be added to your scripting.
Click here to view the secret text
×
>If…
>Wait for clean room
//These two lines of code together mean that whatever is in the “if-block” will only run if the room is cleared on turn 0, ie. the player already beat the room and has entered it again.
>Set var: ChallengeFail, Assign 1
//We don’t want the player getting the challenge after the room is already cleared, so this prevents them from being awarded the challenge just for entering the room after already beating it.
>Else
>Set var: ChallengeFail, Assign 0
//I use the same ChallengeFail variable to check all challenges in my hold. Setting it to 0 at the start of the room makes sure that the player failing a challenge somewhere else in the hold won’t affect them in this room. The two lines of code starting with Else will only run if the preceding if statement was false, which in this case means that the room hasn’t been solved yet.
>If End
//We are done with the If statement now. All the If statement is doing is checking if the room was clear or not on turn 0.
>Wait for door to: Close, click on the door at (30,11) that would cut the fuse
//The script won’t continue to run until the door is closed. If the door is never closed, the script will wait here, which is what we want.
>Set var ChallengeFail, Assign 1
//My convention for challenges is that is ChallengeFail is 0 when the room is cleared then the challenge is successful, while if it is 1 then the challenge is failed. You can do this however you like; the values I’m using are arbitrary.
Okay, so that’s the character that handles the ChallengeFail variable. We now need to make a second character to award the challenge to the player. Create a second character. This could technically go anywhere in the room.
>Wait for clean room
//We only want the challenge to be awarded if the player actually finishes the room.
>Wait for entity Player: draw a rectangle covering all of the room from the scroll outward, covering both entrances
//Since it’s possible for the player to clear the room but be trapped behind a door, and it’s possible for the player to be efficient and be anywhere in the room when the bomb explodes, we need to check this whole area for the player to make sure that the challenge is only being awarded if the player can leave the room. My coordinates were (22,7)-(37,31) on this script, which covers the area nicely. You could have it only check for the player at the exits of the room, but that might confuse players as to why they haven’t gotten their challenge yet. This rectangle happens to line up with the scroll, which makes a nice visual boundary indicator for the player, so a slow player will get the challenge for stepping on the scroll, but a faster player will get the challenge somewhere past it.
>If…
>Wait until var: ChallengeFail Equals 0
//Finally, we check that the player hasn’t failed the challenge. If they hit the orb and closed the door, ChallengeFail will be 1 and the rest of this code won’t run.
>Challenge completed: No Orb
//Type whatever clever or descriptive challenge name you want into the text box. I deliberately chose something boring to make this code easily readable, but you should probably name the challenge something better.
>If End
//Not necessary here, but I like using If End after all my If statements just to make it easier for me to read my own code later.
Since that’s really messy to read with all the comments, here is what the final script should look like one more time. Since I don’t have comments this time, I will also not write >
for new lines. If you followed the above instructions correctly, your code should look exactly like this:
Click here to view the secret text
×Character 1 (dealing with ChallengeFail variable):
If …
Wait for clean room
Set var ChallengeFail = 1
Else
Set var ChallengeFail = 0
If End
Wait for door to Close at (30,11)
Set var ChallengeFail = 1
Character 2 (awards the challenge once room is cleared and exited)
Wait for clean room
Wait for entity Player at (22,7)-(37,31)
If …
Wait until var ChallengeFail = 0
Challenge completed “No Orb”
If End
One final note: some architects include seeding beacons in rooms with challenges, so that the player can beat the room, move on, and later come back, use the beacon, and attempt the challenge. It’s up to you if you want to include beacons in your hold for this purpose or not.
____________________________
106th Skywatcher