Author Topic: FF7 - Battle Variables AI Help  (Read 3854 times)

Sega Chief

  • *
  • Posts: 4086
  • These guys is sick
    • View Profile
FF7 - Battle Variables AI Help
« on: 2015-11-08 01:52:22 »
Hey all,

We discussed this before a way back, but I've been having trouble getting a value to write to a variable within battle for use on a field screen. I took Barret's old Battle Date variable from the default Kernel AI script and put it into an enemy's death counter script to try it out. Would appreciate if someone who knows the AI stuff better than I do could look at this real quick:

Code: [Select]
11 0000
60 50
90
60 00
01 0000
95
11 2018
01 2010
90
11 2010
01 2010
60 01
30
90

0x000LocalVar:0000 <- 80
0x006TempGlobal <- &GlobalVar(0000)
0x00CUnknown(2018) <- GlobalAddress
0x013GlobalAddress <- GlobalAddress + 1
0x01DSCRIPT END

Have I made a mistake here? It (supposedly) works in the kernel AI for cloud's Physical Counter group but maybe it needs to be handled differently in an enemy's death script?

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: FF7 - Battle Variables AI Help
« Reply #1 on: 2015-11-08 12:30:57 »
The 95 takes a 1X code as the first argument. You were giving it a 01. You need to do a
Code: [Select]
60  00
11  XXXX
95
to read and a
Code: [Select]
60  01
11  XXXX
95
to write back to it. The address specified is the relative position in the 1/2 memory bank. The scope of the data retrieved/stored can also be altered with 10, 11, 12, and 13 I think. Ultimate Weapon's AI doesn't use 13 to write, but it does to read. Of course, you'll still have to read/write from 2010 to get the data after the 95 has been executed.

Also, you're doing a mega-bad by reading from &GlobalVar(0000). That's the game's main progress variable. You're advancing the story instead of manipulating the correct value.
afterward. If you want to affect Barret's battle love points you'll want

Code: [Select]
60  XX
11  0053
95

to manipulate that.

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: FF7 - Battle Variables AI Help
« Reply #2 on: 2015-11-08 12:39:38 »

Also, you're doing a mega-bad by reading from &GlobalVar(0000). That's the game's main progress variable. You're advancing the story instead of manipulating the correct value.


:P  Fun times!

Sega Chief

  • *
  • Posts: 4086
  • These guys is sick
    • View Profile
Re: FF7 - Battle Variables AI Help
« Reply #3 on: 2015-11-08 17:23:05 »
Having story progress increase for every random battle would have been fun times indeed :l

Cheers, NFITC1; I'll try not to make any more mega-bads (but no promises)

Edit: Got it working
« Last Edit: 2015-11-08 20:57:09 by Sega Chief »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: FF7 - Battle Variables AI Help
« Reply #4 on: 2015-11-09 12:29:25 »
Not sure if you are using Ochu... or if I have said this before, but...

You can use Ochu to monitor variable changes.  Might help with debugging.

Sega Chief

  • *
  • Posts: 4086
  • These guys is sick
    • View Profile
Re: FF7 - Battle Variables AI Help
« Reply #5 on: 2015-11-09 12:54:13 »
I've been using Ochu for the FPS (great tool btw) and skipping through bosses, but I forgot it can monitor variables; cheers for reminding me  :-D