øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=printpage;topic=268.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index26f1-3.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=268.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index26f1-3.html.zx’Ig^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ`¦D jOKtext/htmlISO-8859-1gzip0|Ö jÿÿÿÿÿÿÿÿTue, 10 Mar 2020 08:18:50 GMT0ó°° ®0®P®€§²ð®’Ig^ÿÿÿÿÿÿÿÿ¹ j Print Page - Steal/Sneak Command

Board of Slick

Library of the Ancients => Final Fantasy IV Research & Development => Topic started by: Deathlike2 on February 04, 2008, 05:10:30 AM

Title: Steal/Sneak Command
Post by: Deathlike2 on February 04, 2008, 05:10:30 AM
This command is purely driven by level.. but does Agility factor in at all?

Has anyone figured out the damage taken on steal failure?
Title: Re: Steal Command
Post by: Deathlike2 on March 11, 2008, 07:03:45 PM
Damage taken by a failed steal seems kind broken in the SNES version of the game. I'd have to play an FF4A playthrough to test this properly...

Level is a major factor. The monster counter seems to be random as that requires Edge to be around the same level as the target. It eventually goes away on higher levels.

Row is irrelevent for the command's execution.
Title: Re: Steal/Sneak Command
Post by: Lenophis on March 12, 2008, 01:45:59 AM
All I know is that stealing sucks in FF4, as I've only ever gotten potions, and when I don't get that I fail 99% of the time. :sad:
Title: Re: Steal/Sneak Command
Post by: Deathlike2 on March 12, 2008, 08:04:15 AM
Well, it is kinda lame... because:

1) You don't know what level the enemy is, relative to yours in most cases. Even FF4A's beastiary doesn't even provide that.

2) Those that have no item drops regularly give you potions by default.

3) What you steal is the most common drop...

I'd wish this command was reworked for interest's sake. Randomly steal a different item (if applicable) like if you were doing random drop calculations.. then the command would be really really awesome.
Title: Re: Steal/Sneak Command
Post by: JCE3000GT on March 12, 2008, 03:43:30 PM
This command is purely driven by level.. but does Agility factor in at all?

I seem to think the monster's level is a basis for the failure rate.  The Steal/Sneak rate seems to be reduced tremendously the further you progress throughout the game.  I find it almost impossible to steal later in the game as opposed to right when you get him. 
Title: Re: Steal/Sneak Command
Post by: Deathlike2 on April 26, 2008, 11:54:55 PM
Some additional info on command, FF4A specific though:

Quote from: FF4A GameFAQs Board
Terence:
The coding on what they *want* to happen in FF4A is pretty straightforward:

* If Target's Level is Greater or Equal to Stealer's Level, then the chance is 5/100.

* If Target's Level is Lower than Stealer's Level, then the chance is 4/100 per level greater than the Target up to a maximum of 95/100.

Unfortunately, ...
the random number it picks is a number from 0 to 255, which it then *MODs* to 0 to 99. This gives you a 3/256 chance of every number from 0 to 55, and a 2/256 chance of every number from 56 to 99.

Of course, this assumes that the RNG it's getting these random numbers from is equally distributed and random itself, but I'm not going to delve that far in analysis.
Title: Re: Steal/Sneak Command
Post by: Deathlike2 on June 06, 2008, 06:30:18 PM
If someone looked into this command's exact behavior, it would be appreciated.
Title: Re: Steal/Sneak Command
Post by: Deathlike2 on October 18, 2008, 03:57:14 AM
 :bump:

I should've integrated some older post about steal...

In the SNES version, if a target always drops an item (100% drop), Edge cannot steal the item and no message appears.

If the GBA version, if a boss target always drops an item (100% drop), Edge cannot steal the item. A message appears here noting failure but doesn't penalize you. The programmer/dev room is where the always drop bit is used for 1 monster, and you can steal that monster's item.
Title: Re: Steal/Sneak Command
Post by: Deathlike2 on October 18, 2008, 04:23:36 AM
Stealing from an enemy that never drops an item is possible. The item generally is a potion because it is the default item/drop list.

The most notable monster obviously is Zeromus, who never drops an item, but you can always steal a Dark Matter (or Elixir in FF2/FF4ET) from it.

This may be a good method of creating a hack with only "steal only" items.
Title: Re: Steal/Sneak Command
Post by: Dragonsbrethren on October 18, 2008, 05:14:13 AM
Yeah, I knew about that already and have made use of it for a few enemies in my hack.
Title: Re: Steal/Sneak Command
Post by: Deathlike2 on August 19, 2010, 11:00:44 AM
I wonder what the formula is for the damage taken on a failed steal + damage.
Title: Re: Steal/Sneak Command
Post by: Mikey on August 19, 2010, 11:47:33 AM
Steal is absolutely garbage. I agree that it'd be better if it didn't only use the most common drop. The failure rate should be something like 1/5 instead of level based as well. Perhaps I'd finally get that damn Glass Mask. :bah:
Title: Re: Steal/Sneak Command
Post by: Deathlike2 on August 19, 2010, 12:08:24 PM
Well... I like Steal for the most part, since you can have unlimited steal.

Anyways..

For FF4A, this is the breakdown:

MaxHP < 4096, damage = 2
4096 <= MaxHP < 8192, damage = 258
MaxHP >= 8192, damage = 514

Will test FF4 next.

 :edit:

MaxHP < 4096, damage  = 0 (I've seen 2 or 3 in Eblan's Cave, I'm not sure why that happens)
4096 <= MaxHP < 8192, damage = 256
MaxHP >= 8192, damage = 512

Although, I have programmed the AI to "steal" from itself to dish out damage, so it's more like MaxHP/16 = damage where MaxHP >= 4096 and is rounded down to the nearest power of 2 or something along those lines... it would be nice if someone got around to calculating it.. but at some point I'll try it out myself.
Title: Re: Steal/Sneak Command
Post by: 8-bit Warrior on August 19, 2011, 05:01:05 PM
 :bump:

It doesn't seem like the info provided by Terrance is accurate for FF2us. I have here monsterdata.txt from the Tower of Bab-il docs. It provides the level in two hexadecimal values (one byte). I wasn't sure if it was correct at first, since some of them seem a little high...but I double-checked it with the Final Fantasy Wiki and they all correlate.

Where it gets wonky is enemies with the boss bit set. According to the doc, the first bit is the boss bit, the other seven are for the level. So for example, Sandy (who we know has the boss bit set) has a value of 90 for her level. A straight conversion to decimal gets you 144...seems unlikely. The FFWiki on the other hand lists 16 for her level. On the other hand, if you look at a binary hexadecimal chart and take out the first bit, you end up with 16 after all. Is there any other option than to do it manually like this?

Anyways, to get to the main point, I did some thiefing with a < Level 30 Edge in the Underworld. Up against a Level 36 RocLarva, Edge successfully stole a Potion 5/10 times. That's 10x better than the 5% Terrance predicted. Similarly, against a Level 41 Gloomwing, Edge got an Ether1 on the first shot.

It doesn't seem possible that it's working according to the formula Terrance provided. Unfortunately, this is about where my ability to investigate ends...
Title: Re: Steal/Sneak Command
Post by: Grimoire LD on October 01, 2013, 10:27:19 PM
Here is the actual formula (I know I've posted this twice now, but its only for the purposes of keeping things organized)


50 + Level - Target's Steal Prevention = Amount that will be tested against a Random Number (which seems like it can range from 1-255.) - If the value is over 100 it is an automatic success. (which can only happen in levels 60 and up.)  Target's Steal Prevention = Level +10 when a Monster.

The chance you will be damaged in a Failed Steal is if the Target's Steal Prevention is higher than a newly generated Random Number. So while it will happen often at low levels, it seems as you level up it will happen less and less. I can't help but think that's an oversight and it should work the other way around. Granted the formula is pretty awful on its own anyhow and should be changed for an improvement hack.

Title: Re: Steal/Sneak Command
Post by: Lenophis on October 02, 2013, 12:23:55 AM
I don't know if stats are static or not, but regardless, they should play some role in determining steal success rate.
Title: Re: Steal/Sneak Command
Post by: Grimoire LD on October 02, 2013, 01:38:15 PM
Hmm, maybe base it on Agility vs. Enemy's Speed and increase the base percentage to 65?
Title: Re: Steal/Sneak Command
Post by: Grimoire LD on October 02, 2013, 04:23:24 PM
Fixes to make to Steal...

1. Alter it to be 65 Base rather than 50.
2.  Base it on Agility vs. Enemy Speed.

$03/E1F0   A9 32   LDA #$32   A:0035   X:0000   Y:0000   P:envMxdizc - Load 32 into A (50?)
$03/E1F2   6D 82 26   ADC $2682  [$7E:2682]   A:0032   X:0000   Y:0000   P:envMxdizc - + Caster's Level.
$03/E1F5   38    SEC   A:003C   X:0000   Y:0000   P:envMxdizc - Set Carry Flag
$03/E1F6   ED 2F 27   SBC $272F  [$7E:272F]   A:003C   X:0000   Y:0000   P:envMxdizC - - Target's Steal Prevention.

To...

$03/E1F0   A9 41   LDA #$41   A:0011   X:0000   Y:0000   P:eNvMxdizc
$03/E1F2   6D 95 26   ADC $2695  [$7E:2695]   A:0041   X:0000   Y:0000   P:envMxdizc
$03/E1F5   38    SEC   A:004B   X:0000   Y:0000   P:envMxdizc
$03/E1F6   ED 15 27   SBC $2715  [$7E:2715]   A:004B   X:0000   Y:0000   P:envMxdizC

3. Make it so you can only steal once from any given enemy.

That... I thought would be easy enough. Set the Enemy's Item Byte to 00 and erase the check for C0. Unfortunately it seems that stealing is done after the game has already put back what it used in the 7E2700 area and any changes made to it do not carry over. I could change it using a Slot Check, but I can't use that either because it doesn't seem I have enough room to work with.

It's a difficult conundrum to be certain.
Title: Re: Steal/Sneak Command
Post by: chillyfeez on October 02, 2013, 04:56:13 PM
Enough room as in space to rewrite the subroutine, or enough room as in a place in RAM to set an "already stolen from" flag?
Title: Re: Steal/Sneak Command
Post by: Grimoire LD on October 02, 2013, 09:32:38 PM
Enough Space in the subroutine yes, because I don't believe the routine ever takes slots into account, and to make it do so seems quite difficult. I tried making a plain "STZ 7E2773" in 7E2773, but the game carries no changes done to the Target back to their normal stats. I wonder if it's a commonly used subroutine that I've ignored by any chance... If so there might be enough room in that regard.
Title: Re: Steal/Sneak Command
Post by: chillyfeez on October 02, 2013, 10:58:19 PM
You could always JSL to somewhere else if you need more subroutine space...
Title: Re: Steal/Sneak Command
Post by: Grimoire LD on October 02, 2013, 11:43:25 PM
That's true. But is there any place with free room enough to do this? I wish I could figure out just how the game takes the data change to 7E2700 section and turns it back into real data for the enemy.
Title: Re: Steal/Sneak Command
Post by: Dragonsbrethren on October 03, 2013, 05:15:48 AM
There's plenty of free space in the ROM, and expanding further (you'd never need it for code) it is painless.
Title: Re: Steal/Sneak Command
Post by: chillyfeez on October 03, 2013, 08:26:30 AM
Yeah, the Steal routine is relatively long, but it's still only about 11 (hex) lines. you could, in theory, open your hex editor and just search for
Code: [Select]
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
(a couple extra lines for your custom code)
I know from my summon research that this occurs at least twice among monster image data, but I wouldn't be surprised if you found several other instances as well.
Title: Re: Steal/Sneak Command
Post by: Grimoire LD on October 03, 2013, 09:19:44 AM
I had thought extending the Rom would throw off the CRC or something like that? Also I believe that Command Formulas are only revolved around 03XXXX, mainly because of this table I've found...

Starting 03B37C

00 - 99C4 (03C499 - Location of Fight)
01 - 9DEB (03EB9D - Item?
02 - 46CC (03CC46 - General Spell Call - White
03 - 0000 (Blank) - (Placeholder for Black)
04 - 0000 (Blank) - (Placeholder for Call)
05 - E9E9 (03E9E9 - DarkWave)
06 - 54E9 (03E954 - Jump)
07 - 1AEA (03EA1A - Recall)
08 - 00E9 (03E900 - Sing)
09 - 76E8 (03E876 - Hide)
0A - DCE2 (03E2DC - Salve)
0B - 52E8 (03E852 - Pray)
0C - 36E8 (03E836 - Aim)
0D - F0E7 (03E7F0 - Focus)
0E - B4E6 (03E6B4 - Kick)
0F - 96E6 (03E696 - Gird)
10 - 3EE4 (03E43E - Twin)
11 - C3EA (03EAC3 - Bluff)
12 - E6EA (03EAE6 - Cry)
13 - 0FE6 (03E60F - Cover)
14 - 53E1 (03E153 - Peep)
15 - 0000 (030000 - Crash)
16 - 4CE3 (03E34C - Throw)
17 - CCE1 (03E1CC - Steal)
18 - 0000 (Blank) - (Placeholder for Ninja)
19 - FAE3 (03E3FA - Regen)
1A - D1E3 (03E3D1 - Change)
1B - DEE9 (03E9DE - Parry)
1C - BBE8 (03E8BB - Show)
1D - 53E6 (03E653 - Off)
1E - A2E9 (03E9A2 - Jump's Return)
1F - 23E8 (03E823 - Focus's Return)
20 - E3E4 (03E4E3 - Spell Casting Portion of Twin)
21 - 4FB3 (03B34F - ??)
22 - 38E4 (03E438 - Something to do with the very end of Regen Routine?)
23 - 0000 (Blank) - ??
24 - B2E1 (03E1B2 - Something to do with the very end of "Enemy runs away" Routine?)
25 - 2002 (030220 - ??)
26 - BC20 (03BC20 - ??)
27 - 22BC (03BC22 - ??)
28 - 38A5 (03A538 - ??)
29 - D2E9 (03E9D2 - Something to do with the very end of Jump Routine?
2A - 058D (038D05 - ??)
2B - 1C36 (0336C1 - ??)
2C - AD77 (0377AD - ??

And so on...

But I see what you're getting at, using JSR's in unoccupied space in order to get what I need done, done.
Title: Re: Steal/Sneak Command
Post by: chillyfeez on October 03, 2013, 11:14:39 AM
You'd have to use a JSL instead of a JSR because that allows you to specify a three-byte address. The commands are all kept within the 3XXXX range for that exact reason (it takes one less byte of code to execute a JSR or a JMP versus a JSL or a JML). There's no reason, though, that you can't JSL to some random empty space outside of the 3XXXX range as long as you're just inserting an extra piece of linear code - you just RTL at the end and you'll be back in the 3XXXX range where you started.
Title: Re: Steal/Sneak Command
Post by: Lenophis on October 03, 2013, 11:31:25 AM
I had thought extending the Rom would throw off the CRC or something like that?
Making any kind of a change will throw off the CRC. If you're paranoid about it, recalculate the CRC when you're done making changes. :cycle:
Title: Re: Steal/Sneak Command
Post by: chillyfeez on October 03, 2013, 12:37:59 PM
One thing I'd be concerned with regarding expanding the ROM would be the effect that doing so might have on its compatibility with FF4kster (at this point it's probably safe to say your research here is intended to supplement edits you'll be making with FF4kster).
I've made far less significant changes that caused it to no longer recognize my ROM. I guess you could make a patch to apply after all FF4kster edits are finished, though...
Title: Re: Steal/Sneak Command
Post by: Grimoire LD on October 03, 2013, 11:25:03 PM
Hmm, yes that is a real danger. I'd rather not make any of the hacks I make be incompatible with the best FFIV Editor there is. I'll probably just have to use blank space already in the ROM itself, where ever that may be. It's a minor issue though. The real issue is to find how slots are recorded.
Title: Re: Steal/Sneak Command
Post by: Pinkpuff on October 04, 2013, 01:59:15 PM
In its current state, FF4kster is not a fan of nonstandard rom sizes. In fact, file size is currently how it checks whether the rom has a header.
Title: Re: Steal/Sneak Command
Post by: Grimoire LD on October 06, 2013, 11:32:42 AM
Thanks for the confirmation PinkPuff, yes I want the hacks i make to stay within the compatibility of the editor whenever possible.
Title: Re: Steal/Sneak Command
Post by: Dragonsbrethren on October 06, 2013, 04:03:50 PM
In its current state, FF4kster is not a fan of nonstandard rom sizes. In fact, file size is currently how it checks whether the rom has a header.
One trick you can use for any size expanded ROMs is to divide the filesize by 4Mb/512KB. If there's a remainder, the ROM has a header (or wasn't expanded properly). 4Mb is a safe value to use since the next biggest expanded size is 12Mb.

Though really, if you don't want to add support, it's not that big of a deal. Anyone capable of expanding the ROM and making use of that space is capable of extracting data from one ROM and inserting it to another. The only thing expanded support would be nice for is if you decide to support J2e's FF4 translation down the road.