ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Creating loot tables and random encounters

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.

Creating loot tables and random encounters

Postby trivega » Fri May 06, 2016 11:54 am

Hey, its me again. The last two things I'm trying to figure out before I can buckle down into my project is creating random tables for loot and encounters. I've learned to do arrays, and use the rand expression, but stuck beyond that. Shock that I can't really find another forum topic covering this, nor any combat/loot libraries/mods have been created for 5.0 after all this time.

1. The first would be Loot tables. A simple example would be an action. Let's say I want the player to " explore the woods " and get some random loot. What would that look like? Changing variables is one thing, but what if some of that random loot gives the player a random object?

2. Random Encounters. Now lets take that same situation of " explore the woods " and how would I go about creating encounters? Some sort of task that pulls from a random table, and summons forth a enemy character?

I also plan to combine these at some point so defeating a random enemy may drop random loot. I plan to keep my combat basic, but more of an excuse to use more random tables.

Cheers.
trivega
 
Posts: 5
Joined: Thu Apr 28, 2016 3:17 pm

Re: Creating loot tables and random encounters

Postby Lazzah » Fri May 06, 2016 2:18 pm

trivega wrote:Hey, its me again. The last two things I'm trying to figure out before I can buckle down into my project is creating random tables for loot and encounters. I've learned to do arrays, and use the rand expression, but stuck beyond that. Shock that I can't really find another forum topic covering this, nor any combat/loot libraries/mods have been created for 5.0 after all this time.

Maybe that is because ADRIFT5 is designed for creating interactive fiction games (i.e. text adventures), not the RPG-type game that you are trying to use ADRIFT5 to create. There are much better programs for creating RPG's out there, but of course you have to pay for those, whereas ADRIFT5 is free.
OUT NOW: Run, Bronwynn, Run!
Current W.I.P.: Magnetic Moon
Also available: The Axe of Kolt, The Spectre of Castle Coris, The Fortress of Fear, Die Feuerfaust - The Fist of Fire and The Lost Children
User avatar
Lazzah
Moderator
 
Posts: 2131
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England
Points: 17

Re: Creating loot tables and random encounters

Postby ElliotM » Fri May 06, 2016 4:50 pm

One reason why no one has done loot tables in Adrift 5 is because it doesn't have tables and doesn't create objects, as they are all considered unique and you must make all of them yourself before hand. I did figure out a way to randomly select an object from a container which could be applied to a group but it isn't a simple system to set up: viewtopic.php?f=14&t=11387&hilit=random

Random encounters would require something similar. You will have a main task which will 'roll' a random number for you and you will have one task per unique event that has a restriction based on that number. The main task will roll the number and then try to execute each of the tasks which will then only run if they match the randomly rolled number.
ElliotM
 
Posts: 1227
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA
Points: 13

Re: Creating loot tables and random encounters

Postby Jjbee62 » Fri May 06, 2016 6:44 pm

trivega wrote:Hey, its me again. The last two things I'm trying to figure out before I can buckle down into my project is creating random tables for loot and encounters. I've learned to do arrays, and use the rand expression, but stuck beyond that. Shock that I can't really find another forum topic covering this, nor any combat/loot libraries/mods have been created for 5.0 after all this time.

1. The first would be Loot tables. A simple example would be an action. Let's say I want the player to " explore the woods " and get some random loot. What would that look like? Changing variables is one thing, but what if some of that random loot gives the player a random object?

2. Random Encounters. Now lets take that same situation of " explore the woods " and how would I go about creating encounters? Some sort of task that pulls from a random table, and summons forth a enemy character?

I also plan to combine these at some point so defeating a random enemy may drop random loot. I plan to keep my combat basic, but more of an excuse to use more random tables.

Cheers.


You will need an array plus another number variable and a couple of tasks for each one. The process for each is essentially the same, so I'll just use the random loot as an example

First an array of each possible loot object: Bag of gold, Magic ring, Amulet, etc. Next a variable which is your probability. If the chance of finding random loot in a location is 5% then your variable is 20. If you have several, random loot locations, with different probabilities, put them in an array. You'll need another variable which will be used as a restriction/enabler for your random loot task.

Your first task is a system task that runs whenever the player enters the location, with copies for each random loot location. The task sets your restrict/enable variable based on the results of your random roll. It then calls the second task. Second task, another system task, first checks to see if it is enabled, then sets an index variable to another random roll, based on the number of items in your random loot bag. It then moves the object indicated to the current location.

LootTable[6] = "Bag of Gold", "Magic Ring", "Ruby Amulet", "Soiled Gnome Underwear", "Jeweled Dagger", "Treasure Map"
LootProbability = 50 (2% chance)
LootFound = 0 (set to -1 once loot found in room, set to 1 if random roll succeeds)
LootIndex = 0

LootCheck Task - System Task - Player Enters Location
Restriction - LootFound >= 0
Action - Set LootFound = IF(Rand(1, %LootProbability%) = 1, 1, 0)
Action - Run Task LootSelect

LootSelect Task - System Task - Only if called by event/task
Restriction - LootFound = 1
Action - Set variable LootIndex = Rand(1, 6)
Action - Move Object %LootTable[%LootIndex%]% to location current location
Action - Set variable LootFound = -1
Action - Set variable %LootTable[%LootIndex%]% = "Junk" (With Junk being some completely useless object)

If you want to get tricky, modify the LootProbability by player perception, or magical effects. You can also, instead of making it trigger on entering a location, have it as the result of a search command. I would also make the LootFound variable an array, with an entry for each possible random loot location. You just have to keep track of which index is for each location.

If you want to add a random number of gold coins as an optional loot, make it the last entry in the loot table. Then you'll need another Action with an IF() to award the random number of coins and to keep from overwriting the LootTable entry with "Junk".

Random Encounters is exactly the same, just different variables and tasks.

That should at least give you a starting point.
Jjbee62
 
Posts: 64
Joined: Fri Apr 15, 2016 5:20 pm

Re: Creating loot tables and random encounters

Postby SamuelC » Sat May 14, 2016 4:53 pm

trivega wrote:Hey, its me again. The last two things I'm trying to figure out before I can buckle down into my project is creating random tables for loot and encounters. I've learned to do arrays, and use the rand expression, but stuck beyond that. Shock that I can't really find another forum topic covering this, nor any combat/loot libraries/mods have been created for 5.0 after all this time.

1. The first would be Loot tables. A simple example would be an action. Let's say I want the player to " explore the woods " and get some random loot. What would that look like? Changing variables is one thing, but what if some of that random loot gives the player a random object?

2. Random Encounters. Now lets take that same situation of " explore the woods " and how would I go about creating encounters? Some sort of task that pulls from a random table, and summons forth a enemy character?

I also plan to combine these at some point so defeating a random enemy may drop random loot. I plan to keep my combat basic, but more of an excuse to use more random tables.

Cheers.


1. The best way I can think would be to set up a variable called "Loot" which is an integer value, you then have a task which is set with a restriction like "When (enemy health variable) <1 set Action: Loot variable to random (lowest number on loot table, highest number on loot table) then set a tasks for If loot = (every number on the loot table individually) then action: give player (whatever item it is for the roll) and set variable loot to 0.
The obvious problem being it limits you to giving 1 piece of loot per roll unless you create task to give multiple combinations of loot.

2. First create rooms for each areas enemies that can't be accessed by the player as such sort of store rooms so say desert enemy store, forest enemy store.
Next set up a variable for each area called something like "Enemy desert spawn". Then set a system task for it for example when player enters desert set Enemy dersert spawn to Random variable (lowest number, highest number). Then set tasks for if random variable = (Number) then Action: Move (NPC enemy character) to location desert and reset Enemy desert spawn variable to 0.
I'm not sure how well it would work you may have to have an entrance areas for each mob area say forest entrance and that entrance holds the spawn enemy task and moves the enemy to the forest.

I'd advise writing the tables yourself in word as you won't have actual tables as such in Adrift just a large list of system tasks for each area.

I've been experimenting with something like what I believe you're trying to make and the big problem you'll have (which I'm working on a solution for) will be that Adrift isn't designed with stacking items in mind so each item is a single instance thing.

Lazzah wrote:Maybe that is because ADRIFT5 is designed for creating interactive fiction games (i.e. text adventures), not the RPG-type game that you are trying to use ADRIFT5 to create. There are much better programs for creating RPG's out there, but of course you have to pay for those, whereas ADRIFT5 is free.


The only ones I've really heard of for text RPG stuff is either a modified version of Twine (which is Free) or RAGS (which isn't a pay once thing and works on a subscription model)

I think Adrift with a few bits of messing setting tasks and stuff can do some of the RPG stuff. The big problem with stuff like RPG maker etc is they're very much designed for graphic based RPGs.

I'd happily pay $40-$50 or so for a decent text based RPG maker that didn't have a sort of running subscription model personally but I've found so few out there.
SamuelC
 
Posts: 7
Joined: Thu Sep 17, 2015 7:12 pm

Re: Creating loot tables and random encounters

Postby Jjbee62 » Sun May 15, 2016 1:11 am

SamuelC wrote:2. First create rooms for each areas enemies that can't be accessed by the player as such sort of store rooms so say desert enemy store, forest enemy store.
Next set up a variable for each area called something like "Enemy desert spawn". Then set a system task for it for example when player enters desert set Enemy dersert spawn to Random variable (lowest number, highest number). Then set tasks for if random variable = (Number) then Action: Move (NPC enemy character) to location desert and reset Enemy desert spawn variable to 0.
I'm not sure how well it would work you may have to have an entrance areas for each mob area say forest entrance and that entrance holds the spawn enemy task and moves the enemy to the forest.


You don't really need the extra rooms. Any character can be created as hidden. When the random encounter is triggered simply move character to the correct location. After the encounter, just move the enemy back to hidden. That way you don't need to have 20 different, basically identical characters, just one that pops up in random places.

You can do something similar with generic loot, like coins. Just have the bag of coins moved from hidden to the location, when the bag is opened, have the task generate a random number to increase the coins variable for the player. Then move the bag of coins back to hidden, ready for the next looting.
Jjbee62
 
Posts: 64
Joined: Fri Apr 15, 2016 5:20 pm


Return to ADRIFT 5.0

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests