Aslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1910.msg20021e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index9823.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=profile;area=showposts;sa=topics;u=262e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index9823.html.zxh^ЋOKtext/htmlISO-8859-1gzip@Tue, 10 Mar 2020 22:44:58 GMT0 0Ph^; Monster summon casting (FF3us)

Author Topic: Monster summon casting (FF3us)  (Read 1499 times)

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Monster summon casting (FF3us)
« on: January 07, 2014, 06:09:17 PM »
I'm trying to have a monster being able to summon an esper. I have a monster with a simple script (37 FF FF) but on his first turn, the command is set as counterattack (1F) instead of summon (19), thus behaving as if his script had an FC command in it. This happens in C2/031C (accessed from C2/2188 which is accessed from C2/00A3) at this exact place:

Code: [Select]
C2/0333: E0 08        CPX #$08      (X = 8)
C2/0335: 90 0D        BCC $0344    (branch if character)
C2/0337: BD CC 32     LDA $32CC,X
C2/033A: 10 1B        BPL $0357     
C2/033C: A9 1F        LDA #$1F
C2/033E: 8D 7A 3A     STA $3A7A

The BPL instruction will branch if the carry flag is clean if I understand right, so does the game set always a monster attack as command 1F or would I have a problem elsewhere?

Also, I have little knowledge of the Action queue so I don't know if it's normal that the game doesn't branch at C2/0098 to go past the JMP $2188 at C2/00A3.

Right now, the monster perform a summon, we see the name of the attack but nothing after... :hmm:

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Monster summon casting (FF3us)
« Reply #1 on: January 08, 2014, 02:01:02 AM »
The BPL instruction will branch if the carry flag is clean if I understand right
BPL will Branch if PLus, or if the negative flag is clear.
BMI will Branch if MInus, or if the negative flag is set.

The branches you were thinking of are BCC and BCS: Branch if carry clear and Branch if carry set.

All attack espers have a bit "abort on allies," which will cancel the summon if it's set. I have to imagine the game doesn't check to see who's allies they're targeting, so make sure they're unchecked. Note that I don't know if this will work or not, just something simple that may have been overlooked.

119 bugs fixed and counting.

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Re: Monster summon casting (FF3us)
« Reply #2 on: January 08, 2014, 01:29:19 PM »
All attack espers have a bit "abort on allies," which will cancel the summon if it's set. I have to imagine the game doesn't check to see who's allies they're targeting, so make sure they're unchecked. Note that I don't know if this will work or not, just something simple that may have been overlooked.

You're right. Unsetting that bit makes the monster summon the esper. Thanks a lot!

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Monster summon casting (FF3us)
« Reply #3 on: January 18, 2014, 11:50:52 AM »
I have a somewhat related-to-the-thread question: How come characters acting as monsters cannot cast a summon spell due to the "Need MP!" message at the top? My CAAM (character acting as monster) has easily enough MP to cast the summon, and even when I set the Esper spell cost to 0, it still says the "Need MP!", and doesn't work. I thought it would behave normal like a PC using a summon, but apparently it's not programmed to work right due to them using a monster script...? Any ideas on how to get this working though? My hack is in dire need of CAAM being able to use summon spells!
« Last Edit: January 18, 2014, 01:05:10 PM by TheNattak »

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Monster summon casting (FF3us)
« Reply #4 on: January 19, 2014, 03:09:52 AM »
If the "Need MP!" message is appearing, then by some calculation or another, it is determining that the character doesn't have the MP necessary to cast. Although, if it costs 0, it's odd how that would fail. Have you tried tracing the CAAM and seeing what HP/MP is? It's possible that their MP isn't being loaded into whatever buffer the CAAMs use. It's also possible that the MP isn't being looked at.

To cover all bases, what commands do these characters have? If Magic or Lore aren't present, MP will not be loaded into the character's buffer.

119 bugs fixed and counting.

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Monster summon casting (FF3us)
« Reply #5 on: February 06, 2014, 11:43:19 AM »
Have you tried tracing the CAAM and seeing what HP/MP is? It's possible that their MP isn't being loaded into whatever buffer the CAAMs use. It's also possible that the MP isn't being looked at.

Thank you for the response. That does sound like what's happening here, is the character's MP is not being loaded or looked at, that'd also explain why these CAAM never run out of MP. I'm not sure how to go about tracing the CAAM though, but I'm very interested in doing that; would you be so kind as to point me in the right direction with that good sir? I've just recently started to get friendly with the debugger, and I've noticed the 'Trace From' tab that I can't figure out how to use yet - is that what I would use to trace the CAAM buffer? I have tried to set breakpoints around where the CAAM data is and tried to figure it out here, but I'm off track as usual I'm sure, and these days I have little time to waste on madness!  :laugh:
« Last Edit: February 06, 2014, 11:57:22 AM by TheNattak »

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Monster summon casting (FF3us)
« Reply #6 on: February 22, 2014, 11:40:43 PM »
I'm not sure what ram the CAAMs use, so the best I could say is to do a read on the current HP when battle loads, then read the battle buffer. I don't know if it goes somewhere else, but there's only one way to find out!

119 bugs fixed and counting.