Malagar

Villager
Member
Joined
Aug 21, 2013
Messages
10
Reaction score
2
Primarily Uses
N/A
Hi,

First things first: This script was not written by me, it's a script by Galv. I got his permission to slightly modify and re-distribute the script with some minor adjustments. Original credit goes to Galv, I merely did some tiny changes.

You can find the most recent script version (1.4) plus a updated demo project on my DropBox:

https://dl.dropboxus...m Loot v1.4.rar

The updated, 1.4 Version of the script (just the script) can be found on pastebin:

http://pastebin.com/khU50cuy

Important Note!
The oder of function arguments changed from 1.1 to 1.2, you might have to re-order your script calls.

Introduction

This is a random loot drop script that lets the player find items according to a rarity system. It enables you to create random loot of different rarity levels without eventing/scripting endless loot tables. Instead of spawning item with ID X, this script spawns items according to their type (item, weapon or armor), family (scroll, potion etc.), rarity and player level restrictions.

All in all very simple changes but it should do the job!

Cheers

-Fhizban (also known as Malagar)

Version 1.2 Changes

A. How the loot is selected has been altered a little bit by changing the starting item as well as the next item if the starting item is skipped due to some reason. With larger databases this caused the same item to drop over and over again, it also resulted into many "empty" treasure chests. This should be fixed now (my project uses several dozens of items with large spaces of padding between and the script works like a charm).

B. I was not satisfied that you could only state to drop ITEMS, WEAPONS or ARMOR. There was no method to further refine the loot drop (e.g. drop only potions, or helmets, or heavy armor or mage weapons or missile weapons). This was changed by adding another note tag to items (the family tag).

You can now assign a family tag to your items in form of a integer number. When using the loot drop you can optionally state the item family you want to spawn. This grants you additional freedom, for example you can have the script only spawn potions or scrolls. Just add <family: X> to your potions (replace X with a number) and state that number when calling the script. Voila!

C. The Lucky Tag for items is functional again.

Version 1.3 Changes

A. The documentation was rewritten and is now much more detailled.

B. The sample project was updated and reflects now all changes.

C. Added some more security checks to the system.

D. You can now filter loot by weapon/armor subtypes as well (thats the ones defined in the Terms section of the database).

Version 1.4 Changes

Added Sixth's compatibility changes

Full Documentation

Code:
#===============================================================================# +++ GALV'S RANDOM LOOT +++#===============================================================================# + Original Script by Galv# + Extended by Fhizban (also known as Malagar)# + Version 1.4# + Updated August 2015# + For RPGMaker VX Ace# + Free for Non-Commercial and Commercial use# + Requires no other scripts#===============================================================================# DESCRIPTION#===============================================================================# This script allows you to have a script call to gain random loot from chests.# Add notetags to items to specify level requirements and rarity values.# A notetag can also be added to items that you want to increase the chance to# find rarer loot. Random loot can be limited to certain types of items too.#===============================================================================# INSTALLATION#===============================================================================# + Put this script after Material but before main.# + Add some of the notetags (described below) to the items in the database.# + Add a new event that represents a chest or other container to your map.# + Add a script call to the event that will generate random loot (see below).#===============================================================================# DOCUMENTATION#===============================================================================# You are required to setup two different parts to make this script work:# 1) Add Notetags to your items in the database.# 2) Add the script call to your events (chests).# 3) Optionally you can change the configuration below to your taste.## 1) Editing Notetags:# You must specify the following notetags for all ITEMS, WEAPONS and ARMOR that# you want to randomly appear in your events (chests). If any items do not have# these tags, they will just not appear in a random chest at all.## <family: x> # The group or family the item belongs to# # You define these families yourself (1-99)# <rarity: x> # The rarity value (1+ higher is rarer)# <level-min: x> # Min level of player for item to show (1-99)# <level-max: x> # Max level of player for item to show (1-99)## Optional notetag for ARMORS and WEAPONS only:## <lucky: x> # All equipped lucky items of the party are added to# # calculate the total chance to get rarer items.## 2) Using the script call:# By using this script call, you can randomly obtain an item. Go to your event and add# a new command to it, choose script from the very last command tab and insert the# following line.## EXAMPLE:## random_item(0, 1, 10, 50, 1, 1)## SYNTAX:## random_item(type, rarity_min, rarity_max, subtype=0, monster_id=0, family=0)## type # The type of item to be found:# # 0 = Random/any type (you can also use numbers 4+)# # 1 = Item# # 2 = Armor# # 3 = Weapon## rarity_min # Min and Max Rareness determine the item rarity that# rarity_max # the script call will obtain when successful. You can# # state any number that you also use on the notetags# # of your items. Example:# # rarity_min=10, rarity_max=50# # The script call will generate a random number 1-50.# # An item can only be obtained if it has a rarity# # EQUAL or LESS than the generated number.## subtype # OPTIONAL. This only applies to WEAPONS or ARMOR and# # will be ignored otherwise. Filters the random loot# # to drop only items of the stated type.# # (e.g. 1 = General Armour)## monster_id # OPTIONAL. This ID is used to decide what TROPP id# # will be used when a monster-in-a-box is encountered.# # Otherwise the standard troop will be used. Ignored# # if encounter chance is set to zero.## family # OPTIONAL. Family can be any number or 0.# # 0 = drops any item of the stated type/subtype# # x = drops only items of the stated type/subtype that# # share the family.## Using a clever combination of type, subtype and families - you can tailor the random# loot spawn to create only items of a very specific type. Like only Armors of the Small# Shield type, or just Weapons of the Sword type and so on.#===============================================================================
 
Last edited by a moderator:

The Mighty Palm

Resident Palm Tree
Restaff
Joined
Jan 29, 2015
Messages
566
Reaction score
4,151
First Language
English
Primarily Uses
N/A
Very nice. The first thing I thought of when seeing this was the gun/gear lottery machine from borderlands. I probably won't use it myself, but still well done. Very versatile script.
 

cygnus flamel

Veteran
Veteran
Joined
Feb 9, 2014
Messages
40
Reaction score
16
First Language
spanish
Primarily Uses
I just have a doubt, is this script compatible/requires the script Galv's containers?
 

Malagar

Villager
Member
Joined
Aug 21, 2013
Messages
10
Reaction score
2
Primarily Uses
N/A
hm don't think I understood that.

The script does not really require anyhting else. You just add the script, add notetags to all items that you want to spawn that way and finally setup your events with a single extra line
 

Malagar

Villager
Member
Joined
Aug 21, 2013
Messages
10
Reaction score
2
Primarily Uses
N/A
(sorry double-post)

Script was updated to v1.3 - this will be the last version for a while (aside from bug-fixes).

You can now filter the loot even more to just show up items of a specific subtype (thats the ones you define in the Terms tab of the database).

Documentation was updated as well and there is now a proper sample project.

---please check out the opening (top) post for all the details---
 
Last edited by a moderator:

Mojo907

Veteran
Veteran
Joined
May 21, 2013
Messages
169
Reaction score
39
First Language
English
Primarily Uses
RMMV
This is great, it was awesome originally, but this is awesomer! Now if only can make the message box optional, for those people that use Pop Up loot messages.
 
Last edited by a moderator:

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
328
Reaction score
307
First Language
English
Primarily Uses
RMVXA
Something weird is happening to my chests. When I have "random_item(1, 1, 10, 2)" I want it to only use family 2 (drugs), but for some reason it uses more than just family 2. It also gives loot from family 1 (food), which I don't want. I also tried "random_item(1, 1, 10, 0, 0, 2)", but it just gives me the "empty" message or "monster in a box. My note tags for family 2 are like this:

<family: 2>
<rarity: 3>
<level-min: 5>
<level-max: 99>
 

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
328
Reaction score
307
First Language
English
Primarily Uses
RMVXA
Also, your demo dropbox link is broken.
 

Latest Threads

Latest Posts

Latest Profile Posts

Tempted to come up with a unique spell naming system....But ''Fire Magic'' and ''Fire,Fira,Firaga'' are so easily recognizable :p
Yesterday I discovered that I can copy/paste multiple commands by holding shift. I tried this when I started developing holding ctrl and when it didn't work I just copied every single command one by one. For two years.

I am in heaven now.
All right, so lesson learned. No more complicated battle systems for me.
Whew, just finished a whirlwind of deadlines. Finally a tiny break. You know...I should go update my 2020 banner now.
image_2021-06-16_153010.png

Why are barrels to difficult? xD I feel like i Barrel...y made it....eh EHHH!? :p

Forum statistics

Threads
112,281
Messages
1,067,070
Members
145,905
Latest member
Hanayura
Top