ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Randomly Appearing Object.

This forum is the place to discuss the older ADRIFT versions 3.9 and 4.0.

Please refer to the ADRIFT 4 Manual for more information.

Postby CrypticWizard » Sun Oct 31, 2010 6:45 pm

At one point, the player will enter a network of passages in every direction, sort of like a maze. No matter what direction the player travels in, it will just return them back to the same room. This part is simple enough to do. The tough part is that every so often, there is an object that is supposed to appear in the maze. But I want the object to appear at random. For example, there should be a 30% chance every time the player is sent back to this room that the object will appear. Does anyone know of a way to set up this random check?
Once upon a time, nothing happened at all. Really, nothing!

In the beginning, the universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
User avatar
CrypticWizard
 
Posts: 21
Joined: Mon Apr 12, 2004 4:52 pm
Location: Bakersfield, CA

Postby P/o Prune » Sun Oct 31, 2010 7:08 pm

V.4 or V.5 ?
D-Day in progress 86Kb (Slowly drifting)
Just a Fairy Tale: 64Kb
User avatar
P/o Prune
Site Admin
 
Posts: 4426
Joined: Mon Jun 24, 2002 8:18 am
Location: Denmark
Points: 58

Postby CrypticWizard » Sun Oct 31, 2010 7:16 pm

Oh, sorry...I'm working on this adventure with version 4...I can't seem to get vet v4 files to work on v5 and I did't have v5 when I started this game, so I am working on it with v4.
Once upon a time, nothing happened at all. Really, nothing!

In the beginning, the universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
User avatar
CrypticWizard
 
Posts: 21
Joined: Mon Apr 12, 2004 4:52 pm
Location: Bakersfield, CA

Postby ralphmerridew » Mon Nov 01, 2010 4:13 pm

One method ...

Create a special room "Transporter Room"

Create a nonrepeatable task "#Produce Object"
Condition: variable %rand_val% is less than 30
Action: move the object to Network Room.

Create a repeatable task "# Move player back to network room"
Runs only in transporter room
Action: Set %rand_val% to random number from 0 to 99.
Action: Run task "#Produce Object"
Action: Move player to Network Room

Create an event "Move player out of Transport Room"
Starts immediately, lasts 1 turn, resets on end.
Runs task "# Move player back to network room"

Have every exit from Network room go to transport room.
Bloodhounds can make you laugh and cuss in the same breath. They are endearing, faithful, and can sling drool ten feet in any direction. -- Virginia Lanier
User avatar
ralphmerridew
 
Posts: 2574
Joined: Fri Dec 13, 2002 11:56 pm
Location: Missouri
Points: 10

Postby CrypticWizard » Mon Nov 01, 2010 5:21 pm

Create a nonrepeatable task "#Produce Object"
Condition: variable %rand_val% is less than 30
Action: move the object to Network Room.



Couldn't I just use that method for the object to appear without creating the extra room? Or is this "Transporter Room" you mentioned a buffer zone where the player never actually goes?

I thought of another method to this puzzle that might be easier. I can create six indentical rooms (at least in description), and have them link together (for example, if the player moves west from the westmost room, they will appear in the eastmost room), so it will appear that they are moving through identical endless passages, and have the object appear in only one of the network of rooms. Is there a way to randomly decide which room it appears in?

And while I am on the subject of random occurrences, there is a magic spell in the game that will teleport the player to one of five location, and I want that also to be random. How would I do that? I have the spell ready, but I wanted to finish this maze first.
Once upon a time, nothing happened at all. Really, nothing!

In the beginning, the universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
User avatar
CrypticWizard
 
Posts: 21
Joined: Mon Apr 12, 2004 4:52 pm
Location: Bakersfield, CA

Postby Duncan_B » Tue Nov 02, 2010 6:40 am

I want that also to be random

Use a variable and a task which sets the variable to a random value. If value = X, player teleports to The Cave of Lollipops, if it's Y, they end up in an underground French restaurant or something.
Duncan_B
 

Postby ralphmerridew » Tue Nov 02, 2010 1:37 pm

The Transport Room is indeed a buffer area where the player doesn't go. It's so that the object will only appear after a turn when the player moves, not when the player stays in place.
Bloodhounds can make you laugh and cuss in the same breath. They are endearing, faithful, and can sling drool ten feet in any direction. -- Virginia Lanier
User avatar
ralphmerridew
 
Posts: 2574
Joined: Fri Dec 13, 2002 11:56 pm
Location: Missouri
Points: 10

Postby CrypticWizard » Tue Nov 02, 2010 5:27 pm

So then, I would also use the variable to decide which room the object appears in, if I go by the six-room network idea? I'm not entirely show how I would set that up, though. The object doesn't move around, so the player has to find it. This object is the key to the player escaping from the maze, so I want to make it a little hard to find just to add some challenge ;)

The Cave of Lollipops is an interesting idea...my game might actually allow for something like that. I just might use that in the game.
Once upon a time, nothing happened at all. Really, nothing!

In the beginning, the universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
User avatar
CrypticWizard
 
Posts: 21
Joined: Mon Apr 12, 2004 4:52 pm
Location: Bakersfield, CA

Postby ralphmerridew » Wed Nov 03, 2010 12:46 am

It might be possible to use a single task action "Move object to random room in roomgroup XXX".

If ADRIFT doesn't support that, change the "#Produce Object" task to run a series of tasks:
Task "#Move to room 1" has no restrictions, and moves the object to room 1.
Task "#Move to room 2" has restriction %rand_val% < 24, and moves it to room 2.
Task "#Move to room 3" has restriction %rand_val% < 18, and moves it to room 3.
and so on.
Task "#Produce Object" must not be repeatable; it doesn't matter whether the subtasks are.

On the other hand, if it's just a random number generator, it doesn't seem to interesting of a challenge.
Bloodhounds can make you laugh and cuss in the same breath. They are endearing, faithful, and can sling drool ten feet in any direction. -- Virginia Lanier
User avatar
ralphmerridew
 
Posts: 2574
Joined: Fri Dec 13, 2002 11:56 pm
Location: Missouri
Points: 10

Postby CrypticWizard » Wed Nov 03, 2010 3:53 pm

Thanks, RalphMerridew, that should work, except that the object never appears in the first room (I can't make it that easy, can I?), so I just omit that task. I can add the other restrictions for where it appears.

In fact, I think I will just have it produce a random number between 1 and 5 and have it send the object to a room of the maze depending on that number--there are six maze rooms, but the room of entry will be considered room 0 for the purposes of this event.

Of course, the player can get lost in this series of passages. The old trick of dropping an item in each room to sort of leave a trail won't work in this game (yes, I'm evil ]:) , I know).
Once upon a time, nothing happened at all. Really, nothing!

In the beginning, the universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
User avatar
CrypticWizard
 
Posts: 21
Joined: Mon Apr 12, 2004 4:52 pm
Location: Bakersfield, CA

Postby Duncan_B » Wed Nov 03, 2010 10:33 pm

So, you're creating a maze with no way for the player to tell where they are or how their movements affect their standing in the maze? No, wait, actually, let me back up.

Why a maze? What's going on while the player is in this maze? And why should the solution be found at random?
Duncan_B
 

Postby CrypticWizard » Thu Nov 04, 2010 5:26 pm

Yes, there is no way for the player to know where they are in the "maze." The reason for this is because it was originally supposed to be one room with all directions leading the player back to that same room. If players could drop items to track their movements, it would quickly obvious that they are in one room only and it would appear there is no way out (until the proper object appears).

There is actually a different reason why they can't drop objects, which has to do with the fact that they won't be carrying any, but I won't go into that as the game is still incomplete.

As for why the maze--death in this game is not permanent. The maze is one place a player might fnd themselves after dying, and completing it is a way to get returned to life.
Once upon a time, nothing happened at all. Really, nothing!

In the beginning, the universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
User avatar
CrypticWizard
 
Posts: 21
Joined: Mon Apr 12, 2004 4:52 pm
Location: Bakersfield, CA


Return to ADRIFT 3.9 and 4.0

Who is online

Users browsing this forum: No registered users and 4 guests