• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 28, 2024, 06:27:36 am

News:

Please use .png instead of .bmp when uploading unfinished sprites to the forum!


ASM Requests

Started by The Damned, October 29, 2014, 09:16:45 pm

Glain

...A camera hack would be interesting... hmm...
  • Modding version: Other/Unknown

Xifanie

I personally haven't tested the camera instruction theory, but I think it wouldn't be enough and it would get reset after an ability's effect plays. You probably need to also toggle the flag controlling the angle state, otherwise "I'm at 30 degrees, but this flag says I'm not, so I better switch to 30 degrees".

My take would be a bit silly, scanning all the event instructions until EventEnd(), and overriding the very last camera instruction. Whoever, this would be far from perfect and you would need to somehow detect if an event is a battle. DarkScreen() is usually a good indicator of battles, but it's also used to make characters join. Thus, I think that DisplayConditions() in an event is the best indicator of a battle... either that or March(), but if you're going to force the camera to adjust, it's probably better to do it during a DarkScreen().

...and you'd also have to somehow make it compatible with your event skip hack.
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

xjamxx

September 12, 2018, 09:27:24 am #222 Last Edit: September 12, 2018, 02:05:53 pm by xjamxx
Thanks xifanie (elric and nyzer too) ;), i was trying to find a good way to know when an event was or not a battle (nice tips).
DarkScreen and DisplayConditions --> 129 files have that
March --> 119 files


QuoteYou probably need to also toggle the flag controlling the angle state, otherwise "I'm at 30 degrees, but this flag says I'm not, so I better switch to 30 degrees".

Well that kills, at least for now, my idea to change to a higher angle (60 or so)

old, an issue with the editor i solved somehow:

I am stuck now, i know this has nothing to do with ASM requests but, i am using the event editor. I extracted the test.evt from original iso ('97 file), decompile and recompile the .evt file, but guess what ... the files differ...
certutil -hashfile test.evt md5 = d9ca0f79ee00c1398f02e45ff70b8673 (original)
certutil -hashfile test-1.evt md5 = 171544e48786030d5191ea450fa8af7f (rebuilt)

And checking with binary comparison there are a lot of blocks that differ, but my guess is that the evt editor is trashing "useless" event data. Each block in the original start with "D9 C1 36 FA 37" but the rebuilt "93 36 FA 37" (one byte less), plus fills with a lot of zeros at the end of each block.

I only want to to mod the camera instruction, not the entire structure of the event data, is this possible with that tool?

Sorry for being out of topic, if u think this should go here: http://ffhacktics.com/smf/index.php?topic=11675.0
Then just say it, and i will post it there, so this thread keeps clean.
  • Modding version: PSX
<Random> This seems to be a PSX issue.
<Elric> A psx issue? That makes no sense. Sounds more like an issue with your OS.

Glain

Yeah, what interests me about this is more the idea of having free rotation/zoom with the L and R buttons.  I think what is to be done with the camera at the start of the battle (if anything) would depend on where that leads me.

Ability effects do reset the camera zoom, but I think we can change the value it resets back to.  I ran into this when I was figuring out how to skip ability effects...  if you skip Galaxy Stop, for example, the camera would stay zoomed really far out, so I had to figure out how to reset the zoom.  That in turn led me to find some of the values controlling zoom and rotation, and through the debugger I was doing some pretty crazy things (zooming in ridiculously far, zooming out so far you could barely see the map), so allowing the player more control over zoom and rotation mid-battle could be interesting... and might finally provide an out for the scenario where you can't quite get the view you want in the middle of a battle.

I've also seen that a weird camera can cause ability effects to get messed up though, doing huge rotations that look really weird... so in theory we would want to avoid that as well.  Not sure how this would all pan out but it does at least seem interesting.

  • Modding version: Other/Unknown

xjamxx

September 12, 2018, 10:46:09 am #224 Last Edit: September 12, 2018, 02:04:09 pm by xjamxx
i began modding by differential file comparison, it will take some time.

The idea of free rotation (we have some sort of step rotation around z axis, but not for x or y axis) and zoom, would be awesome, but i aim lower. The game has two states for zoom and angle, i was willing to have a asm patch that allow me to change those values, ex: close would be 100% and 30º, far would be 50% (33?) and (60º) plus setting initial values, cuz after 30 fights, is a pain to adjust camera manually in every battle...

OLD (i can delete it but if any want to see whole process):

UPDATE:
mmm ... i modded the first battle with Delita still camera reset....
Offset(x00014000)
//Remove the previous line if you wish not to override the offset in CONFIG.INI.
Text(x000000D3)
//Remove the previous line if you wish text to compile directly after instructions.

{7C}()
ColorUnit(x00,x00,x04,-031,-031,+000,000)
ColorField(x04,-031,-031,+000,000)
Wait(00002)
UnitAnim(x80,x00,x0002,x00)
Camera(+00728,-00237,+01560,+00446,+04608,+00000,+04096,+00001)
WaitForInstruction(x04,x00)
{63}(rC9)
Reveal(060)
Camera(+00728,+00019,+00616,+00302,+04608,+00000,+04096,+00196)
Wait(00030)
ColorUnit(x00,x00,x04,+000,+000,+000,008)
ColorField(x04,+000,+000,+000,008)
WaitForInstruction(x04,x00)
{66}()
Wait(00030)
DisplayMessage(x10,x70,x0001,x80,x00,x00,+00000,-00014,-00004,x01)
WaitForInstruction(x01,x00)
Wait(00016)
March(x80,x00,000)
Wait(00016)
EventSpeed(x02)
CameraFusionStart()
Camera(+00504,+00019,+00840,+00510,+05120,+00000,+04096,+00064)
Camera(+00504,+00019,+00841,+00341,+05637,+00000,+02048,+00128)
CameraFusionEnd()
DarkScreen(x00,x01,012,064,x00,004)
WaitForInstruction(x36,x00)
DisplayConditions(x08,090)
WaitForInstruction(x38,x00)
WaitForInstruction(x04,x00)
Camera(+00504,+00019,+00840,+00341,+05632,+00000,+02048,+00004)
WaitForInstruction(x04,x00)
DisplayConditions(x00,060)
WaitForInstruction(x38,x00)
RemoveDarkScreen()
WaitForInstruction(x36,x00)
EventSpeed(x01)
EventEnd()



UPDATE 2:
It seems that one map has more than one event file, cuz in Delita turn there is another event for the camera...


UPDATE 3:
Well, i edited all event files (EVT_ 010 to 012) in test.evt for the first battle with Delita still camera reset in combat mode, so its clear that battle events are not there or at least they aren't sorted with text events. Now i don't have any clue where to look...
Video:

  • Modding version: PSX
<Random> This seems to be a PSX issue.
<Elric> A psx issue? That makes no sense. Sounds more like an issue with your OS.

Glain

This patch changes what the camera zoom values are when you press L and R.

The values for both zoom-in and zoom-out are hardcoded in two places (each).  One place is for how far in/out the camera goes while zooming, and the other is where the camera stays after zooming.  That's for both zoom-out and zoom-in, so there are four variables total in this patch.  You'll probably want to make the zooming and fixed values for each set the same but you don't have to.


  <Patch name="Change camera zoom values">
    <Description>Change camera zoom values.  Lower is more zoomed out, higher is more zoomed in.  Recommended to use same values for zooming and fixed.</Description>
    <Variable name="Zoom-in value (zooming)" file="BATTLE_BIN" offset="86C0" bytes="2" default="1000" />
    <Variable name="Zoom-in value (fixed)" file="BATTLE_BIN" offset="86F8" bytes="2" default="1000" />
    <Variable name="Zoom-out value (zooming)" file="BATTLE_BIN" offset="8744" bytes="2" default="0C01" />
    <Variable name="Zoom-out value (fixed)" file="BATTLE_BIN" offset="8774" bytes="2" default="0C00" />
  </Patch>
  • Modding version: Other/Unknown

xjamxx

Thanks Glain,  ;)  i will test it asap.

A silly question if u recommend same values why zoom out have c00 and c01?
  • Modding version: PSX
<Random> This seems to be a PSX issue.
<Elric> A psx issue? That makes no sense. Sounds more like an issue with your OS.

3lric

Quote from: xjamxx on September 12, 2018, 10:46:09 am
i began modding by differential file comparison, it will take some time.

The idea of free rotation (we have some sort of step rotation around z axis, but not for x or y axis) and zoom, would be awesome, but i aim lower. The game has two states for zoom and angle, i was willing to have a asm patch that allow me to change those values, ex: close would be 100% and 30º, far would be 50% (33?) and (60º) plus setting initial values, cuz after 30 fights, is a pain to adjust camera manually in every battle...

OLD (i can delete it but if any want to see whole process):

UPDATE:
mmm ... i modded the first battle with Delita still camera reset....
Offset(x00014000)
//Remove the previous line if you wish not to override the offset in CONFIG.INI.
Text(x000000D3)
//Remove the previous line if you wish text to compile directly after instructions.

{7C}()
ColorUnit(x00,x00,x04,-031,-031,+000,000)
ColorField(x04,-031,-031,+000,000)
Wait(00002)
UnitAnim(x80,x00,x0002,x00)
Camera(+00728,-00237,+01560,+00446,+04608,+00000,+04096,+00001)
WaitForInstruction(x04,x00)
{63}(rC9)
Reveal(060)
Camera(+00728,+00019,+00616,+00302,+04608,+00000,+04096,+00196)
Wait(00030)
ColorUnit(x00,x00,x04,+000,+000,+000,008)
ColorField(x04,+000,+000,+000,008)
WaitForInstruction(x04,x00)
{66}()
Wait(00030)
DisplayMessage(x10,x70,x0001,x80,x00,x00,+00000,-00014,-00004,x01)
WaitForInstruction(x01,x00)
Wait(00016)
March(x80,x00,000)
Wait(00016)
EventSpeed(x02)
CameraFusionStart()
Camera(+00504,+00019,+00840,+00510,+05120,+00000,+04096,+00064)
Camera(+00504,+00019,+00841,+00341,+05637,+00000,+02048,+00128)
CameraFusionEnd()
DarkScreen(x00,x01,012,064,x00,004)
WaitForInstruction(x36,x00)
DisplayConditions(x08,090)
WaitForInstruction(x38,x00)
WaitForInstruction(x04,x00)
Camera(+00504,+00019,+00840,+00341,+05632,+00000,+02048,+00004)
WaitForInstruction(x04,x00)
DisplayConditions(x00,060)
WaitForInstruction(x38,x00)
RemoveDarkScreen()
WaitForInstruction(x36,x00)
EventSpeed(x01)
EventEnd()



UPDATE 2:
It seems that one map has more than one event file, cuz in Delita turn there is another event for the camera...


UPDATE 3:
Well, i edited all event files (EVT_ 010 to 012) in test.evt for the first battle with Delita still camera reset in combat mode, so its clear that battle events are not there or at least they aren't sorted with text events. Now i don't have any clue where to look...
Video:



Each event condition, like when someone talks mid battle, would have its own camera, yes. And yes, battles are in with the text only events. I've made over 250 custom events, and the camera is present in all of them, but you'd need to edit it in every battle event as well as their conditional events
  • Modding version: PSX

xjamxx

First, Glain I tried. a)flip values, and the zoom in and zoom out went anti-smooth b) try with 00F0 in zoom-out, and i could barely see the map.

Second, I don't think i am getting you Elric, all events are in test.evt or the are more files? cuz lets put the second video as an example:
a) 0- 15 sec it is controlled by EVT_010
b) 16- 57 sec i dont know what controls it...
c) 58- 72 sec it is controlled by EVT_011
d) 73- end sec controlled by player... (yet it still resets)
  • Modding version: PSX
<Random> This seems to be a PSX issue.
<Elric> A psx issue? That makes no sense. Sounds more like an issue with your OS.

3lric

Every single event in the game is in test.evt.

  • Modding version: PSX

Glain

September 12, 2018, 04:57:59 pm #230 Last Edit: September 13, 2018, 08:52:44 am by Glain
Quote from: xjamxx on September 12, 2018, 04:16:42 pm
Thanks Glain,  ;)  i will test it asap.

A silly question if u recommend same values why zoom out have c00 and c01?


The comparison it's doing is whether the current zooming value is >= 0x0c01.  By contrast it checks for zooming value < 0x1000 when going the other way.  I guess it's so that the zooming will stop in the case of the value being exactly equal.  It's probably not a big deal either way.

EDIT:

Quote from: xjamxx on September 12, 2018, 04:16:42 pm
a) 0- 15 sec it is controlled by EVT_010
b) 16- 57 sec i dont know what controls it...
c) 58- 72 sec it is controlled by EVT_011
d) 73- end sec controlled by player... (yet it still resets)


For scenarios (b) and (d) it's the battle engine controlling the camera since the event has already played.
  • Modding version: Other/Unknown

xjamxx

September 14, 2018, 10:34:01 am #231 Last Edit: September 14, 2018, 09:03:39 pm by xjamxx
I was sorting stuff, still not much progress, but remade your patch (though it uses weird syntax so current ASM wont read)
  <Patch name="Change camera zoom values">
    <Description>Change camera zoom and angle values.</Description>   
    <Variable name="Zoom-in value" file="BATTLE_BIN" bytes="2" default="1000" value="0C00" offset="84DC:1,84E4,86C0,86F8"/>
    <Variable name="Zoom-out value" file="BATTLE_BIN" bytes="2" default="0C00" value="0700" offset="854C:1,8554,8744:1,8774"/>
    <Variable name="Angle-in value" file="BATTLE_BIN" bytes="2" default="012E" value="0130" offset="87F4:1,87FC,8A54:1,8A5C,8AFC,8B04"/>
    <Variable name="Angle-out value" file="BATTLE_BIN" bytes="2" default="01C0" value="0400" offset="8860:1,8868,89FC,8A04,8A98:1,8AA0" />
  </Patch>

PatchXmlReader.cs from line 220
                    //PsxIso.Sectors varSec = (PsxIso.Sectors)Enum.Parse( typeof( PsxIso.Sectors ), varNode.Attributes["file"].InnerText );
                   
                    XmlAttribute defaultAttr = varNode.Attributes["value"];
                    if ( defaultAttr == null ) defaultAttr = varNode.Attributes["default"];
                   
                    foreach ( string varNodeOffset in varNode.Attributes["offset"].InnerText.Split(',') )
                    {
                    string[] varNodeOffsetPart = varNodeOffset.Split(':');
                    UInt32 varOffset = UInt32.Parse( varNodeOffsetPart[0], System.Globalization.NumberStyles.HexNumber );
                    UInt32 def = 0;
                    Byte[] byteArray = new Byte[bytes];
                   
                    if ( varNodeOffsetPart.GetLength(0) > 1 )
                    def = def + UInt32.Parse( varNodeOffsetPart[1], System.Globalization.NumberStyles.HexNumber );
                    if ( defaultAttr != null )
                    {
                    def = def + UInt32.Parse( defaultAttr.InnerText, System.Globalization.NumberStyles.HexNumber );
                    for (int i=0; i < bytes; i++)
                    {
                    byteArray[i] = (Byte)((def >> (i * 8)) & 0xff);
                    }
                    }
                    KeyValuePair<string, PatchedByteArray> kvp = new KeyValuePair<string, PatchedByteArray>( varName, new PatchedByteArray( varSec, varOffset, byteArray ) );
                    VariableType vType = new VariableType();
                    vType.content = kvp;
                    vType.bytes = bytes;
                   
                    variables.Add( vType );
                    }

Still the initial values are not there so every time i enter a battle it resets...

Also there is a weird behaviour with the angle, bird view is only for map and not toons, plus some squares are not getting drawn...
  • Modding version: PSX
<Random> This seems to be a PSX issue.
<Elric> A psx issue? That makes no sense. Sounds more like an issue with your OS.

3lric

Quote from: xjamxx on September 14, 2018, 10:34:01 am
Also there is a weird behaviour with the angle, bird view is only for map and not toons...



If you looked at a spritesheet for FFT, you'd see why this angle wont work
  • Modding version: PSX

Glain

Interesting routines/code:

Routine 0x8008e468 might be initializing the battle camera.  Particularly interesting:

8008e488: 3c04800c lui r4,0x800c
8008e48c: 24847ca0 addiu r4,r4,0x7ca0
8008e490: 34051000 ori r5,r0,0x1000
8008e494: 34061000 ori r6,r0,0x1000
8008e498: 0c010acb jal 0x80042b2c
8008e49c: 34071000 ori r7,r0,0x1000


Sets the camera zoom values to default zoomed-in value 0x1000.

Further in the same routine:

8008e4a0: 3c04800a lui r4,0x800a
8008e4a4: 24847784 addiu r4,r4,0x7784
8008e4a8: 3405012e ori r5,r0,0x012e
8008e4ac: 34060e00 ori r6,r0,0x0e00
8008e4b0: 0c010ac7 jal 0x80042b1c
8008e4b4: 00003821 addu r7,r0,r0


Copying some more values, including 0x12e which is what you listed as the default angle-in value.

Routine 0x8012dde8 is also playing with some camera values, including here:

8012dee4: 34021000 ori r2,r0,0x1000
8012dee8: ac620080 sw r2,0x0080(r3)
  • Modding version: Other/Unknown

xjamxx

September 15, 2018, 05:26:19 pm #234 Last Edit: September 15, 2018, 09:10:04 pm by xjamxx
Thanks, you are awesome  ;).

The routine at 0x8008e468, is not initializing the battle camera at least for the zoom. Haven't try the angle.

But this code:34021000 ac620080
which can be found twice in the iso, the first occurrence is the one for initializing the battle camera (zoom only tested)

You really are top  :oops:

In the iso the zone is:
003229E8h   D0 60 22 AC 00 10 02 34
003229F0h   80 00 62 AC 20 00 BF 8F

I changed to:
003229E8h   D0 60 22 AC 00 0C 02 34
003229F0h   80 00 62 AC 20 00 BF 8F

I also tried 07 and it work like a charm.

UPDATE:
Added to patch both angle (3 places not sure which is the key, all are near) and zoom:
  <Patch name="Change camera zoom values">
    <Description>Change camera zoom and angle values. Edit through xml.</Description>
    <Variable name="Zoom initial value" file="BATTLE_BIN" bytes="2" default="1000" value="0C00" offset="C6EE4"/>
    <Variable name="Zoom-in value" file="BATTLE_BIN" bytes="2" default="1000" value="1000" offset="84DC:1,84E4,86C0,86F8"/>
    <Variable name="Zoom-out value" file="BATTLE_BIN" bytes="2" default="0C00" value="0C00" offset="854C:1,8554,8744:1,8774"/>
    <Variable name="Angle initial value" file="BATTLE_BIN" bytes="2" default="012E" value="01C0" offset="C6E10,C6E24,C6E38"/>
    <Variable name="Angle-in value" file="BATTLE_BIN" bytes="2" default="012E" value="012E" offset="87F4:1,87FC,8A54:1,8A5C,8AFC,8B04"/>
    <Variable name="Angle-out value" file="BATTLE_BIN" bytes="2" default="01C0" value="01C0" offset="8860:1,8868,89FC,8A04,8A98:1,8AA0"/>
  </Patch>

Still there is an issue with r2 and l2, cuz a flag or smt like that make the game believe that the starting camera is always zoom in, so if u start with zoom out values, the first time u press r2 or l2 u won't notice anything.

Again, thanks for everything to Nyzer, Elric, Xifanie, special thanks to Glain (you really did it). I won't post anything else, at least about this camera hack, all credit goes to Glain (you found it plus you wrote the initial xml structure).

Now back to play my custom modded FFT, cya!
  • Modding version: PSX
<Random> This seems to be a PSX issue.
<Elric> A psx issue? That makes no sense. Sounds more like an issue with your OS.

TheAvelon

I have a request. After messing around in FFTP I think this is an ASM quandary.

I'd like for Teleport's 100% success range to be MA/2 rounding down. A character with 15 MA can teleport 7 tiles and has a 90% success rate for teleporting 8 tiles.

It may be best to make it MA/2.5 or 3; but if this gets made I can tinker with the exact number from there. My hack's base is a TO style job growth change so pure mages will have higher base MA growth and I'm not sure yet what they're going to look like at level 99.

Then again a level 99 mage SHOULD be able to teleport halfway across the map.
  • Modding version: PSX & WotL
Truly, if there is evil in this world, it lies within the heart of mankind.

xjamxx

October 01, 2018, 12:16:14 pm #236 Last Edit: October 03, 2018, 08:58:55 am by xjamxx

Try this:
  <Patch name="Teleport Failure MA Hack">
    <Description>It changes the base for failure in teleport, MA div ma_factor instead of Move. No variables, so edit through xml only. Edit this eqv if needed:
   ma_factor   Amount to divide MA.</Description>
    <Location file="BATTLE_BIN" offset="176C58" mode="ASM" offsetMode="RAM">
    .eqv  %ma_factor, 0x0003
      lbu v0,0x0037(a2)            #Load MA
      subu a0,zero,a0            #Make Y Distance positive
      addu v1,v1,a0               #X Distance + Y Distance
      ori t1,zero,%ma_factor
      divu v0,t1
      mflo v0                  #v0 = MA div ma_factor
      ori a0,zero,0x0050         #a0 = 100% = 80 = 50h
      subu v1,v1,v0               #Distance -  MA div ma_factor
      jal 0x0005e0cc             #Check if Random is greater/equal to Chance
      sll a1,v1,0x03            #Extra Distance * 8 (10% chance of failure for tile 8-80)
   </Location>
  </Patch>

As always my patches need testing, this one is no exception. Big issue could be that it is not getting MA, but something else...
If you just want MA/2, then the patch is smaller:
  <Patch name="Teleport Failure MA Hack v2">
    <Description>It changes the base for failure in teleport, MA/2 instead of Move.</Description>
    <Location file="BATTLE_BIN" offset="176C58" mode="ASM" offsetMode="RAM">
      lbu v0,0x0037(a2)            #Load MA
      subu a0,zero,a0               #Make Y Distance positive
      addu v1,v1,a0               #X Distance + Y Distance
      srl v0,v0,0x01            #v0 = MA/2
   </Location>
  </Patch>


Read following post.
  • Modding version: PSX
<Random> This seems to be a PSX issue.
<Elric> A psx issue? That makes no sense. Sounds more like an issue with your OS.

Glain

Instead of, or in addition to, using MA Factor as a label (and actually i'd use .eqv if you want a constant... labels are for addresses), you could set it up as a variable at RAM 0x176C64 = BATTLE.BIN 0x10FC64.  Clever using 8/80 instead of 10/100 to gain space in the code, but then why not just do 1/10 and not shift at all?

It also might make sense to multiply by the variable then divide by 128 so you could effectively divide by something like 2.5...
  • Modding version: Other/Unknown

xjamxx

October 01, 2018, 07:19:14 pm #238 Last Edit: October 03, 2018, 09:14:41 am by xjamxx
Quote from: Glain on October 01, 2018, 07:03:31 pm
use .eqv if you want a constant... labels are for addresses)
thanks didn't knew it
Quote from: Glain on October 01, 2018, 07:03:31 pm
you could set it up as a variable at RAM 0x176C64 = BATTLE.BIN 0x10FC64
I don't like using variable cuz i usually forget to change them at the .exe, yeah i know its not an excuse but i like asm entire block
Quote from: Glain on October 01, 2018, 07:03:31 pmbut then why not just do 1/10 and not shift at all?
I thought the same, but may be that would fk the RNG calculation? not sure, still haven't check RNG.
Quote from: Glain on October 01, 2018, 07:03:31 pmIt also might make sense to multiply by the variable then divide by 128 so you could effectively divide by something like 2.5...
Yeah but since the one who asked for this didn't tested I went back to another thing and stop this optimization.

UPDATE: here it goes if any1 wants it as Glain:
  <Patch name="Teleport Failure MA Hack v3">
    <Description>It changes the base for failure in teleport, MA * ma_factor/128 instead of Move. No variables, so edit through xml only. Changes suggested by Glain. Edit this eqv if needed:
   ma_factor   Amount to multiply MA/128, 64=MA/2, 51=MA/2.5, 42(43)=MA/3.</Description>
    <Location file="BATTLE_BIN" offset="176C58" mode="ASM" offsetMode="RAM">
    .eqv %ma_factor, 64
      lbu v0,0x0037(a2)            #Load MA
      subu a0,zero,a0            #Make Y Distance positive
      ori t1,zero,%ma_factor
      multu v0,t1
      mflo v0                  #v0 = MA * ma_factor
      addu v1,v1,a0               #X Distance + Y Distance
      srl v0,v0,0x07            #v0 = MA * ma_factor/128
      subu a1,v1,v0               #Extra Distance = Distance -  MA * ma_factor/128
      jal 0x0005e0cc             #Check if Random is greater/equal to Chance
      ori a0,zero,0x000a         #a0 = 100% = 10 = ah (10% chance of failure for tile 1-10)
   </Location>
  </Patch>

UPDATE 2: tested, as i fear it doesn't read MA, so it needs :more: hacking, with this should suffice for definitive version:
  <Patch name="Teleport Failure MA Hack">
    <Description>It changes the base for failure in teleport, MA * ma_factor/128 instead of Move. No variables, so edit through xml only. Changes suggested by Glain. Edit this eqv if needed:
   ma_factor   Amount to multiply MA/128, 64=MA/2, 51=MA/2.5, 42(43)=MA/3.</Description>
    <Location file="BATTLE_BIN" offset="1744C0" mode="ASM" offsetMode="RAM">
      lui t0,0x8019
      sb v0,0x0007(s3)
      lbu v0,0x0048(s1)
      sw s1,0x2d98(t0)            #Store unit data pointer in attacker slot.
    </Location>
    <Location file="BATTLE_BIN" offset="176C10" mode="ASM" offsetMode="RAM">
      lui t0,0x8019
      lw a2,-0x0b20(t0)
      addiu sp,sp,0xffe8
      sw ra,0x0010(sp)
      lbu v0,0x0024(a2)
      lw t0,0x2d98(t0)            #Read unit data from attacker slot.
    </Location>
    <Location file="BATTLE_BIN" offset="176C58" mode="ASM" offsetMode="RAM">
    .eqv %ma_factor, 64
      lbu v0,0x0037(t0)            #Load MA
      subu a0,zero,a0            #Make Y Distance positive
      ori t1,zero,%ma_factor
      multu v0,t1
      mflo v0                  #v0 = MA * ma_factor
      addu v1,v1,a0               #X Distance + Y Distance
      srl v0,v0,0x07            #v0 = MA * ma_factor/128
      subu a1,v1,v0               #Extra Distance = Distance -  MA * ma_factor/128
      jal 0x0005e0cc             #Check if Random is greater/equal to Chance
      ori a0,zero,0x000a         #a0 = 100% = 10 = ah (10% chance of failure for tile 1-10)
   </Location>
  </Patch>
  • Modding version: PSX
<Random> This seems to be a PSX issue.
<Elric> A psx issue? That makes no sense. Sounds more like an issue with your OS.

TheAvelon

Awesome! This is exactly what I was hoping for! Thanks muchly, I will figure out how to implement this and test it tomorrow. Been consumed all evening with another area of the patch I'm working on and didn't check the forums


You rock.
  • Modding version: PSX & WotL
Truly, if there is evil in this world, it lies within the heart of mankind.