Users browsing this thread: 1 Guest(s)
Battlescript variables...

#31
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Hi! Everything, it's quite a nice coincidence you came back to answer, despite your last log in vas in april Smile anyway...

Oh, for some reason i forgot that forcefield was used outside the range of var 4-23
var 25 should be related to latest target, anyway...

Quote:Let me know if you're interested in making that happen, I'd be glad to help.
Interested? By all means!!! Kungfu! if you can help with that, i'll be very glad to accept your help, no doubt you'll get credit for that in my hack... besides it's a quite good patch in general, which modders might want to download, if they know how to properly use battle vars, of course.

Talking about not reset battle var code:
Code:
C2/49D3: E2 20        SEP #$20    (Set 8-bit A)
C2/49D5: A2 13        LDX #$13
C2/49D7: BD B4 3E     LDA $3EB4,X  (copy in-battle event bytes)
C2/49DA: 9D C9 1D     STA $1DC9,X  ( back into normal out-of-battle event bytes)
C2/49DD: CA           DEX
C2/49DE: 10 F7        BPL $49D7    (loop 14 times)

Normally it would be easy to just increase LDX #$13 in order to cover an higher range, unfortunately battle var 24, 25 and 26 store important temp values ;[ that would take some nasty change to the code... anyway i believe it's necessary to extend the range until var 35... until 34 or 33 should be good too, i need to have at least one var to store escape check and eventually some other feature i might implement in the near future.

The solutions are two, i believe:

1) placing some extra code between those 2 lines...
C2/49D5: A2 13 LDX #$13
C2/49D7: BD B4 3E LDA $3EB4,X (copy in-battle event bytes)
3 CMP (18, 19 and 1A the 3 cmp values) to detect if you're checking var 24-26, if then if the check is true... a branch on equal, i guess, you skip the code that save the value outside battle and go directly to DEX code line, in that way you can extend LDX value, without any consequence... what do you think about that, could it work?

2) move var 24-26 values to var 33-35, but that would mean change the code related to forcefield, targeting and monster types count too, which i believe it really requires too much work, attention and time, to not skrew things up Finger
__________________

Actually there's another obstacle: battle vars are stored from 1DC9 to 1DDC, but as RAM map Madsiur's document says:
$1DDD-$1E1C: Monster formations beaten (to fight on veldt) (64 bytes)
$1E1D-1E3F: (35 bytes which appear to be unused, at least in my save files)

yeah, saving extra vars would mean invade monster formations beaten area...
Now, coincidences want i wanna banish Veldt from my hack Hmm (Rages will be got in the same way of Beyond Chaos hack, in the case) so if i erase all the script that change their value after you win a battle and then erase the script that makes start a battle with veldt packs, instead of conventional world map packs, then 64 bytes would be free to use as i wish and well... there are also 35 bytes which are appearently unused, now a confirmation from Madsiur about them being safe to use would be great, in that case i'd kill 100 birds with one stone! Laugh
Of course, to break var 36 bound, i should also change the code that set the value to 36, if you target a variable number greater than var 36, do you know which one battlescript AI commands have this bound, in the case? (among set, increase, if var X = value then... etc. commands)


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#32
Posts: 179
Threads: 3
Thanks Received: 24
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
Total coincidence! Weird....

Hmm, I was initially thinking about moving the veldt data back to $1E00-$1E40, and then increasing the #$13 in the line of code you pointed out. But you make a good point about forcefield and the other variables. They could be moved somewhere else, but it would be tedious. The game relies on them getting cleared at the start of battle too, so it would probably mess things up if you let them get saved. I guess this wouldn't be as easy as I thought.

As another option, I realized that there are 12 other battle variables that don't seem to be utilized by the game at all. From my notes, vars 9 to 16 are the only ones that get used. Vars 4 to 8 and vars 17 to 23 are unused. How many saved variables do you plan on using? Also, how can I get my hands on Madsiur's RAM map?

To change the 36 byte limit, I think you would only need to change the code for AI command $F8. The code is really efficient. It looks like the other AI commands that affect variables jump to this code too. There's a problem though. During a battle, the variables are getting saved in RAM at $3EB0-$3ED3. And if you expanded that, you would be overwriting other stuff.

Code:
C2/1E1A: A6 B9        LDX $B9
C2/1E1C: 20 57 1E     JSR $1E57
C2/1E1F: A6 B8        LDX $B8
C2/1E21: 20 45 1E     JSR $1E45
C2/1E24: C6 B6        DEC $B6
C2/1E26: 10 04        BPL $1E2C
C2/1E28: 45 EE        EOR $EE
C2/1E2A: 80 0C        BRA $1E38
C2/1E2C: C6 B6        DEC $B6
C2/1E2E: 10 04        BPL $1E34
C2/1E30: 05 EE        ORA $EE
C2/1E32: 80 04        BRA $1E38
C2/1E34: 49 FF        EOR #$FF
C2/1E36: 25 EE        AND $EE
C2/1E38: E0 24        CPX #$24 <- change this
C2/1E3A: B0 05        BCS $1E41
C2/1E3C: 9D B0 3E     STA $3EB0,X
C2/1E3F: 80 03        BRA $1E44
C2/1E41: 99 AC 3D     STA $3DAC,Y
C2/1E44: 60           RTS

C2/1E45: 48           PHA
C2/1E46: E0 24        CPX #$24 <- and this
C2/1E48: B0 05        BCS $1E4F
C2/1E4A: BD B0 3E     LDA $3EB0,X
C2/1E4D: 80 03        BRA $1E52
C2/1E4F: B9 AC 3D     LDA $3DAC,Y
C2/1E52: 85 EE        STA $EE
C2/1E54: 68           PLA
C2/1E55: 18           CLC
C2/1E56: 60           RTS
  Find
Quote  

#33
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
The fact you thought of moving Veldt data into $1E00-$1E40 too makes me think you're confident on the fact that this area is safe, is that so?

Anyway i don't even need of Veldt variables, actually i need of them as 64 extra battle vars, i was aware of the fact that those 12 battle vars are unused, in fact their use was already planned, but i'm not sure 12 vars might be enough: according to my results on var expansion the thing would expand to an higher level...
When you deal with Veldt variables, i believe you have to deal also with a piece of code triggered when you win a battle, which probably sets the bit that match with that formation, if it's the first time you win that formation.

Here's the RAM map:
http://www.mediafire.com/download/0dtyu5...AM_Map.txt

They all jump in the same check? lucky me! Kungfu!
Yet i forgot about the fact they save var at $3EB0-$3ED3... unless there's a decent space left for storing extra variables we might take another solution: if i free all those bytes and gather 99 vars(64 + 35), then i might use the first half as new variables and the second half for saving them, then it would be good if i manage to edit the map event which checks/set battle variable values so that it might check those vars too.
I remember that Madsiur said there some good space in RAM to use, it should be the space used to store Swdtech names, i can't remember if he said they were 48 bytes of what...


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#34
Posts: 179
Threads: 3
Thanks Received: 24
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
(07-21-2015, 04:10 AM)Tenkarider Wrote: The fact you thought of moving Veldt data into $1E00-$1E40 too makes me think you're confident on the fact that this area is safe, is that so?

Yeah, I'm pretty sure that block is unused.

SwdTech names are at $1CF8-$1D27. If you want to use that block, you might want to change this code. This is where the game initializes the names when you start a new game.

Code:
C0/BDE2: A6 00        LDX $00         ; load swdtech names
C0/BDE4: BF 40 3C CF  LDA $CF3C40,X
C0/BDE8: 9D F8 1C     STA $1CF8,X
C0/BDEB: E8           INX
C0/BDEC: E0 30 00     CPX #$0030
C0/BDEF: D0 F3        BNE $BDE4

Sounds like you already have this info, but the veldt data is accessed in two places. One to check which battles are available and one to set bits for battles that have been encountered.

Code:
C0/C2DF: EE A5 1F     INC $1FA5
C0/C2E2: AD A5 1F     LDA $1FA5
C0/C2E5: 29 3F        AND #$3F
C0/C2E7: AA           TAX
C0/C2E8: BD DD 1D     LDA $1DDD,X
C0/C2EB: D0 07        BNE $C2F4

Code:
C2/49F7: 20 17 52     JSR $5217       ; get bit mask and byte number
C2/49FA: 1D DD 1D     ORA $1DDD,X     ; add to available veldt battles
C2/49FD: 9D DD 1D     STA $1DDD,X
  Find
Quote  

#35
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
There might be another thing related to Veldt: Gau's appearence script when you beat a Veldt formation... is that code called only if it's a Veldt formation? I mean, if you removed those formations, but you're still walking in veldt area of map or battle BG is the one of Veldt, is it possible that Gau's spawn code might trigger?
In any case, do you know where's that code and where's the check that tests if Gau have to appear or not(and so trigger the code which makes him spawn)?
If i delete Veldt, theorically there's no way that this code might be triggered somehow, but maybe i might use that space in a different way, you know...


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#36
Posts: 179
Threads: 3
Thanks Received: 24
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
Bit 0 of $11E4 is what allows Gau to spawn. There are a couple of places that clear this bit (like if you're in a back attack or if you have 4 people in your party), but it only gets set when you're on the veldt. The game determines if you're on the veldt based on your position on the world map. Here's the code that does it:

Code:
C0/C1CF: BF 00 54 CF  LDA $CF5400,X
C0/C1D3: 85 24        STA $24
C0/C1D5: C9 FF        CMP #$FF
C0/C1D7: D0 06        BNE $C1DF       ; branch if not a veldt sector
C0/C1D9: A9 0F        LDA #$0F
C0/C1DB: 8F E4 11 00  STA $0011E4

The values at $CF5400 normally determine which set of battles to choose from on the world map. But if the value is set to $FF that means you're on the veldt, so instead it chooses from all of the available veldt battles. FF3usME makes it easy to change these values. Go to "Form", and then the "Zoning" tab. Any section of the map where the value is set to 255 (i.e. $FF) will be the veldt. If you want to get rid of the veldt completely, I would recommend changing these values so that none of them are 255.

Here is the code that triggers Gau:

Code:
C2/4840: AE 0B 30     LDX $300B
C2/4843: 30 1C        BMI $4861       ; skip if gau is not in the party
C2/4845: A9 01        LDA #$01
C2/4847: 1C E4 11     TRB $11E4
C2/484A: F0 15        BEQ $4861       ; skip if gau can't appear after battle
C2/484C: 20 5A 4B     JSR $4B5A       ; random number (0..255)
C2/484F: C9 A0        CMP #$A0
C2/4851: B0 0E        BCS $4861       ; 5/8 chance to skip
C2/4853: AD BD 3E     LDA $3EBD
C2/4856: 89 02        BIT #$02
C2/4858: D0 74        BNE $48CE       ; branch if gau has been obtained
C2/485A: AD 76 3A     LDA $3A76
C2/485D: C9 02        CMP #$02
C2/485F: B0 6D        BCS $48CE       ; branch if more than 2 characters are left

; gau shows up
C2/48CE: BD 18 30     LDA $3018,X     ; gau's character mask
C2/48D1: 0C 4E 2F     TSB $2F4E       ; gau can be targetted
C2/48D4: 0C 40 3A     TSB $3A40       ; gau acts like an enemy
C2/48D7: A9 04        LDA #$04
C2/48D9: 0C 46 3A     TSB $3A46       ; disable counterattacks ???
C2/48DC: A2 1B        LDX #$1B        ; battle event $1B (gau appears on veldt)
C2/48DE: 80 E4        BRA $48C4
  Find
Quote  
[-] The following 1 user says Thank You to Everything for this post:
  • Tenkarider (08-03-2015)

#37
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Since i wanna erase Veldt i guess i won't even have to worry about that bit of $11E4... but so you say that it's pack 255 the actual responsible for Veldt existance?? what if i remove it from world maps? no veldt battles, even if i'm in the Veldt, with the song changed and everything?

Then pack 255 is not to use at all? what if i use it outside world map? (zoning sub maps) Veldt formation in dungeon maps might trigger Veldt battles?
How to make it become a normal pack, in the case?


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#38
Posts: 179
Threads: 3
Thanks Received: 24
Thanks Given: 4
Joined: Apr 2015
Reputation: 18
Status
None
Yep, pack 255 on the world maps is what triggers veldt battles. If you change all of those areas to some other pack you will never get a veldt battle. I'm not sure if that would get rid of the veldt music though. Let me know if you try it out.

Regular maps can't have veldt battles. The game only checks for pack 255 on the world map.
  Find
Quote  

#39
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Good.

Ok, let's move on the next step:
var 09 is almost unused, only bit 0 is used for MMMagic battle event... it's almost
useless and in the plot of my hack magic is not so much rare to justify that reaction, which means i wanna erase that event, the code that triggers that event(i already know how to eliminate the event itself) and all places in which that bit is in handled/set/etc... outside enemy AI command, since i know that the only monster with the check on that battle event is the battle against the two M-tek armors, but even random monsters in that period of the game will trigger the event, despite they don't have any check in their AI, so there's some extern code that do that instead of them. finally if you won't trigger it, after a certain point of the game the scene will never be triggered, which means they probably set that bit with a map event command.
I believe those are the part involved, dunno if there are even other parts, anyway any help in knowing the address in which all that code is stored would help a lot, and so we'll have an entire battle variable to use. Wink

EDIT: wait, there's a chance that it's actually bit 1, not 0... besides in M-tek armor script, also var 12 bit 1 is handled and if i'm not wrong that event bit has something to do with MMMagic battle event too, hence we need to do the same we'll do with the other bit(find and delete any possible extern code to enemy AI that handles/set/etc... that bit)


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#40
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
The bit that disables the "M-M-M-MAGIC!?" scene (1DCE:0) is never set so you are free to use it. It makes the whole byte available. The one that enables the event (1DD1:1) is set at CA/637F and it is also cleared at CA/7671. The rest of that byte is used for other stuff.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite