Unused/useless variables safe to use in savemap? (PSX)

  • Thread starter Thread starter Roden
  • Start date Start date
Status
Not open for further replies.
OK, now I need to contribute here. :)

I forgot to say about the bit thing. For Jenova BIRTH's AI, she puts Flagbit 0, 1, and 2 into three separate variables and these have her attack each separate party member during a 'wave' of laser or w-laser. Later, I saw something in another AI where it targeted other enemies using bit 3, 4, etc. My hunch is that from 3 onwards it's enemies, problem is there can be 6 enemies on the field which is one too many for a byte.
Flagbit is just the command for turn on bit X. OpCode 87 turns on bit pop0 of a 32 bit value. Since the last push was the value 4, that's the byte that's turned on:
Code: [Select]
Code:
00000000 00000000 00000000 00010000
This gets stored as a word value because the "LDA" command was issued via 12 which tells the STOR command to read it as a two-byte value.

Further, 0-2 are player characters (0 is top, 2 is bottom in the menu)
"actor" 3 doesn't really exist and shouldn't/can't be manipulated in this way.
4-9 are indeed enemies 0-5 as indicated in Proud Clod's formation menu. It's a little unsafe to refer to them this way, but so is referring to them by IDs in the case of multiple instances.
Other values can't be "MASK"ed by command 80 and are ignored.

Finally, 4020, 4023 and 4022 are, in no particular order (mostly because I'm still not sure which is which), "ATB running/can counter attack," "Targetable," and "Active". Only turning off Active will flag this as "defeated", but there are other reasons for turning off the others as well. Mostly camera related.
 
Cheers for the info, NFITC1. Is there a safer way to refer to enemies, though? Only other thing I can think of just now is Active Formation which Bizarro uses when getting the stats of it's different parts sorted out.
 
I was planning to pass value from bank1 var 81 (via field scripting) to refer to enemy ID (I tested it with regular variable and it works, so I assume that would work). Most bosses aren't multiple parts..and there could be special exceptions for them. Though I'm not sure 1 byte is enough to refer to all enemy IDs?
 
Past a certain point, it won't be big enough anymore. Once you reach Guardian in the Underwater Reactor, that's when it goes past 255 (in the actual formation, his left hand is FF/255 and his right hand is 0100/256).

I was thinking from the field you set the variable to 1 when you need it On and to 0 when you need it Off.
01 2010
60 32 (change to 60 01)
44 (change this to a 40)

Then it'll be If ( (GlobalAddress = 1) ) and you can toggle it on and off for those certain boss enemies you want to buff, if that's the goal.
 
Past a certain point, it won't be big enough anymore. Once you reach Guardian in the Underwater Reactor, that's when it goes past 255 (in the actual formation, his left hand is FF/255 and his right hand is 0100/256).

I was thinking from the field you set the variable to 1 when you need it On and to 0 when you need it Off.
01 2010
60 32 (change to 60 01)
44 (change this to a 40)

Then it'll be If ( (GlobalAddress = 1) ) and you can toggle it on and off for those certain boss enemies you want to buff, if that's the goal.
Hmm, seems quite simple, how about this instead?

var 80 and 81 - add them together in script to get enemy ID
-  add secondary if statements, if encounter Guardian, etc, then affect ALL enemy IDs in battle (maybe lose some flexbility though)
var 82 - A MAX HP value to set (same as HP)
var 83 - multipliers for stat combos/MP (allowed 255 combinations right? maybe you could even include a combo for random encounters which simply sets HP multipler for all enemy bitflags)
If all four vars are active, turn on the script for next encounter?

Lol, would this actually work?

Edit: Not asking you to give code example, I think I know enough now to experiment at least (thanks to you)  ;D
Edit 2: Just remembered only 1 byte for var 82.. maybe can merge HP multiplier into var 83 and have one var free for something else?
 
Last edited:
So long as you don't put a number above 255 into 80, 81, 82, or 83. And try not to let the code get too long, you might have kernel problems and end up with the wrong encounters loading up. And be careful with multiplying stats; that can quickly get out of hand. It's better to fine-tune stats manually, enemy by enemy, but I guess that's not an option if the scene.bin can't be edited.

To be honest, the simpler you can make it the easier you'll be making it on yourself.
 
Is there a safer way to refer to enemies, though?
Not really. All I mean is there's no error-checking involved so I'm not keen with that method. Pairing with enemy ID will make it better when you have combinations with different numbers of enemies.
Say you have a enemy party of two bandersnatches, a griffin, and a Jabberwockies (just say). Now Bandersnatches are bitter enemies with griffin, but friendly to jabberwockies. So you want them to heal jabberwockies and randomly hinder griffins. If you have different formations of these three enemies then you'd want the Bandersnatch AI to refer to them by ID because their formation positions aren't fixed.

However, if you have a fixed formation, like a boss fight, where you know exactly where all the pieces are in the formation then it's perfectly reasonable to refer to them by formation ID. One advantage to something like this is for Boss minions/bits/options (whatever you want to call them) that have identical enemy IDs, but need to be handled individually. The other is it makes the AI shorter by, maybe, one byte per reference. No Boss AI even comes close to filling its scene's allotted AI space. In fact, I think the only scene that DOES come close to filling it is the one that contains Eligor.

Also, refer to Ultima Weapon's AI for how to store multi-byte values.
 
Yeah I'll keep it short and sweet. I think it will be fun.. and will give me flexibility in the field having power over those stats. Actually, it looks like the only things I can't change is morph/steal/item drops (don't see them on opcode list, unless its unknown?).  I was expecting only to be able to change HP values at the most  :lol:  Oh, modding FF7 is awesome!

I looked at the Kernel sizes for the Japanese version its just under 20kb by default, while the US one is 22kb by default. Does the script section have a specific limit or is it a overall kernel limit you're talking about (I'm not planning on making many significant changes to it other than scripts)? I've seen people saying around 27kb is maximum? I pasted in 200 lines of opcodes/argument numbers in a text file and it came up at around 1.6kb. Not sure how much it would be in the kernel, but I hope that's alright..
 
Not really. All I mean is there's no error-checking involved so I'm not keen with that method. Pairing with enemy ID will make it better when you have combinations with different numbers of enemies.
Say you have a enemy party of two bandersnatches, a griffin, and a Jabberwockies (just say). Now Bandersnatches are bitter enemies with griffin, but friendly to jabberwockies. So you want them to heal jabberwockies and randomly hinder griffins. If you have different formations of these three enemies then you'd want the Bandersnatch AI to refer to them by ID because their formation positions aren't fixed.

However, if you have a fixed formation, like a boss fight, where you know exactly where all the pieces are in the formation then it's perfectly reasonable to refer to them by formation ID. One advantage to something like this is for Boss minions/bits/options (whatever you want to call them) that have identical enemy IDs, but need to be handled individually. The other is it makes the AI shorter by, maybe, one byte per reference. No Boss AI even comes close to filling its scene's allotted AI space. In fact, I think the only scene that DOES come close to filling it is the one that contains Eligor.

Also, refer to Ultima Weapon's AI for how to store multi-byte values.
Gotcha, I was worried there was a memory problem with using ID or FlagBit. I clean forgot about Ultimate Weapon and it's HP though, that'd definitely be the place to look for applying a big HP value.

Yeah I'll keep it short and sweet. I think it will be fun.. and will give me flexibility in the field having power over those stats. Actually, it looks like the only things I can't change is morph/steal/item drops (don't see them on opcode list, unless its unknown?).  I was expecting only to be able to change HP values at the most  :lol:  Oh, modding FF7 is awesome!

I looked at the Kernel sizes for the Japanese version its just under 20kb by default, while the US one is 22kb by default. Does the script section have a specific limit or is it a overall kernel limit you're talking about (I'm not planning on making many significant changes to it other than scripts)? I've seen people saying around 27kb is maximum? I pasted in 200 lines of opcodes/argument numbers in a text file and it came up at around 1.6kb. Not sure how much it would be in the kernel, but I hope that's alright..
I think the best thing to do is make regular back-ups and test often. Fight encounters in three different parts of the game to be safe and keep on the look out for the wrong encounters loading in. But like NFITC1 suggested, check out Ultimate Weapon's HP too:

Code: [Select]
Code:
60 0060 5B9513 000001 20109060 0060 5C9513 002001 20109060 0060 5D9513 004001 20109012 206013 41608003 000062 0100003203 002061 0100323003 0040309012 206010 402C8060 019011 00A060 038160 0334309013 008002 206003 416080900x000TempGlobal <- &GlobalVar(005B)0x005LocalVar:0000 <- GlobalAddress0x00CTempGlobal <- &GlobalVar(005C)0x011LocalVar:0020 <- GlobalAddress0x018TempGlobal <- &GlobalVar(005D)0x01DLocalVar:0040 <- GlobalAddress0x024Self.HP <- LocalVar:0000 * 65536 + LocalVar:0020 * 256 + LocalVar:00400x040Self.Flag:DeathImmune? <- 10x04ALocalVar:00A0 <- 3 + Random MOD 30x055LocalVar:0080 <- Self.HP0x060SCRIPT END
Seeing it there, it pushes three variables into three separate LocalVars and then combines them all into an equation to find current HP. The stuff starting from 0x040 is other stuff to handle his attacks, when he flies off, etc.
 
Yeah I did check that out along with Safer Sephiroth's AI. That part doesn't seem too complicated but makes me think of a good question.. whose pre-battle AI goes first? If I change Ultimate Weapon's HP in Cloud's pre-battle AI, would that affect Ultimate Weapon? I'm assuming my one would kick in first (as the first character/bitflag?), and then Ultimate Weapon's HP would go back to normal (unless I also change scene.bin).
 
Status
Not open for further replies.
Back
Top