[FE8] Randomized Chests/Enemy Drops[Solved]

So, I’ve seen that there are randomized chests in FE8, such as chests in the tower of Valni. Are those hardcoded, or are there ways of making more randomized chests?

In floor 8 of Valni, there is a Cyclops that is equipped with a random axe. How might I set up a similar enemy there too?

As far as the randomized chests go, they use a LOCA event code on that tile with a 0x14 (flag for “do this if Chest command used”?) at the end instead of the normal CHES code used for chests, which means that it’ll do whatever the pointer it got fed (i.e. 0C D7 9E 08) instead of just opening a chest and giving an item.

1 Like

Alright, so it’s just an asm command that points to a set of items that will be randomly obtained? I assume that’d mean I can add more of the randomed chest rewards…

I think it’s probably event code and not asm (although trying to disassemble causes EA to crash, because EA…)

Hm. Okay, another question. How hard would it be to write an ASM code that picks randomly from a list of say… 15 possible items?

For example, I set up an array that is in blocks of 15, and every 15 blocks is another chest/event’s worth of items. So I could say 0x01 = Chest 1 [Iron Sword, Iron Lance, 500 gold, Etc], 0x02 is Chest 2, 0x03 is random reward 1, etc. The cutoff would be when 15 0x00 entries were detected. From here I could make events refer to this array and just use 0x01 to load chest 1’s contents, chest 2, event 1, etc.

Doable y/n/maybe?

The data at 0x089ED70C isn’t actually ASM code; it’s the start of a list of possible treasure items and their probability out of a hundred; it’s just a list of item ID + % chance for every possible item, terminated by two 00 bytes.

Probably every randomized chest has a pointer to its own list in this region. This would also explain why some Valni/Lagdou chapters don’t disassemble - the LOCA events probably contain commands that aren’t in EA’s definitions (like “_FE8CODE” but worse).

Randomized enemy inventories likely use a similar system (though done automatically if the unit has the flag set in unit data); I’m 100% certain it’s based off of the enemy’s class ID; the Cyclops in Lagdou 8 and the Elder Bael at Melkaen use their own individual classes.

2 Likes

Interesting… it sounds like FE8 already does exactly what I just asked about, so how might I just go about plopping my own chest data in or creating my own Item% chance list?

Edit: Actually… could a nightmare module be made for these lists?

To make randomized chests in any chapter:

First download this fix to EA’s fe8 definitions; the command you want to use is CHESRANDOM, which is formatted like so:
CHESRANDOM EventID pointer [x,y]

Where “pointer” points to your item/probability list. The item list is composed of the item ID of a possible item, then it’s chance out of 100 of being taken, repeated for every item you want the chest to have, then ended by 0000. The chances for each item in the list should add up to 100 or unexpected things could happen.

3 Likes

Holy shit I love you XD

That’s pretty cool.

What happens if it doesn’t add up to 100? :0

Something breaks, I guess. I’m not gonna test it, this works PERFECTLY for my needs.

Now to combine it with desert item events and figure out how to modify the various ITGV commands throughout the game, and we’ve got a good thing going on!

If it adds up to less than 100 there’s a chance of getting nothing I’d guess. More than 100 and the items past the one that takes it above 100 won’t ever drop.

1 Like

Well, if less than 100 means you might not get an item, that could be kinda amusing. I suppose a smarter thing to do would be to put in a “1 Gold” piece drop, so the player gets the shittiest thing ever and realizes they were juked.