AI Proofreading

  • Thread starter Thread starter Sega Chief
  • Start date Start date
Status
Not open for further replies.
S

Sega Chief

Guest
Hey all, I'm approaching the end of getting NT's last major build overhaul finished but I've a very important AI to roll out to most of the enemies in the game that's going to be handling a lot of NT's stat adjustments, Arrange Mode tweaks, and the SP system. I'd like to get a few sets of eyes to have a look at this script and tell me if they spot any errors or have ideas on how to make it more efficient:

Script
Code: [Select]
Code:
12 026060 00879012 028060 01879012 02A060 02879013 022002 026002 41008060 02329012 026012 41008003 02209013 022002 026002 41108060 02329012 026012 41008003 02209013 022002 028002 41008060 02329012 028012 41008003 02209013 022002 028002 41108060 02329012 028012 41008003 02209013 022002 02A002 41008060 02329012 02A012 41008003 02209013 022002 02A002 41108060 02329012 02A012 41008003 02209002 026001 40488060 094502 028001 40488060 09455002 02A001 40488060 09455070 00E711 02C060 019093 Level Check Debug02 026001 40488060 2C4470 00FE12 026011 40488060 2C9002 028001 40488060 2C4470 011512 028011 40488060 2C9002 02A001 40488060 2C4470 012C12 02A011 40488060 2C9001 201060 014070 016112 206011 40488002 206001 40488060 05309011 022060 019093 Arrange Mode Debug
Disassembly
Code: [Select]
Code:
0x000LocalVar:0260 <- FlagBit(0)0x007LocalVar:0280 <- FlagBit(1)0x00ELocalVar:02A0 <- FlagBit(2)0x015LocalVar:0220 <- LocalVar:0260.PhysDefense * 20x023LocalVar:0260.PhysDefense <- LocalVar:02200x02ELocalVar:0220 <- LocalVar:0260.MagDefense * 20x03CLocalVar:0260.PhysDefense <- LocalVar:02200x047LocalVar:0220 <- LocalVar:0280.PhysDefense * 20x055LocalVar:0280.PhysDefense <- LocalVar:02200x060LocalVar:0220 <- LocalVar:0280.MagDefense * 20x06ELocalVar:0280.PhysDefense <- LocalVar:02200x079LocalVar:0220 <- LocalVar:02A0.PhysDefense * 20x087LocalVar:02A0.PhysDefense <- LocalVar:02200x092LocalVar:0220 <- LocalVar:02A0.MagDefense * 20x0A0LocalVar:02A0.PhysDefense <- LocalVar:02200x0AB If ( ( ( (LocalVar:0260.Level < 9)  And  (LocalVar:0280.Level < 9) )  And  (LocalVar:02A0.Level < 9) ) )0x0AB {0x0CE LocalVar:02C0 <- 10x0D4 Display String: "Level Check Debug"0x0E7 If ( (LocalVar:0260.Level > 44) )0x0E7 {0x0F4 LocalVar:0260.Level <- 440x0FE If ( (LocalVar:0280.Level > 44) )0x0FE {0x10B LocalVar:0280.Level <- 440x115 If ( (LocalVar:02A0.Level > 44) )0x115 {0x122 LocalVar:02A0.Level <- 440x12C If ( (GlobalAddress == 1) )0x12C {0x135 Self.Level <- Self.Level + 50x147 LocalVar:0220 <- 10x14D Display String: "Arrange Mode Debug"0x161SCRIPT END
In the older build, defensive values for characters get doubled through the character AI in the kernel and the level synch is made there as well. This created a problem of limited space for innate ability AI, but it's now also made it tougher to dole out SP based on the character's level compared to the enemy level as Pre-Battle seems to be processed based on the actor bit (so chara AI, and therefore level, is always set first which buggers any Level check I want to make later on).

So my plan is to move all of this into the enemy AI where there's a lot more room (hopefully, I don't know if the scene.bin has an upper ceiling on how big it can be before problems arise). But as this means copying the AI into every single enemy, I wanted to get some second opinions on how this AI looks, if there's any problems with it I've missed, or suggestions on a more efficient way to arrange it all. It'll take a while to implement it into each enemy's pre-battle as I've got to get rid of the old one and navigate around any other scripts they have so just want to make sure I've got it right.

One thing I'd really like is a way to improve the level comparison at 0x0AB so that the game reads the enemy level and correctly compares it to the character level. I've tried it a few different ways, like loading the monster's bit, but I can't seem to get it to work; changing the compared number to match the monster's level every time will be a huge time sink so I'd appreciate it if anyone knows of a way to do this. It might be that I'm using the wrong set of codes, I was never 100% sure when to use 03, 02, or 01 for these things.
 
0x015LocalVar:0220 <- LocalVar:0260.PhysDefense * 2
0x023LocalVar:0260.PhysDefense <- LocalVar:0220
0x02ELocalVar:0220 <- LocalVar:0260.MagDefense * 2
0x03CLocalVar:0260.PhysDefense <- LocalVar:0220
0x047LocalVar:0220 <- LocalVar:0280.PhysDefense * 2
0x055LocalVar:0280.PhysDefense <- LocalVar:0220
0x060LocalVar:0220 <- LocalVar:0280.MagDefense * 2
0x06ELocalVar:0280.PhysDefense <- LocalVar:0220
0x079LocalVar:0220 <- LocalVar:02A0.PhysDefense * 2
0x087LocalVar:02A0.PhysDefense <- LocalVar:0220
0x092LocalVar:0220 <- LocalVar:02A0.MagDefense * 2
0x0A0LocalVar:02A0.PhysDefense <- LocalVar:0220
I think these are mismatched.

0x12C   If ( (GlobalAddress == 1) )
0x12C   {
0x135   Self.Level <- Self.Level + 5
0x147   LocalVar:0220 <- 1
You never set the GlobalAddress so there's no telling what this value would be. What are you trying to accomplish with this statement?

So my plan is to move all of this into the enemy AI where there's a lot more room (hopefully, I don't know if the scene.bin has an upper ceiling on how big it can be before problems arise).
There's a limit of 4K for all enemies in the scene. That's pretty big, actually.

But as this means copying the AI into every single enemy
There are tricks to avoid that, actually. However they're not possible in PrC. PM me for details.

One thing I'd really like is a way to improve the level comparison at 0x0AB so that the game reads the enemy level and correctly compares it to the character level. I've tried it a few different ways, like loading the monster's bit, but I can't seem to get it to work; changing the compared number to match the monster's level every time will be a huge time sink so I'd appreciate it if anyone knows of a way to do this.
Code: [Select]
Code:
if ( Self.Level != LocalVar.2F0 ){   Self.Level <- LocalVar.2F0}
I'm not really sure what the problem is. That's not an inefficient code. I'd need more details about how you want to manipulate it.

It might be that I'm using the wrong set of codes, I was never 100% sure when to use 03, 02, or 01 for these things.
The X3 is not needed. It won't hurt anything, but you almost never need it.
 
Defence: Good thing you spotted that defence mistake, that would have been pretty bad if it went out.

Global: Another mistake, I forgot to add the bit at the beginning. The original looks like this:

Code: [Select]
Code:
13 024001 20109060 0061 026C9501 201060 014070 006012 206011 40488002 206001 40488060 0F309013 022002 206002 42E08060 03329012 206012 42E08003 02209013 022002 206002 42E08060 02339012 206012 42E08003 02209011 022060 0190
Must have just forgot to write it in when I was putting the new script together. Another good save  :-D

Level: I was meaning this bit here:

0x0AB   If ( ( ( (LocalVar:0260.Level < 9)  And  (LocalVar:0280.Level < 9) )  And  (LocalVar:02A0.Level < 9) ) )

The problem I'm hoping to avoid is that when I go to paste this script into every enemy, I'll need to manually adjust the enemy level listed in the 'If' condition every single time to account for each monster's different level. I tried to push the monster's level into a variable so that I wouldn't need to do this, but the methods I've tried don't seem to work. Is it possible to make something like this work instead:

0x0AB   If ( ( ( (LocalVar:0260.Level < Self.level)  And  (LocalVar:0280.Level < Self.Level) )  And  (LocalVar:02A0.Level < Self.Level) ) )

Something along those lines? I think I tried it this way but didn't have much luck. I'll shoot a PM over about that script copying thing.
 
Status
Not open for further replies.
Back
Top