PDA

View Full Version : Store Generator Mod?



JimSocks
October 10th, 2016, 01:01
Perhaps my search-fu is weak, or perhaps it doesn't yet exist: a store and inventory generator?

Something where you could specify:
-Size of merchant (traveling salesman, caravan, small storefront, big store, mega-Walmart)
-Total value of goods he's got threshold in GP
-Maybe local economy type instead of (or in addition to) threshold (poor, middle class, wealthy, nobility). I like the threshold option though since my current adventure gives them (merchant is willing to sell 20% of the 120GP worth of items he has for sale) thus I could say my traveling merchant has 120GP worth of items- but since he's tagged as a poor merchant he's got only mundane and simple items for sale.
-type of shop. I.e.: general gear, weapons trader, armor smith, magic shop, or a combination of a couple types.
-an option to randomize all of the above if you wanted to

And then the extension/mod would output a inventory for your vendor that could be perused by the players. An added bonus would be if some items you could designate as "hidden" that you could reveal upon RP- something he had "hidden in the back"

Another great feature would be the ability to add your own items into the mix that the ext/mod could use as well, so you could thematically stock the shelves as well

Maybe there is already something out there for this in FG and I just can't find it- but as of right now I'm spending lots of time building vendor inventories...

If nothing like this exists but you think it's POSSIBLE and would be something cool let me know and perhaps I'll try my hand at it?

Or maybe I am missing a function of FG right in front of my face? Lol

thedougalbug
October 10th, 2016, 01:27
I'm not too familiar with how the code all works but I don't imagine this would be impossible.

What you could potentially do (and please correct me people if this is wrong!) is create these merchants as encounters and create the inventories of said merchants by treating them like loot gained from the encounter. I'm not sure how easy it would be to randomise that kind of thing BUT you could do a workaround (although again I'm not sure how much work this would be)...

Ask your players what they want to buy (let's say for example they want a breastplate) and then give that item a "percentage chance to find" based on the wealth of that merchant. If the player rolls below that percentage on a D100 the merchant has it and can sell it, if not, better luck next time.

Just a thought, perhaps a crazy one, but I hope it helps!

JimSocks
October 10th, 2016, 01:56
Actually I am starting to think this may be possible all through tables? Well, maybe not all of it?

Random would be easy, but if I specifically wanted to nail down that I wanted a poor traveling merchant with only 120GP worth of items (like I truely want to be able to do) I don't think nested tables are the way to go...

Oh gods of FG and lords of the mod/ext community: what day you on this matter? Is it already out there, too trivial to waste time on, or if it's worthy of the work which way is the best approach for the end goal: mod, ext, or some odd combo of both?

The idea of coming at it from the angle of an encounter hadn't occurred to me before- so any ideas are sure to be fresh ones to me!

dulux-oz
October 10th, 2016, 02:16
Nothing random, but have you seen the DOE: Locations Extension? Its got a shopping function in it.

JimSocks
October 10th, 2016, 02:40
Yes actually!

I am a HUGE fan of your extensions!!!

The shopping function you have in the locations extension is AMAZING. Now I just want something to help me generate the item inventories that populate the treasury!

Ideally, I would use the shop generator to get me an appropriate inventory, and then I'd plop all that into a store on your locations extension! That would be just aces

Zacchaeus
October 10th, 2016, 20:56
There's no particular reason why you can't do this with nested tables - other than it seems an awful lot of work for very little gain :)

Your first table could be the one that randomly determines the gold range that your merchant has - say 50-100, 100-200, 200-500 etc. This table would then call a child table which determined what the merchant might sell eg 'Weapons', 'Armour', Adventuring gear etc'. Then the child would call on a number of grandchild tables which contained the actual items - which you could just use as the inventory of the merchant or you could roll a random number of times on that table to generate a 'stock' of items. If you output the grandchild tables to 'parcel' then you would be creating a parcel which you could then drop into the party inventory so that the players could 'see' the stock and decide if they want to buy. When they've bought everything delete anything not purchased from the party sheet. (You can drag things directly from the equipment lists in the PHB or from the items list in the campaign and drop them into the row of the table)

See this wiki article (https://www.fantasygrounds.com/wiki/index.php/Tables) on how to set up nested tables.

LordEntrails
October 10th, 2016, 21:19
But wouldn't it be AWESOME if Dulux just did it all for us?

But then again if he did, we would all owe him more beer than he could ever drink! :)

Zacchaeus
October 10th, 2016, 21:44
But wouldn't it be AWESOME if Dulux just did it all for us?

But then again if he did, we would all owe him more beer than he could ever drink! :)

Don't be silly, he's an Aussie. There's no limit to what an Aussie can drink - or so I understand like :)

ddavison
October 10th, 2016, 23:21
Hmmm... we have some new functionality in 3.2 that might be able to help with this.

gqwebb
October 11th, 2016, 00:08
Hmmm... we have some new functionality in 3.2 that might be able to help with this.

Can't wait !
https://s-media-cache-ak0.pinimg.com/originals/e7/71/8c/e7718cb25ed40426d4f148ccce9614ce.jpg

LordEntrails
October 11th, 2016, 02:19
Don't be silly, he's an Aussie. There's no limit to what an Aussie can drink - or so I understand like :)
I think the limit is not an intake limit but rather an expel limit :)

dulux-oz
October 11th, 2016, 03:59
Don't worry, us Aussies nurse on beer, so both our intake and our output is simply "phenomenal" :p

LordEntrails
October 11th, 2016, 04:09
An anonymous source just sent me this picture of Dulux...
15597

JimSocks
October 11th, 2016, 04:29
Zacchaeus- maybe I am having a tough time wrapping my brain around how I could "un-randomize" the tables if I wanted to...

For instance, Out Of The Abyss gives me vendors that say "they are willing to sell 20% of the 120gp worth of goods they have in stock". That's all it says- it's up to me to continually create fresh shop inventories.

If I made these fancy tables, but then wanted to specify "this trader has mundane items, but only 120gp worth of them- aaaand let's see... he stocks adventuring supplies and armor only"

That sounds trickier right?

Here's a question: could an extension parse the item categories (i.e. "Armor", "Adventuring Gear", "Tools"), their properties (i.e. Magical vs mundane), and their cost (5gp, 1sp etc) in order to accomplish this?

I love how folks like Dulox were able to create awesome GUI menus to display their extension's functionality, and something akin to that would be really cool for this idea. Checkboxes for your options and output or the ability to just go random with it and all.

If you say it's possible, I might take a swing at it. I've never really coded before aside from arduino and HTML- but how hard could it be!? Lol

dulux-oz
October 11th, 2016, 05:01
An anonymous source just sent me this picture of Dulux...
15597

What can I say - its not my best side.

El Condoro
October 11th, 2016, 06:39
I don't think this (https://roleplayingtips.com/tools/excel-file-generates-shop-inventory-for-you/)is exactly what you want, but maybe for a starting point?

Zacchaeus
October 11th, 2016, 11:25
Zacchaeus- maybe I am having a tough time wrapping my brain around how I could "un-randomize" the tables if I wanted to...

For instance, Out Of The Abyss gives me vendors that say "they are willing to sell 20% of the 120gp worth of goods they have in stock". That's all it says- it's up to me to continually create fresh shop inventories.

If I made these fancy tables, but then wanted to specify "this trader has mundane items, but only 120gp worth of them- aaaand let's see... he stocks adventuring supplies and armor only"

That sounds trickier right?

Here's a question: could an extension parse the item categories (i.e. "Armor", "Adventuring Gear", "Tools"), their properties (i.e. Magical vs mundane), and their cost (5gp, 1sp etc) in order to accomplish this?

I love how folks like Dulox were able to create awesome GUI menus to display their extension's functionality, and something akin to that would be really cool for this idea. Checkboxes for your options and output or the ability to just go random with it and all.

If you say it's possible, I might take a swing at it. I've never really coded before aside from arduino and HTML- but how hard could it be!? Lol

You would certainly need an extension for this level of micro management. I don't know it it's possible but given what's been done with extensions I wouldn't be surprised. The big problem I would think is how you determine that the trader has 120 gp worth of supplies. Is this 120 lots of 20 arrows at 1 gp each or is it 12 wands at 10 gp each or a number of different things which total 120 gp. You'd have some pretty complicated and recursive maths needed to work something like that out I would imagine.

It's, once again, so interesting how everyone plays the game differently. I don't think that my players have bought anything, ever, in a shop - but that may be because I wouldn't ever bother creating one :)
If I did then it would be a simple affair along the lines of 'This is a general store and you can buy anything that's in the equipment section of the PHB for 150% of the prices listed there." If they then want to buy something I'd just drag it from the Items list into their inventory and deduct the cost from their treasury.

Kitilark
October 11th, 2016, 23:09
But wouldn't it be AWESOME if Dulux just did it all for us?

But then again if he did, we would all owe him more beer than he could ever drink! :)

oh yes - more extension - is it possible to send beer by email? and if so, do we send our domestic or his domestic? ;)
Kitty

Zacchaeus
October 11th, 2016, 23:17
As was noted above there is some new functionality which may well find itself in v3.2 which will make something like this possible without an extension. Patience in this instance may well be a virtue.

JimSocks
November 18th, 2016, 21:34
With the new functionality, can one table's outcome influence the rolling on another table?

For example, I have a story template called "Random Merchant"

The merchant is known for its <Merchant Known For Its...> and <Merchant Notable Traits>

The Merchant peddles from a [Shop Type]

This could give me a result like this:

The merchant is known for its terrible selection and sly owner.

The merchant pedals from a tiny wagon.

Based on the outcome of [Shop Type] being "Tiny Wagon", could I then have the story template reference that outcome in order to roll on a separate "Tiny Wagon" table further on in the template which would show its inventory? Could this output to a parcel link?

Even if it couldn't output to a parcel it would be great- because DOE Location extension can't take a parcel to building inventory anyways.

I would just love the ability to reference outcomes elsewhere in the story that's generated to determine which tables to roll on next.

Maybe I am asking for "if-then" functionality within story templates? And I suppose that is asking way too much if it's not already possible.

Zacchaeus
November 18th, 2016, 21:57
With the new functionality, can one table's outcome influence the rolling on another table?
<snip>


I updated the Story Template article in the Wiki (https://www.fantasygrounds.com/wiki/index.php/Story_Templates) (some time ago) using your example of a shop; you may find some helpful hints in there. The answer is basically yes; but you'll have to think carefully how you go about it and in what order the tables roll on. You can't 'store' a variable or do an If-then-else type thing but you can achieve pretty close to it if you think through what it is you want to end up with. In other words don't start with the tables - think about how you are going to layout the template and then try to get that result.

You may find that you have to compromise somewhat in certain areas.

Oh, and you are either going to be outputting to a template or a parcel you can't call a parcel from a template but if you populate your tables with links to existing equipment or whatever you can drag those links into a parcel from the template.

ddavison
November 19th, 2016, 17:10
One thing you could do is build a table that contains a series of links to other Story Templates.

Table: Shop Type
Description: A random shop type
1 - Small Shop Generator
2 - Medium Shop Generator
3 - Large Shop Generator

Rob2e put up a simple and straightforward system to do this sort of thing on the DMs Guild.
https://www.dmsguild.com/product/197619/Magic-Shops--Random-Item-Rarity-Tables

gqwebb
November 20th, 2016, 03:19
Great job and thanks for all the hard work! This was need.

JimSocks
November 21st, 2016, 03:58
Ddavison- that's genius! I hadn't thought of having a table roll for templates! I am almost finished with it, and I am really pleased with the results so far! I utilized bits and pieces from two different NPC generators in order to flesh out my shop owners... I hope that doesn't rub anyone the wrong way. I will of course ask the original NPC generator authors for permission before I even think about posting it publicly.

Two questions though:
1. I made all this within an existing campaign. I haven't wasted all my work have I? I should still be able to create a module out of it right? (I haven't made a module yet, so I am a bit fuzzy on that)
2. Sometimes when I click "generate" in my template, a pop-up window displays this message:
Script Error: [string "campaign/scripts/story_template_generate.lu..."]:89: bad argument #1 to 'ipairs' (table expected, got nil)
and it does not generate the story. It doesn't happen every time, but often enough that I want to fix it!

Zacchaeus
November 21st, 2016, 10:42
You can create a module by exporting your campaign. Type /export into chat or click on the export button in the data module activation scree; fill in the form that appears and be sure to check all the resources you want to export.

The error I suspect is because either you have a problem with a wrong entry on a table or on the template itself.

JimSocks
November 21st, 2016, 13:18
I guessed that, but I don't really know what would constitute a "wrong entry" that would be grievous enough to warrant a pop-up window error.

Usually if you type a wrong table name or something FG just ignores it or prints it as regular text...

JimSocks
November 21st, 2016, 14:24
Something else that would be very cool but I'm sure isn't possible (Though I will try it as soon as I get home!) is the ability to reference the result of a table within the command to call a different table!

I.E.: [Random <Race> <Gender> Name]
Which (depending on the outcome of the [Race] and [Gender] tables) might end up rolling on the [Random Dwarf Female Name] table or the [Random Tiefling Male Name] table.

This would allow my story to print the name of a character that was randomly generated but realistically based on race and gender. I can't think of another way to tell a template to call a table, when there is no way for me to know which table to call since the table itself is a random result of another table.

Zacchaeus
November 21st, 2016, 16:25
I guessed that, but I don't really know what would constitute a "wrong entry" that would be grievous enough to warrant a pop-up window error.

Usually if you type a wrong table name or something FG just ignores it or prints it as regular text...

Yes, but in this case you are calling something from something else and the thing that you are calling is the wrong thing. So an entry in the table might be the problem rather than the table itself.

Zacchaeus
November 21st, 2016, 16:30
Something else that would be very cool but I'm sure isn't possible (Though I will try it as soon as I get home!) is the ability to reference the result of a table within the command to call a different table!

I.E.: [Random <Race> <Gender> Name]
Which (depending on the outcome of the [Race] and [Gender] tables) might end up rolling on the [Random Dwarf Female Name] table or the [Random Tiefling Male Name] table.

This would allow my story to print the name of a character that was randomly generated but realistically based on race and gender. I can't think of another way to tell a template to call a table, when there is no way for me to know which table to call since the table itself is a random result of another table.

You can do this. Set up a table which rolls for Gender which calls a table which rolls Race. Each Race entry then calls a different table for the name. The Race table would have entries of (say) Human [Human Name], Dwarf [Dwarf Name] etc.

LordEntrails
November 21st, 2016, 18:19
I guessed that, but I don't really know what would constitute a "wrong entry" that would be grievous enough to warrant a pop-up window error.

Usually if you type a wrong table name or something FG just ignores it or prints it as regular text...
Search your tables and story formats for something called "ipairs". At least that what I think the error message is telling you :)

JimSocks
November 21st, 2016, 19:55
You can do this. Set up a table which rolls for Gender which calls a table which rolls Race. Each Race entry then calls a different table for the name. The Race table would have entries of (say) Human [Human Name], Dwarf [Dwarf Name] etc.


Yes but back in my story template how would I refer to the name without knowing which race or gender is going to be chosen?

For instance the following wouldn't work if any other gender and race was rolledbesides human female:

The shopkeeper's name is <Human Female Names>. <Human Female Names> has [Hair Color] hair.

If a Dwarf male had been generated as the shopkeeper, the table reference of <Human Female Names> wouldn't mean anything.

What I would need is the ability to roll on a table called from the reference of the results of other rolled tables right?

So I'd roll on [Race] which Has a column for gender and rolls on various race name tables depending on the race and gender outcome. The name tables are all named similarly "Rando m Dwarf Male Names" and "Random Human Female Names" and "Random Gnome Female Names" etc.

Back in my template if I wanted it to print the shopkeepers name several times throughout the generated story, I'd have to use <Random <Race> Names> because there is no way for me to know which table needs to be referenced. ...maybe that's a confusing explanation?

Also another question: can I make the story template print the result from one column of a previously rolled table? I.E. if earlier in the template I had the template roll on a table named [Tatoos] and that table has 4 columns of data, is there a way to reference just the 3rd columns data later on in the template? I am imagining a call-out like: <Tatoos|3>

Zacchaeus
November 21st, 2016, 22:02
Taking your last question first, no you can't do that. the bit between the <> brackets sinly stores the result of whatever was rolled in the [] brackets.

There may be a way to do what you want but I'm too tired to think right now, but there are some limitations that you will have in templates when you start drilling down into child and grandchild tables.

You can't use a value rolled on one table to roll on another without linking the tables. My suggestion above would produce something like Male Dwarf Zac and you aren't going to be able to reference the Zac or the Dwarf bit because they were rolled from another table. So you'll have to separate those things out, perhaps by making the names more generic or having separate templates for each race that you want to represent. ddavison pointed out above that you can call templates from tables so instead of calling another table from your initial table have it call templates instead. So perhaps the first table calls a a template for Dwarf, Human, Elf etc and in those templates you have the name and description. You know when you get to that template that you have a Dwarf or whatever and that gives you more scope to do what you want to do.

JimSocks
November 22nd, 2016, 02:26
I found out that this works:
[Race|2]
<Race>

This will only roll on the 2nd column in the Race table, and thus the reference <Race> only will print the 2nd column's results.

It sure would be great if the references supported the reverse of this. So that

[Race]
<Race|2>

Would roll and print the results of the whole table of Race, and then <Race|2> would print the results from only the 2nd column of it.

Another great feature would be the ability to use references inside of table addresses like I mentioned before. So that if you rolled
[Race]
[Gender]
[<Race> <Gender> Names]

It could fill in the results from the previous tables and then run the resulting table. This would mean the template would have to resolve until there was nothing resolvable left (runs 1st time to run all tables listed throughout the template, 2nd run fills in references to those table's results, 3rd run runs any tables left (if any), 4th run prints references from those tables (if any), 5th run processes any tables left, and so on and so on until there are no resolvable tables or references left. Normally this would run only the first two times and be done, but in the event of complicated (read: awesome) story templates it could really generate some amazing stuff!

JimSocks
January 25th, 2017, 05:53
Ok I am close to done with this project and almost ready to post it, but I used some bits from other people's mods to flesh out the shopkeeper NPC descriptions.

I have gotten permission to use one half of what I got from other mods- and I want to get in touch with the creator of the other mod but now I can't find the original post or link I got it from anywhere!

It shows up in my modules named "Random NPC Generator [Generic]" and it is distinctly separate from the 5e Character Generator made by Hecklerus Prime. Anyone know who made the mod in question so I can get in touch with them?

Zacchaeus
January 25th, 2017, 12:03
A site search Random NPC Generator reveals this (https://www.fantasygrounds.com/forums/showthread.php?28179-Random-NPC-Generator!-3-5-4e-5e-and-Pathfinder).

JimSocks
January 25th, 2017, 14:29
Gah! I searched EXACTLY THAT and didn't see it!

Thanks Z, you're the best. I'll get in touch with him!