Final Fantasy Forums > Scripting and Reverse Engineering

(FF7 PSX) Impossible to win all item drops from multiple enemies?

(1/7) > >>

antd:
It seems it is impossible to win all item drops from multiple enemies.

Example:
Fighting two soldiers (shinra HQ) will not allow you to win 2x grenade (1 is max)
Fighting three soldiers will not allow you to win 3x grenade (2 is max)
Fighting three sneaky steps will not allow you to win 3x m-tentacles (2 is max)

I've never seen 100% item drops from multiple enemies. Although it could be that the full drop is quite rare...

NxK:

--- Quote from: antd on 2011-07-26 09:17:50 ---It seems it is impossible to win all item drops from multiple enemies.

Example:
Fighting two soldiers (shinra HQ) will not allow you to win 2x grenade (1 is max)
Fighting three soldiers will not allow you to win 3x grenade (2 is max)
Fighting three sneaky steps will not allow you to win 3x m-tentacles (2 is max)

I've never seen 100% item drops from multiple enemies. Although it could be that the full drop is quite rare...

--- End quote ---

What is known about the mechanics is that an enemy will never yield more than 1 item. This means that if one were to steal an item from an enemy, that enemy could not drop another item at the same time. So, did you actually steal while doing these drop rate tests?
Apart from that, I would suggest that you calculate the expected probability of all enemies dropping an item. As it probably will not be so low in the cases you are mentioning, you could easily do enough test runs to come across statistically significant deviations from your calculations in case it were in fact impossible for all enemies to drop an item.
What I also find remarkable is that you are referring exclusively to instances of multiple enemies of only one type. Perhaps the peculiarity concerning the drop rate you seem to be experiencing only applies to these cases as well.

NFITC1:
The RNG table in the KERNEL.BIN comes into full force in this one. Those values determine what is capable of dropping. There are slots in RAM for a max of at least four items (might be more) being dropped at the end of a battle, but the RNG values usually don't allow that. The (pseudo)code to determine if an item drops or not is as follows:

--- Code: ---ItemDrop ( EnemyData, isDrop, AllowRandom, ChanceMultiplier)
{
WORD dropped_item = -1; //no item
for ( int i = 0; i < 4; i++ ) //loop through the enemies' held item data
{
if ( ( EnemyData(136 + i) ) AND C0h ) == isDrop )  //if isDrop is a 0 then we're looking for drop items instead of steal items
{
DropChance = AllowRandom ? 256 : ChanceMultiplier * ( ( EnemyData(136 + i) ) AND 3Fh ) / 256; //special battles (like bosses or WEAPONS) have guaranteed drop rates, otherwise we'll use chance)
/*
*  The multiplier is usually worked like this:
*
*  ( ( Thiefs_Level + 40 - Targets_Level ) << 9 ) / 100
*
* If Targets_Level = Thiefs_Level it turns out to be 204, but the multiplier won't go higher than 200%
*/
if ( ( RandomRNGByte AND 63h ) <= DropChance )
{
dropped_item = EnemyData(140 + i * 2);
}
}
}
return dropped_item;
}
--- End code ---

Basically, in a normal battle, if the random byte AND 63h is less or equal to the item's drop chance * multiplier (which is signed, so you need to be at no fewer than 39 levels below your target enemy to even have a chance) then the item drops. An Eagle Gun (lvl 46) will never drop an X-Potion (rate of 63) if killed by a character at level 7 or below, but a Master Tonberry (Lvl 77) will have a 1:6.452 chance of dropping a Megalixer (rate of 8) for a level 99 character. A few conditions to this:

The first item an enemy holds that drops, drops.
ex.
The Special Combatant enemy from Reactor 5 has two items to drop. He can drop an Antidote at a rate of 8 and a Grenade at a rate of 2. If the Antidote doesn't drop, the game goes for the Grenade. So there's a 0.8:8, or 1:10, chance that an Antidote will drop. If it doesn't, there is another .8:32, or 1:40, chance that the Grenade will drop. There doesn't seem to be anything else that influences drop rates. I don't see where the game doesn't allow all enemies to drop things.

Like NxK said, the enemy won't drop anything if it has been stolen from.

Back to the issue, this is handled as the enemy dies. So if they don't all die at once the RNG is going to keep moving around. Getting it to cooperate, let alone knowing where the pointer is, is nigh impossible in most cases, but this is relatively easy. Since it just requests a byte the Random Number Set isn't incremented. So you're looking for a certain pattern in the RNGLUT. You need to find a chain of them that all meet that criteria. I'm not certain there are any that do. The RNGLUT may have been constructed in such a way that situations like that are difficult.

Moral is: it CAN produce drops from all enemies (or you wouldn't get drops from single enemy battles like Adamantaimai), but you haven't hit the right string of numbers yet. It would take at least 256 attempts to try all the patterns in the RNGLUT.

antd:

--- Quote from: NFITC1 on 2011-07-26 15:19:09 ---Back to the issue, this is handled as the enemy dies. So if they don't all die at once the RNG is going to keep moving around. Getting it to cooperate, let alone knowing where the pointer is, is nigh impossible in most cases, but this is relatively easy. Since it just requests a byte the Random Number Set isn't incremented. So you're looking for a certain pattern in the RNGLUT. You need to find a chain of them that all meet that criteria. I'm not certain there are any that do. The RNGLUT may have been constructed in such a way that situations like that are difficult.

Moral is: it CAN produce drops from all enemies (or you wouldn't get drops from single enemy battles like Adamantaimai), but you haven't hit the right string of numbers yet. It would take at least 256 attempts to try all the patterns in the RNGLUT.

--- End quote ---
I think this is the point I was missing! I thought ending the battle by a different frame would yield the full range of results. But this is wrong; it is when individual enemies die.

In this case, I will throw a right arm at 3 enemies of the same type. This will ensure all enemies die at the same time, right?

I've set up my script to kill all enemies delaying +1 frame each time, so it should hit each all possible RNG values.

It's tried 1000 attempts already and it has never hit 3 * T/S bomb drops from 3 * Flapbeats.
The most it has dropped is 2 * T/S bomb.

If this runs for over 65536 attempts, will this show that getting all item drops from multiple of the same enemy is impossible?

NFITC1:

--- Quote from: antd on 2011-12-28 18:16:10 ---
If this runs for over 65536 attempts, will this show that getting all item drops from multiple of the same enemy is impossible?

--- End quote ---

Statistically I'd say yes. 256 attempts would be enough given there are only 256 values in the RNGLUT. However, there are eight pointers to it at any given time and I don't know for certain what each of them are for and when the game cycles though them nor at what rate. So 2048 (256 * 8 ) would be enough if you knew where the pointer started and what value was next in the RNGLUT. I'm not convinced that the RNG is shuffled every frame like other RPG games do.
That would only work for consecutive values, however. If you knew what value made an item drop and got the RNGLUT pointer back to that value for every enemy then you could likely get all the items from enemy drops. There is room in the data for four unique items although the quantity is variable. This point is moot because an enemy will only drop one item (if any) and there can only be three enemy types in a battle.