ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Random Selection

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Random Selection

Postby Aguadiablo2 » Tue Dec 31, 2019 12:58 pm

Is it possible to move a character or object by random selection?

For example, if there was a bag of multi-coloured balls, and I wanted to have a player draw the ball randomly and have the actual ball.
I'm thinking that the bag would be a container with the 'Object is a container' property.
The balls would be separate dynamic objects that had the 'Initial Location' of 'Inside Object' 'bag'.
The player could enter 'draw ball' as a command which triggers a task with an action that would set a variable to a random colour.
As well as an action that would move the ball that matched the variable.

Another example, if there was a deck of cards with each of cards being a dynamic object in a deck of cards static object container.
The player could draw a card as a command which would set a variable to one of the 52 cards and the matching card would be moved from the container
onto a table that is a static supporter object.

Or maybe a character moves into a new location that would trigger a task that sets a variable to a random identifier that might match a new property.
Then the character with the matching property appears in that location. Like a random enemy NPC spawn or something.
Aguadiablo2
 
Posts: 11
Joined: Tue Dec 31, 2019 12:42 pm

Re: Random Selection

Postby The0didactus » Thu Jan 02, 2020 5:38 pm

Hello Aguadiablo,
I make heavy use of randomization in my games, especially random movement. There are a few ways to make ADRIFT do this. I'll tell you two:

THE EASY WAY: When you use the command "move [x] to a location in group [y]" the game will move whatever "x" is to ANY RANDOM location in group y. This can be use to create random movement. It can also be used to randomize other aspects of the game. For example, to create a deck of cards, you can create a few rooms "off stage" the player never sees. One is called THE BAG another HAND ONE and another HAND TWO and another HAND THREE. Hand one, hand two, and hand three are all in location group "draw". Then make an action that moves an object from THE BAG to any location in group "draw"...then make an action that automatically moves any object in HAND ONE to the player's inventory.

THE NORMAL WAY: Variables. Make a secret Variable called "roller" which the game automatically sets to a number between 1 and 10. Then make 10 actions, all with the command DRAW A CARD. Make action 1 have the requirement "roller must be equal to 1", make action 2 have the requirement "roller must be equal to 2" etc. Make all the actions have different outcomes.

You can create a "random monster generator" this way. Have an event called "monsterizer" that
* sets roller to a random number between 1 and 10
* then runs 10 (or however many) tasks that moves a monster to the player's location, each task has the requirement "roller must be equal to 1" "roller must be equal to 2" "roller must be less than 3" etc.

You can also use this to create an RPG "roller" system that has successes and failures for various tasks. Essentially you create a "success" and a "failure" task, both triggered with the same command, but one has the requirement "roller+skill must be less than 5" and the other has the requirement "roller+kill must be greater than 5". I've used some variation on this system in every game I've made, and you can read the basic system here:

viewtopic.php?f=14&t=12513&hilit=theo
The0didactus
 
Posts: 286
Joined: Sun Mar 30, 2014 8:20 pm
Points: 150

Re: Random Selection

Postby Aguadiablo2 » Thu Jan 02, 2020 6:10 pm

Thank you The0didactus, I have come up with a system which I think is similar to your normal way method. Where I have two events that should draw two cards. Each event tries to move each card but with a restriction based on two different variables. However, I'm using a text array to set the variables. Each entry on the array is the name of a card e.g. Three of Clubs. For most of the cards, this works, but there seems to be an issue where the system task won't trigger and move the card despite the setting of the variable.

Any ideas?
Aguadiablo2
 
Posts: 11
Joined: Tue Dec 31, 2019 12:42 pm

Re: Random Selection

Postby DazaKiwi » Thu Jan 02, 2020 9:44 pm

Perhaps you could upload your game/demo so we can have a look, there is an option for this to upload file in the full editor when posting.

What is suppose to trigger the system task you mentioned? (as these system tasks have to be called by another task or an event in order to trigger/call a task.
User avatar
DazaKiwi
 
Posts: 740
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 61

Re: Random Selection

Postby Aguadiablo2 » Sat Jan 04, 2020 3:21 pm

It's all being triggered by an event.
Attachments
blackjack.taf
(23.44 KiB) Downloaded 50 times
Aguadiablo2
 
Posts: 11
Joined: Tue Dec 31, 2019 12:42 pm


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 3 guests

cron