News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Secret of Mana, Turbo - Beta 191205  (Read 131049 times)

kethinov

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Re: Secret of Mana, Turbo - Beta 191004
« Reply #600 on: October 05, 2019, 01:30:04 am »
slight divergence from kethinov's in that it doesn't do reduced damage when multi-target casting and used a different address to store the custom spell function (this actually turned out to be a compatibility savings, we'll discuss this further as I'm not averse to restoring the multi-target penalty, just went ahead with it for demonstration purposes)

Clever. Much more compact. I'm reading the code now and it looks like the significant diffs compared to my original Firenado/ Hellfire spell definition are:

- You skipped the JSRs to CalculateSpellUses and CalculateSpellPowerAndTimer. I presume they were only needed to reduce damage in a multi-target situation?
- You skipped the NOPs... I didn't realize these were optional. :huh:
- You skipped enabling the 16-bit accumulator. I presume this is also due to not needing to track multi-target damage?
- You removed storing quotient into a temp variable. I presume this is also due to not needing to track multi-target damage?
- You refactored the test to see if spell target has Salamando resist to test for 1 byte value instead of 2 byte value. That makes sense.
- You added C22108EA which does I'm guessing REP #$21 and then... yeah I dunno. What is that?
- You removed clear carry flag because it isn't necessary anymore.

Anyway yeah I certainly don't object to removing the multi-target penalty. I hadn't considered the question one way or the other and don't really have an opinion on it.

Also why write it to C800C0 instead of C800C9? The latter would put it at the very end of the buffer space, leaving more of it above for other uses.
« Last Edit: October 05, 2019, 01:39:53 am by kethinov »

Queue

  • Full Member
  • ***
  • Posts: 239
    • View Profile
Re: Secret of Mana, Turbo - Beta 191004
« Reply #601 on: October 05, 2019, 02:42:12 am »
CalculateSpellUses is specifically what reduces effective spell level by dividing it by number of targets; that's actually all it does. Whoever named it that surely did so because quite a few spells use the spell's level to decide use count (Sabers, Moon Energy, Wall, but other spells use it for spell strength like Evil Gate, Revivifier, Remedy).

The results of CalculateSpellPowerAndTimer are actually totally unused by Evil Gate. It calling it was a waste of processing power. Evil Gate ignores the result and calculates its damage from scratch, (target's current HP + max HP) / 2 / (10 - spell level). This use of spell level is what's affected by CalculateSpellUses.

The NOPs themselves aren't what matter, just that there are at least 16 cycles between "STA $004204" and "LDA $004214"; I moved the element check between them to make productive use of the time waiting on the divide result.

I do change back to a 16-bit accumulator before reading the division result and adding it to the target's incoming damage. REP #21 both changes the accumulator to 16-bit (#20) and clears the carry flag (#01). Subsequent instructions don't set the carry flag so it stays clear all the way until the ADC. Actually, now that this has come up, the other (earlier) CLC could be removed in the same fashion, by having the REP pull double-duty (LDA doesn't affect the carry flag). Oh, as could the SEC for the subtraction (using the preceding SEP). Woohoo, 2 more free bytes and 4 cycles.

I did skip using the temp variable because I moved the element test up, but technically it was never really needed. The original code loads the division result, stores it in the temp, does the element (née boss) test, then loads the temp; they could have just as easily waited until then to load the division. Lots of reasons they might've done it this way but all of them moot because the final Evil Gate behavior didn't need it.

C22108EA =
REP   #21   ' 16-bit A, CLC
PHP
NOP

Still needed 1 NOP to make ~16 cycles before division result read. The PHP is to save the element test result (zero flag) for use after reading the division result.

I moved it to $C800C0 in case you wanted to make any changes (like re-adding the JSR CalculateSpellUses); no point packing it to the end (which requires byte counting or at least checking output in a hex editor) until I was sure it was finalized. I moved it away from $C80299 because everything between $C801E1 and $C8033F is technically usable (though just unused in vanilla), while everything between $C80080 and $C800FF is never read by vanilla code. I also verified that the data at $C80340 is actually used and not just garbage data, though I didn't bother figuring out what it was for.

It would make the code less extensible and compatible (with Turbo, if applying the IPS externally), but another 12 bytes could be saved by putting JMP $EDBB right after LDA $004214 to jump to the original Evil Gate's function end and scrapping what is otherwise duplicated code.

zoolgremlin

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 130
  • Steam Profile Name: keeperofcastlegreydusk
    • View Profile
Re: Secret of Mana, Turbo - Beta 191004
« Reply #602 on: October 05, 2019, 05:56:25 am »
A quick correction to my earlier assertion about Frosty:

I thought that Frostied targets could still be targeted by spells, but playtesting my latest rough hack, the game isn't letting my characters target Frostied monsters.  Not sure yet whether Frostied characters can still be hit with spells, but I guess I'll find out pretty soon... <sigh>.

Frosty really isn't very useful after all, is it now?  :huh:



EDIT

@Queue:  Whoops... forgot to give thanks for the latest update.  My bad...   :(

Thanks very much, and I hope you are well.   Will check it out now...  8)
« Last Edit: October 05, 2019, 10:25:12 am by zoolgremlin »
If you try to fail, and succeed, what've you done?!

hmsong

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Re: Secret of Mana, Turbo - Beta 191004
« Reply #603 on: October 05, 2019, 11:10:53 am »
@zoolgremlin

Holy shit.  You're right.  I just checked, and you can't target Frosty victims with spells.  Meaning, Frosty enemies are immune to both physical and magical attacks.  Wow, Frosty sucks.  Horrible.  That needs to be changed.  Yeah, I vote for 50% instant damage.  At least (assuming the initial melee still does damage, in addition to the 50% cut).  So if you don't kill the enemy in one hit, he'll stick around for a long time (annoying).  I guess that's fair.

Or better yet, Frosty ticks away MP (similar to how Poison ticks away HP).  It'll be more unique that way.  Still not very useful, but it's better than what it is right now.

I actually wanted Shadow Saber to do that (I wanted it to damage both HP and MP, not absorb MP).  Absorbing MP just makes Faerie Walnut/coconut obsolete.
« Last Edit: October 05, 2019, 12:00:10 pm by hmsong »

Queue

  • Full Member
  • ***
  • Posts: 239
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #604 on: October 05, 2019, 03:48:12 pm »
Version 2019-10-05:
https://ufile.io/f8vusnzt

Changes:
- Verified and incremented kethinov's Earlier_Midge_Mallet from v1.0 to v1.1
- Updated kethinov's Later_Midge_Mallet to v1.3 (even if he changes it more later, wanted to get a functional version in)
- Updated hmsong's Enemy_Type_And_Element_Changes and Alternate_Transform_List
- Added hmsong's Mimic_Box_Rewards
- Fixed bug in Equip_2nd_Weapon hotkey code for the girl and sprite
- Finished adding Relocalized spell name addresses to "SPELL DATA DEFINITIONS", which probably fixed a mistake in my Hellfire Relocalized compatibility

Technical Changes:
- Changed "SPELL DATA DEFINITIONS" address format for spell function table/list to allow their use with the COPY directive
- Added 9 SSE.Text.Extended.Extra.* variables to assist with modifying spell names
- Minor SSE general spell function optimizations
- Medium SSE Dispel Magic spell function optimization (should go through a little testing to verify I didn't break it)
- Minor Hellfire spell function optimization and relocation (packed to the end of the space it's stored in)
« Last Edit: October 05, 2019, 05:06:37 pm by Queue »

kethinov

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #605 on: October 05, 2019, 04:26:01 pm »
Nice work compacting the code!

There's a small bug in the new Hellfire spell code. If you uncheck everything except Hellfire and then cast it on something, the game crashes. This is because the pointer at C8/E81B needs to change to D700 in this scenario.

Queue

  • Full Member
  • ***
  • Posts: 239
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #606 on: October 05, 2019, 04:58:36 pm »
Oh whoops, yeah, I forgot to update the address in the spell function list from $C800C0 to $C800D7 when I relocated it. It'll affect anyone who has Hellfire On and Evil_Gate_-_More_Useful Off until I get an update out. Grr.

Edit: Updated the download link with a new upload that shouldn't have the problem. I normally never do so without a version number increment but whatever, hopefully not too many downloads yet.

If anyone is crashing with Hellfire On and Evil_Gate_-_More_Useful Off, and can see this message, redownload 2019-10-05 from the link 2 posts up. If it still crashes, then let me know.

October 05, 2019, 08:15:30 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
hmsong, okay, let me see if I can explain exchanging spell names. Here's what you posted previously:
Code: [Select]
'[Spell Name 04: Grave Flare]
@OFF $CA0808
ADR.16 SSE.Text.Extended.White.2.1
@OFF SSE.Text.Extended.White.2.1
TEXT ^G r^ a^ v^ e^ _ ^F l^ a^ r^ e^ \0

'[Spell Name 10: Quick] <-- Relocalized name for Speed Up
@OFF $CA0820
ADR.16 SSE.Text.Extended.White.2.2
@OFF SSE.Text.Extended.White.2.2
TEXT ^Q u^ i^ c^ k^ \0
In the newest release I added some more global constants that I'll be using when explaining, so make sure you're working on 191005.

First, here's how you can now rename Fire Bouquet:
Code: [Select]
@OFF Spell.Text.Fire_Bouquet
TEXT ^G r^ a^ v^ e^ _ ^F l^ a^ r^ e^ \0
A little easier right? It also automatically handles Relocalized compatibility, but there's a catch: when overwriting any spell name, you need to check if it will fit. In the ZPS file, search for the Spell.Name.* you're going to replace (in this case "Spell.Text.Fire_Bouquet") and there will be two entries for it: one vanilla and one Relocalized, and both have a comment saying how many bytes are available (excluding the \0 null terminator). You need to check both, and note that the small number of the two is your maximum. For Spell.Text.Fire_Bouquet, the two entries are:
Code: [Select]
/$CA9986 Spell.Text.Fire_Bouquet ' max 12
/$CA995D Spell.Text.Fire_Bouquet ' max 11
So the smaller maximum is 11, so if you overwrite it you're limited to 11 bytes (functionally 11 characters); luckily, "Grave Flare" is 11 bytes so it fits!

If it won't fit, I added 9 new variables that can be used instead:
SSE.Text.Extended.Extra.1 through 9
These are functionally limited to 15 bytes (like "Inferno Barrier") because longer names are too long for some SoM menus. These extra slots do require SSE.

Now, here's how you can exchange two spell names; I'll demonstrate then try to explain it:
Code: [Select]
@OFF $%[]%00
COPY Spell.Name.Speed_Up 02
COPY Spell.Name.Fire_Bouquet 02
@OFF Spell.Name.Speed_Up
COPY %[]%02 02
@OFF Spell.Name.Fire_Bouquet
COPY %[]%00 02
First off, %[]%00 is temporary scratch space. You copy the spell name pointers for both spells to the temporary space, then you copy each one from the temporary space in place of eachother. There's a lot to take note of there: each copy is 2 bytes, and when copying from the temporary space, note the %[]%02 is copying from 2 bytes into the temporary space.
« Last Edit: October 05, 2019, 08:15:30 pm by Queue »

hmsong

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #607 on: October 05, 2019, 08:51:10 pm »
@Queue

Okay, let me rephrase what I understood (which is probably not accurate).  I'm still not quite understanding it, but I did what you posted.  I get you post the names into temp spaces with "%[]%00", but you can copy both names into this one space?  And for Fire Bouquet, you're using paste function with "@OFF Spell.Name.Fire_Bouquet   COPY   %[]%00 02", so I'm guessing you're using the temp space as permanent?  After all, you only edited 1 byte space when you were copying into temp space...

Queue

  • Full Member
  • ***
  • Posts: 239
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #608 on: October 05, 2019, 09:42:54 pm »
Hm, I started typing up one reply, but reading it, it was too complicated. I'll try a different approach.

Code: [Select]
@OFF $%[]%00
COPY Spell.Name.Speed_Up 02
COPY Spell.Name.Fire_Bouquet 02
After these three lines the scratch space contains 4 bytes. The first and second byte are the contents of Spell.Name.Speed_Up and the third and fourth byte are the contents of Spell.Name.Fire_Bouquet.

Code: [Select]
@OFF Spell.Name.Speed_Up
COPY %[]%02 02
This takes the third and fourth byte from the scratch space and writes them to Spell.Name.Speed_Up. As stated in the previous paragraph, the third and fourth byte are the contents of Spell.Name.Fire_Bouquet, so Speed_Up now has Fire_Bouquet's name.

Code: [Select]
@OFF Spell.Name.Fire_Bouquet
COPY %[]%00 02
This takes the first and second byte from the scratch space. So this will give Fire_Bouquet Speed_Up's name.

Each COPY in this process each copies 2 bytes. The scratch space has room for 256 bytes, and this process only uses 4.

kethinov

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #609 on: October 06, 2019, 01:41:07 am »
I put up a fairly significant update to "Remove Empire Castle Gate Permanently" http://www.romhacking.net/hacks/4549/

Changes:

A kid in Northtown will now offer clues about a mysterious treasure chest in the castle’s throne room. The Emperor’s treasure chest now contains a sword orb instead of 1000gp, but you’ll have to fight tougher monsters in order to reach it on your second visit such as Dark Knights and a Dark Stalker just outside the throne room. (If you get the sword orb in the Emperor’s chest, this prevents the one in Grand Palace from spawning because you got it early.)

Other changes include the addition of an extra 1000gp chest in the castle basement to make use of an unused corner of the room and a new 50gp treasure chest behind the infamous secret passage in Northtown that conspicuously exists but serves no actual purpose in the original game. A side effect of this hack is that it will delete the old woman in town who creepily says nothing to you when you try to speak to her, even after you clear Northtown Ruins. She was depressing, so she won’t be missed. (This is to make room in the game’s memory for the new treasure chest.) These changes are copied directly from “Secret of Mana Treasure in Northtown Woods 1.1″ and are necessary to make room for the new dialog offering clues about the Emperor’s treasure chest. Her husband (the old man who says his wife is acting strangely) was also replaced with an Imperial Solider who warns you not to loiter. This too was done to make room for the new dialog offering clues about the Emperor’s treasure chest.

If you’re using Level 9 Weapons Progression Balance, be sure to apply that patch first, then apply this one after. This hack reverts the new sword orb added to Palace of Darkness by Level 9 Weapons Progression Balance, forcing you to do this sidequest to get the extra sword orb (else you’ll get two sword orbs in the Grand Palace chest).

Known issue: The new clues dialog is not available when this is combined with VWF or Relocalized.

I also updated Hellfire on RHDN to match Queue's refactoring of the spell definition code and to include the removal of the damage penalty for multi-targeting.

hmsong

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #610 on: October 06, 2019, 01:42:18 am »
I am so sorry, but I'm still not quite understanding it.

When you put "@OFF $%[]%00", I get that you opened up some space so that you can overwrite some things... in which case, you put "Spell.Name.Speed_Up 02" and "Spell.Name.Fire_Bouquet 02".  So here's my question:

1. What is that "02"?  Do those numbers have to be 02?
2. And when you're recalling with "@OFF Spell.Name.Speed_Up   COPY   %[]%02 02" and "@OFF Spell.Name.Fire_Bouquet   COPY   %[]%00 02", which "02" is being recalled?

I guess most of my confusion is from so many "02"s.

October 06, 2019, 01:51:37 am - (Auto Merged - Double Posts are not allowed before 7 days.)

@kethinov

First, thank you for your Emperor Gate + Early Sword Orb.  Would it affect the sword orb obtained from the king?

Second, when you were talking about the extra 1000gp chest in the castle basement, were you referring to the Pandora castle basement or the Emperor castle's basement?  Also, for the extra 50gp chest in the Northtown woods, you said, "“Secret of Mana Treasure in Northtown Woods 1.1″ and are necessary to make room for the new dialog offering clues about the Emperor’s treasure chest."  So does that mean that if we were to use this new patch, the [Secret of Mana Treasure in Northtown Woods 1.1] patch does not need to be applied, since the new Emperor Gate patch already does that?

Quote
A side effect of this hack is that it will delete the old woman in town who creepily says nothing to you when you try to speak to her, even after you clear Northtown Ruins. She was depressing, so she won’t be missed.

LOL.
« Last Edit: October 06, 2019, 02:01:11 am by hmsong »

Queue

  • Full Member
  • ***
  • Posts: 239
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #611 on: October 06, 2019, 02:26:10 am »
The short answer is most of those 02's are how many bytes to copy.

The COPY directive takes two arguments: the address to copy bytes from, and how many bytes.

%[]%, despite how cryptic it looks, is a variable name that is replaced with FFFF. This means @OFF $%[]%00 = @OFF $FFFF00.

So the first code block is something like:
@OFF $FFFF00
COPY $CA0808 02
COPY $CA0820 02

Which means, at least temporarily, $FFFF00 holds 4 bytes: two bytes copied from $CA0808 then two bytes copied from $CA0820.

Next is:
@OFF $CA0808
COPY $FFFF02 02
@OFF $CA0820
COPY $FFFF00 02

That first COPY uses the 3rd and 4th byte ($FFFF02 and $FFFF03). The second COPY uses the 1st and 2nd ($FFFF00 and $FFFF01).

So after this, $CA0808 contains the two bytes from $FFFF02 which came from $CA0820, and $CA0820 contains the two bytes from $FFFF00 which came from $CA0808. Which is a long way of saying the two bytes at $CA0808 and the two bytes at $CA0820 traded places.

Does that clarify anything? If it doesn't make sense, it's my failing as a teacher, so I don't mind continuing trying to explain; just keep asking.

Note: the stuff located at $FFFF00 gets overwritten multiple times while processing the ZPS file and replaced with zeroes before the ROM is written out so when using the scratch space, write to it then immediately COPY back out of it.

kethinov

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #612 on: October 06, 2019, 02:29:59 am »
Would it affect the sword orb obtained from the king?

No.

Second, when you were talking about the extra 1000gp chest in the castle basement, were you referring to the Pandora castle basement or the Emperor castle's basement?

The latter. It's in the same room with the vanilla 1000gp chest in the castle. Now there's two. One in each corner of the room. This makes use of the dead end corner of the room nobody ever visits because there was no reason to go over there.

Also, for the extra 50gp chest in the Northtown woods, you said, "“Secret of Mana Treasure in Northtown Woods 1.1″ and are necessary to make room for the new dialog offering clues about the Emperor’s treasure chest."  So does that mean that if we were to use this new patch, the [Secret of Mana Treasure in Northtown Woods 1.1] patch does not need to be applied, since the new Emperor Gate patch already does that?

Correct. Harmless to apply it anyway though because they implement the same code changes.

hmsong

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #613 on: October 06, 2019, 05:09:31 am »
@Queue

Ohhh.  Now, I'm starting to see it (barely, after reading it over several times).  With everything flattened out in something I already know, I can understand.  Thank you for the explanation.  It's so much clearer now.

Now, I need some guide to change enemy behavior.  Whether it'd be target change, or spell change...



@kethinov

Ahh.  Nice.  Thank you.



@zoolgremlin @Queue

Ever since zoolgremlin mentioned about how crappy Frosty is, I've been thinking about SEs, and here's my... bright idea:

How about replacing Paralysis with Haste? (currently Mire)  Yes, it means it's a positive SE, instead of negative SE.  It makes the target's movement faster (it makes PC's normal movements have run speed (run animation?), and it makes monsters move a lot quicker).  This SE can only be "inflicted" with Speed Up spell (Speed Up also would give Acc/Eva boost, but that has nothing to do with Haste SE).  In addition:
 - Haste cancels out Slow SE (and vice versa).
 - Haste still affects faster stamina recovery (if that patch is on).
 - Having equipments that blocks Paralysis will no longer be necessary, since it's a positive SE.
 - Hopefully can affect bosses (like Mech Rider), which will make them harder.  They're still immune to Slow though.

Instead, make Balloon have Mire effect (can attack, but cannot move).  We already have Frosty, Petrify, and Engulf for "cannot move + cannot attack" status (freeze).  And make Petrify NOT do any damage (not even 25%).  Instead, make that into Frosty (since it becomes immune to both physical/spell attacks).  So in summary:

vanilla + Mire:
--------
Paralysis:   Can attack, but cannot move (Mire SE).
Frosty:      Freeze, but immune to physical/magic attacks.
Petrify:   Freeze + 50% damage + vulnerable to attacks. (patch makes it 25% damage + higher DEF)
Balloon:   Freeze + vulnerable to attacks.
Engulf:      Freeze + HP DOT + vulnerable to attacks.

My proposal:
--------
Paralysis:   Haste (positive SE - makes normal movement faster (run?), makes enemies faster).
Frosty:      Freeze + MP DOT (1MP/tick), but immune to physical/magic attacks.
Petrify:   Freeze + vulnerable to attacks. <<--- original Balloon effect
Balloon:   Can attack, but cannot move - they're only being lifted off the ground <<--- original Mire effect.
Engulf:      [Freeze] + HP DOT + vulnerable to attacks.
      I prefer [Freeze] to be [disable attacks] + [must-move], but you already implied that's unlikely to happen.

I actually want Frosty and Petrify effects to be each other's SE (Frosty  is freeze + vulnerable to attacks, and Petrify is freeze + MP DOT, but immune to everything), but I have a feeling that it'll be too difficult.

Either case, this has the side effect of screwing up Mud Saber, but it nerfs the original Stone Saber (which is good).  And makes Ice Saber a bit more useful (barely).

Perhaps you can mix and match these SEs with your own ideas.
« Last Edit: October 06, 2019, 10:20:36 am by hmsong »

Queue

  • Full Member
  • ***
  • Posts: 239
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #614 on: October 06, 2019, 02:05:42 pm »
At a cursory glance, there are some problems (technical, not conceptual) with your suggestions:
- Letting enemies attack while balloon'd: the balloon graphic is actually a weapon that replaces the enemy's weapon while they're balloon'd; so it messes with their offensive stats and probably can't handle any attack animations without turning in a pile of glitchy graphics.
- The status effects that disable an enemy replace their AI while the status effect is on them; this means they don't follow their normal movement logic, attack logic, etc. they all share one generic "affected by status effect" logic, so if something was to disable attacks but allow movement, all enemies afflicted by it would use the same movement logic and not their own. Or worded another way, status effects can't disable just melee or just spell casting (or both), yet allow the enemy's normal movement, because that's not how status effects work on enemies; status effects temporarily replace their normal AI.
- Making enemies move faster seems to really mess up their AI; there's a feature from zhaDe's NGI, Combat\Quicker_Enemies, that's Off by default. Try turning it On and see how some enemies don't function well with a higher movement speed.

Anyway, my current plan is still to investigate repurposing the Moogle status effect; just haven't gotten to that. Barrel also might have similar potential in that all enemies are immune to it so selectively enabling it for specific enemies (and changing what it does to enemies) might open up new options.

Pretty much any of this stuff is a large time investment so I typically need to be ready to commit a week at a time to expect to make any progress on it; to be frank, I have stuff I want to do first.

hmsong

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Re: Secret of Mana, Turbo - Beta 191005
« Reply #615 on: October 06, 2019, 06:14:00 pm »
Ahh.  I see.  Too bad.  I was actually using Quicker Enemies, but I wasn't paying attention to the enemy AIs.  Oh well.  I look forward to seeing your new moogle SE.

Well, on to my original problem.

I know that you're very busy(well, you're always working on something).  However, could you perhaps give me a few pointers about enemy spells? (spells, target selection, etc)  I'm still working on Grave Flare, but as you said, I need to edit the enemy behavior change from changing spells (I haven't decided whether to change the spell, or change the target, but that's something I can decide later).

Looking at your NPC Fire Wall, you have Dark Funk:

Code: [Select]
'(Dark_Funk).Start
' target dist > 02 && target dist <= 04 && !tired && onscreen && 1/16 chance && target !engulfed
@OFF $D05C9E
'RAW E9 04 11 ' CastSpell ( Attack Anim: 04, Spell: 11 ), Blaze Wall
RAW E9 04 3B ' CastSpell ( Attack Anim: 04, Spell: 3B ), Blaze Wall (NPC)

This is the hex code: https://ibb.co/9YHHC3f

Obviously, "11" was the original Blaze Wall (which is now Inferno Barrier), and 3B is the original Blaze Wall.  But I don't understand anything else.  How do I change the target?  And what are my options and their values?  How many bytes is an enemy spell?  If I can figure some of those things, I may be able to test few things on my own.

Queue

  • Full Member
  • ***
  • Posts: 239
    • View Profile
Re: Secret of Mana, Turbo - Beta 191006
« Reply #616 on: October 06, 2019, 08:14:58 pm »
Version 2019-10-06:
https://ufile.io/s9kgc6fk

Changes:
- Fixed unintentional button presses when leaving menus caused by Quality_of_Life\Run_After_Area_Change; hopefully no other side effects
- Added Miscellaneous\Wiggly_Balloons; makes balloons over balloon'd enemies wiggle the way balloons over balloon'd players wiggle



hmsong, in the case of Dark Funks, see the 0xC1 just before the "CastSpell" AI command (which is 3 bytes)? In the AI scripting, 0xC1 means "set spell_target to melee_target" and the melee_target was set earlier in the AI.

Following it is 0xC0, which means "clear spell_target".

The "CastSpell" AI command is 3 bytes. Using the Dark Funk as an example (0xE9 0x04 0x11):
- 0xE9 is the byte that means: "cast a spell, the next two bytes are arguments"
- 0x04, the second byte, is which animation to play
- 0x11 is which spell number to cast
- normal enemies have a "spell_target" while bosses use a different AI script format that specifies the target as part of their spell casting command

Anyway, 0xC4 should be "set spell_target to self", so with the Dark Funk as the example, if you changed the 0xC1 to 0xC4 (at $D05C9D, i.e. 0x105C9D as seen in the hex editor), the Dark Funk would cast that spell on itself.

The complication is if you want an enemy who normally casts a spell on themself to instead cast on a target, since you have to make sure their AI actually picks a target before using 0xC1. Most AI scripts use:
0xFF 0x6A 0xE1
where 0xFF means call AI function and 0x6A 0xE1 = 0x6AE1 + $D04F15 = $D0B9F6; no, I'm not sure why they used such a weird system to address AI script functions. Anyway, $D0B9F6 = Target_Nearest_Enemy.

As for finding and making these changes, all normal enemy AI is in bank 0x10, and most AI sets the spell_target just before the associated CastSpell, but not every enemy who casts a given spell is going to use the same animation number, so you'll be searching for the byte pattern C1 E9 ?? ## where C1 is to set the spell target, E9 is cast a spell, ?? is some animation number, and ## is the spell number.



Edit: new version uploaded, added info to beginning of this post.
« Last Edit: October 06, 2019, 09:12:48 pm by Queue »

hmsong

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Re: Secret of Mana, Turbo - Beta 191006
« Reply #617 on: October 06, 2019, 10:19:42 pm »
Huuuu boy.  This is a bit more complicated than I'd like.  Am I trying to bite off more than I can chew?  I hope I'm not.

Thanks for the much-needed guidance.  I shall search for those patterns and edit them to see what kind of effect they have.  The test may take a while.  I hope it works...

Btw, for the 20191006 (the new update), did you upload the new Emperor Gate patch?  Or is it the old one?

kethinov

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Re: Secret of Mana, Turbo - Beta 191006
« Reply #618 on: October 07, 2019, 12:32:12 am »
I've posted a new hack: "Sheex is a Master Ninja"

This hack changes the Dark Stalker boss fight in Tasnica to a Master Ninja, significantly increasing the difficulty of what was otherwise a fairly easy boss fight. The dialog of two NPCs has also been updated to refer to this enemy as a Master Ninja instead of a Dark Stalker, including when Sheex is unmasked as the identity of this mysterious disguised enemy. Known issue: The altered dialog is not available when this is combined with VWF or Relocalized. Download: http://www.romhacking.net/hacks/4709/

I also updated:

Herbal Boost to incorporate Queue's fixes. I also altered Revivifier to a yellow palette to reflect it being a Luna spell now. Download: https://www.romhacking.net/hacks/4557/

Multiplicative Change Form to change the spell description to make it more accurately reflect the new behavior. (This change chould be applied to hmsong's version too. The new language is suitable for both monster sets.) Download: https://www.romhacking.net/hacks/4679/

On that note Queue I think you might want to update the spell description of Lunar Magic and possibly Inferno Barrier to better describe the new behavior.
« Last Edit: October 08, 2019, 11:49:17 am by kethinov »

hmsong

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Re: Secret of Mana, Turbo - Beta 191006
« Reply #619 on: October 07, 2019, 01:07:26 am »
@kethinov

Woo!  Update!

Indeed, Master Ninja may be quite tough at that stage in the game (esp with bad armors).  Far tougher than Dark Stalker.  Having said that, Master Ninja can drop Faerie Cloak, which is the final armor for Primm/Popoi.  I have mixed feelings about having access to such equipment (however rare that may be, esp since Faerie Cloak is a common drop).  Maybe fight 3 Dark Stalkers instead?  Yes, they can drop Ninja Gloves, but that's not much different than Gauntlets you can get from Dark Knights (not to mention Ninja Gloves is a rare drop), whereas Faerie Cloak is way better than anything you can possibly get before Pure Land.  And if people applied the new Emperor Gate patch, you have access to Dark Stalkers anyways.

Or you can make the dialogue auto-proceed immediately after Master Ninja's death? (so that king will awaken without having you to talk to him -- which will proceed to the scene where Gemma and the king's guards are in the room)  That way, the next scene will auto-play before Master Ninja can even drop any chest (even if it drops it, it'll disappear in the scene).  Obviously, making things auto-proceed with scene will be a challenge.

And thank you for the Change Form description.  I use Relocalized, so I don't know how things will work, but nevertheless, thank you so much.

I hope Queue applies all the important patches to his Turbo package.

Btw, I love the new Emperor Gate patch.
« Last Edit: October 07, 2019, 01:36:55 am by hmsong »