Random Loot

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
703
Reaction score
549
First Language
French
Primarily Uses

Astfgl's Random loot
Hi everyone! This simple plugin was made to handle random loot and its display.

I've seen the request for such a system pop up a few times and, although this can be evented to a certain degree, I thought a plugin could help.

Features:
  • From user defined loot tables, give random loot.
  • Use items as bags of loot via notetags, without using a common event.
  • Handles weapons, armors, items and gold.
  • Use the parameters to automate the item gain message via variables.
  • V1.2: Trigger monster encounters. Only tested on the map screen. Use at your own risk for items in menu or during battle.
  • V1.2: Return the loot table, deleting the item the player just got. This allows you to remove randomly gained items from the loot table so that your player doesn't get the same possibility twice from the same loot table. You'll have to store the loot table in a variable beforehand.
  • V1.3: Loot bags are now purchasable and can instantly open upon purchase, just add <LTPurchase> to your item.
  • V1.4: Items can now have several loot tables, just add more loot tables like this: <lootTable:>, <lootTable2:>, <lootTable3:>,... Please note that the variables defined in parameters will only contain info for the last obtained item.
  • V1.5: Loot tables can now roll for other loot tables

Download:

Terms of use: Find them in the plugin file for reference. Pasted below:

Code:
// Free to use both commercially and non commercially.
// Edits allowed, but the product must be released with the same license.
// Credits required: any of Astfgl/Pierre MATEO/Pierre MATEO (Astfgl)
// Reposts allowed.
Setup:
  • Download the plugin, name the file AstfglLT save it as a .js .
  • Setup parameters as you see fit.
Usage: Refer to the plugin's help file.

Example:
Excuse the MS Paint editing:

Known Bugs:
  • None
Credits:
  • Astfgl66
 
Last edited:

Isabella Ava

Veteran
Veteran
Joined
Sep 13, 2016
Messages
635
Reaction score
756
First Language
English
awesome, this is really helpful with my current project
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
703
Reaction score
549
First Language
French
Primarily Uses
It's been a while since I last posted in that thread, but there has been multiple updates now. You can find the updated feature list in the original post.

I'm posting now to let users know that a bug introduced in 1.4 that prevented items to be consumed upon use is fixed.
Thanks to @Allerka for catching it and sending a bug report!

Have a nice day, and happy making!
 

Aeonhart

Villager
Member
Joined
Oct 11, 2016
Messages
9
Reaction score
0
First Language
Spanish
Primarily Uses
EDIT* easier question

can this plugin call a plugin command instead of delivering an item?
 
Last edited:

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
703
Reaction score
549
First Language
French
Primarily Uses
Unless I misunderstood something, just call for random loot three times: first on the normal, then on the uncommon and finally on the rare loot table.

Loot tables are just arrays, so if you want to make an array from selected elements of a loot table, you'll have to do a bit of array manipulation. It's very simple javascript that a bit of googleing will solve.

If you are unable: just do it by hand.
 

Aeonhart

Villager
Member
Joined
Oct 11, 2016
Messages
9
Reaction score
0
First Language
Spanish
Primarily Uses
My apologies for not explaining myself.

Basically instead of having a single item as a table item, i want to have a rarity, then if I get that rarity get a random item from that array.

ex: <lootTable:[[1,common,1,100],[1,uncommon,1,70],[1,rare,1,30],[3,superrare,1,5]>

So lets say I script on common event

var common = [0, 1, 2]
$gameVariables.setValue(0001, common);

var uncommon = [3, 4, 5]
$gameVariables.setValue(0002, uncommon);

How do I integrate it ? will this work?

$gameMap.loot([[2,$gameVariables.value(0001),100, ],[2,$gameVariables.value(0002),1,20]])

If so, how can I make it so it will only give me 1 item and not the full array?
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
703
Reaction score
549
First Language
French
Primarily Uses
Okay, that wasn't possible, but it was an easy addition.
I've made an update to the plugin, allowing for what you asked.

So following your example, you'd do:
Code:
var common = lootTable1;
var rare = lootTable2;
var legendary = lootTable3;
var lootTable = [[5,common,0,75],[5,rare,0,20],[5,legendary,0,5]]
$gameMap.loot(lootTable)
For a 75% chance to roll on the common loot table, 20% for a rare roll, and 5% for a legendary roll.

By the way: no leading zeros on numbers: $gameVariables.value(1) and not 0001.
 

Aeonhart

Villager
Member
Joined
Oct 11, 2016
Messages
9
Reaction score
0
First Language
Spanish
Primarily Uses
holly crap this is amazing thank you!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

If you ever need fantasy names and you're bored, make a fictional alphabet. Switch around the letters and see what you get :p
I JUST GOT PROMOTED TO 9TH GRADE BOIS!
On a scale of one to I just drew a pineapple with hairy legs how bored are you today?
Everybody else: We want this, this, this, this, this, and this, and don't forget that, plus that.... we need all of it added to the new RM.

Me: Just don't make me learn a new programming language. :kaoback:
I got to thinking - it's not just the app itself when considering purchase of RPG Maker. At least one reason to get the new RPGMaker even if not switching to use it may be if they're packing in a ton of new high quality assets for the RTP.

Forum statistics

Threads
98,166
Messages
949,885
Members
129,452
Latest member
Primantis
Top