Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

FFXII Treasure System

Unlike with most RPGs and with the rest of the Final Fantasy Series, Final Fantasy XII has a unique treasure system in that for starters, there's a heck of a lot more treasure. However the treasure gained is 99% of the time completely random.

What I would like is a script that allows for this system to come to fruition but allow the creator of the game to select a number of items that can be found in the chest that could appear spontaniously.

For example, you open one chest and you find, a Potion, but reset the game and do it again and you find an Iron Sword.

The guy making the game can set what they want to be found from a list of Item ID's, obviously using 0 as Items, 1 as Weapons, 2 as Armours e.t.c.

For example on that list for the chest you could get:

Item Type: 0 (Items)
Item IDs:
001 (Potion)
012 (Pheonix Down)
023 (Grenade)
035 (HP Seed)
049 (Bomb Shell)

And obviously make it so that certain items are more likely to attain than others pehaps simply by putting ID 001 down several times for a Potion if that's what you want to be likely found.

Can anyone make a script like this?
 
I can easily see this done using events and variables.

All you need to do is create a common event called "Random Treasure".
You could use a randomnise variable from 1 to whatever. And do loads of conditional branches for each number. In those conditional branches you could put random kinds of loot. Then on the map, just simply call the common event and presto! There is your random treasure!

Still confused? Here's a few screens of my coding:
Notice that in the both in-game screenshots the item changes? In that example you can choose between 5 items. The creator can easily change this to hold 1,000 items (if you have that much free time) and you can easily mess around and make it more complicated. The best part is, you only really need to edit one page to change everything AND it's coding all use RMXPers understand! :)

Hope I helped.
 
There is a (somewhat) more complicated way to do it, too. I personally would script each chest individually and then copy and paste the chest event. This has advantages and disadvantages.

Advantages:

Easier to control what loot is given for each chest, allowing for greater customization.

Easy inclusion of a Conditional Branch for loot altering items (ie: you could only get some items by equipping the Diamond Armlet).

Disadvantages:

More work (not a whole lot)

A lot larger and harder to change than just calling one, simple Common Event.

My typical chest event (sorry I am doing this from memory as I am away from my computer with RMXP, so the wording might be slightly off):

@Set Variable [001: Loot Percentage]: Random (1...10).
@Conditional Branch: Diamond Armlet Equipped
...<>Conditional Branch: Variable [001: Loot Percentage] <= 4
.......<>Text: You found 1,000 Gold!
.......<>Change Gold: + 1000
.......<>Self Switch A: On
...<>Else:
.......<>Conditional Branch: Set Variable [001: Loot Percentage] <= 9
...........<>Text: You found a High Potion!
...........<>Change Items: + High Potion
...........<>Self Switch A: On
.......<>Else:
...........<>Text: You found a Steel Sword!
...........<>Change Weapon: + Steel Sword
...........<>Self Switch A: On
...<>Else:
.......<>(Copy and paste everything from Conditional Branch: Variable [001: Loot Percentage] <= 4 and below to make treasure table for when Diamond Armlet is not equipped)

This gives a player, who is wearing a Diamond Armlet, a 40% chance of getting 1,000 gold, a 50% chance of getting a High Potion and a 10% chance of getting a Steel Sword.

The Self Switch A: On is so the player can't repeatedly reopen the chest.

All you have to do for each chest is change the gold/items and the variable settings in the conditional branches to get completely unique randomized chests. There is even a way to make the chests reset, along with some other cool little perks.
 
It doesn't have to be a simple common event. You can mess around with it and come out with a complex looting system. It is used to easily distribute throughout all chests ;)

An idea I was givem by the 4 different chests in the RTP is that you can get different kinds of loot. For example:

Common - This includes things like low amounts of money, potions, ethers etc.
Great - This would include higher amounts of money, good weapons and armour.
Rare - This would include large amounts of money, very good weapons and armour etc.
Epic - This could include the strongest items in the game.

You could even make a random event system in it for the amounts of gold you receive.
Mak a random variable from 50-100 lets say, use conditional branches (there is probably an easy way, but im going on impulse here) for each one. And different amounts of gold would be received.

And all this could use the same common event :D

Advantages -
No need to run around the editor. Keep in one area: Common Events
Sleek and easier to create the chest events

Disadvantages -
A long, boring copy & paste mission
long, boring coding of common event (This could be improved by splitting them into different common events, but this will make the chest events a bit more lengthy)
 
That's pretty cool, I'm not so great with events, at least not to this degree, eventing for me is limited, infact I rarely use variables in my game at all.

Thanks, can a mod now close this topic, the request has been filled.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top