Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
734
Reaction score
605
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:
NUcfoH6.png

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
734
Reaction score
605
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
14
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
734
Reaction score
605
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
14
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
734
Reaction score
605
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
14
Reaction score
0
First Language
Spanish
Primarily Uses
holly crap this is amazing thank you!
 

Latest Threads

Latest Posts

Latest Profile Posts

Dev be like: "I'll make the character goes amnesia so I could explain the world and the lore better and immersive to the players"
Whoever decided that the 5th area of Xenoblade 3 had to be THAT big and be explored in the manner it does needs to be shot. My OCD cannot leave a tiny shard of the map hidden and those controls can go right on and f*** themselves. -.-

/rant off
Raggon wrote on NoPatience's profile.
:kaohi:

Forum statistics

Threads
124,435
Messages
1,163,615
Members
163,246
Latest member
BagOfAnts
Top