Users browsing this thread: 1 Guest(s)
Adding a character to the Narshe battle

#1
Posts: 378
Threads: 94
Thanks Received: 17
Thanks Given: 26
Joined: Jul 2013
Reputation: 11
Status
Charmed
There seems to be a gigantic amount of things you need to change to have what seems like a relatively simple task. I'm going to try to list them all, but there will be stuff I'm gonna miss.

1) Create an NPC on the map and place it somewhere, preferably next to the other characters my making a slight map edit; give the character an event.

2) Using your hex editor go to the event you've assigned your character and give it a code using this base found at CC/C3EB:

Code:
CC/C3EB: B2    Call subroutine $CCC35B
CC/C3EF: B2    Call subroutine $CCC379
CC/C3F3: 42    Hide object $31
CC/C3F5: 45    Refresh objects
CC/C3F6: 3D    Create object $XX (the actor you've added)
CC/C3F8: 3F    Assign character $XX (Actor in stot XX) to party 1
CC/C3FB: 45    Refresh objects
CC/C3FC: 01    Begin action queue for character $XX (Actor in stot XX), 3 bytes long (Wait until complete)
CC/C3FE: D7        Center screen on vehicle/entity
CC/C3FF: CE        Turn vehicle/entity down
CC/C400: FF        End queue
CC/C401: 3C    Set up the party as follows: $XX (Actor in stot 1), $FF (<Invalid Character>), $FF (<Invalid Character>), $FF (<Invalid Character>)
CC/C406: 41    Show object $XX
CC/C408: 45    Refresh objects
CC/C409: 3F    Remove character $04 (Actor in stot 4) from the party
CC/C40C: 3F    Remove character $06 (Actor in stot 6) from the party
CC/C40F: 3F    Remove character $00 (Actor in stot 0) from the party
CC/C412: 3F    Remove character $05 (Actor in stot 5) from the party
CC/C415: 3F    Remove character $02 (Actor in stot 2) from the party
CC/C418: 3F    Remove character $0B (Actor in stot 11) from the party
XX/XXXX: 3F    Remove character $01 (Actor in stot 1) from the party <-Add this one. You have to add a remove character bit for all other characters that appear there.
CC/C41B: 45    Refresh objects
CC/C41C: 42    Hide object $YY (the NPC number)
CC/C41E: 45    Refresh objects
CC/C41F: B2    Call subroutine $CCC36A
CC/C423: 3A    Enable player to move while event commands execute
CC/C424: FE    Return

3) Notice it calls subroutines twice. You need to edit those too; you need to add a new line to the code that accounts for the new NPC:

Quote:78 YY Enable ability to pass through other objects for object $YY (NPC $YY)

and

Code:
36 YY   Disable ability to pass through other objects for object $YY (NPC $YY)

^You're most likely going to have to make more space for this to happen; you'll need to call a subroutine, which if you're reading this you may already know what that is; Madsiur has a great tutorial over there.

3) Remember you must add a new line at every other character's block of events to account for the new character, otherwise your new character may appear twice. This is the line you'll need to add:

Code:
3F    Remove character $XX (Actor in stot XX) from the party <-Add this one. You have to have a remove character for all other characters that appear there.

If you have moved the code, you'll need to account for that when it calls subroutines; they must call the correct location.

4) We're not done however. If you talk with your new character someone else, you'll notice you'll make the new character disappear. The answer is at CC/C379

Code:
CC/C379: DE    Load CaseWord with the characters in the currently active party?
CC/C37A: C0    If ($1E80($1A0) [$1EB4, bit 0] is clear), branch to $CCC38A
CC/C380: 3D    Create object $11
CC/C382: 11    Begin action queue for character $11 (NPC $11), 3 bytes long (Wait until complete)
CC/C384: D7        Center screen on vehicle/entity
CC/C385: 82        Move vehicle/entity down 1 tile
CC/C386: FF        End queue
CC/C387: 41    Show object $11
CC/C389: 45    Refresh objects
CC/C38A: C0    If ($1E80($1A1) [$1EB4, bit 1] is clear), branch to $CCC39A
CC/C390: 3D    Create object $12
CC/C392: 12    Begin action queue for character $12 (NPC $12), 3 bytes long (Wait until complete)
CC/C394: D7        Center screen on vehicle/entity
CC/C395: 82        Move vehicle/entity down 1 tile
CC/C396: FF        End queue
CC/C397: 41    Show object $12
CC/C399: 45    Refresh objects
CC/C39A: C0    If ($1E80($1A6) [$1EB4, bit 6] is clear), branch to $CCC3AA
CC/C3A0: 3D    Create object $13
CC/C3A2: 13    Begin action queue for character $13 (NPC $13), 3 bytes long (Wait until complete)
CC/C3A4: D7        Center screen on vehicle/entity
CC/C3A5: 82        Move vehicle/entity down 1 tile
CC/C3A6: FF        End queue
CC/C3A7: 41    Show object $13
CC/C3A9: 45    Refresh objects
CC/C3AA: C0    If ($1E80($1A4) [$1EB4, bit 4] is clear), branch to $CCC3BA
CC/C3B0: 3D    Create object $15
CC/C3B2: 15    Begin action queue for character $15 (NPC $15), 3 bytes long (Wait until complete)
CC/C3B4: D7        Center screen on vehicle/entity
CC/C3B5: 82        Move vehicle/entity down 1 tile
CC/C3B6: FF        End queue
CC/C3B7: 41    Show object $15
CC/C3B9: 45    Refresh objects
CC/C3BA: C0    If ($1E80($1A5) [$1EB4, bit 5] is clear), branch to $CCC3CA
CC/C3C0: 3D    Create object $16
CC/C3C2: 16    Begin action queue for character $16 (NPC $16), 3 bytes long (Wait until complete)
CC/C3C4: D7        Center screen on vehicle/entity
CC/C3C5: 82        Move vehicle/entity down 1 tile
CC/C3C6: FF        End queue
CC/C3C7: 41    Show object $16
CC/C3C9: 45    Refresh objects
CC/C3CA: C0    If ($1E80($1A2) [$1EB4, bit 2] is clear), branch to $CCC3DA
CC/C3D0: 3D    Create object $14
CC/C3D2: 14    Begin action queue for character $14 (NPC $14), 3 bytes long (Wait until complete)
CC/C3D4: D7        Center screen on vehicle/entity
CC/C3D5: 82        Move vehicle/entity down 1 tile
CC/C3D6: FF        End queue
CC/C3D7: 41    Show object $14
CC/C3D9: 45    Refresh objects
CC/C3DA: C0    If ($1E80($1AB) [$1EB5, bit 3] is clear), branch to $CCC3EA
CC/C3E0: 3D    Create object $17
CC/C3E2: 17    Begin action queue for character $17 (NPC $17), 3 bytes long (Wait until complete)
CC/C3E4: D7        Center screen on vehicle/entity
CC/C3E5: 82        Move vehicle/entity down 1 tile
CC/C3E6: FF        End queue
CC/C3E7: 41    Show object $17
CC/C3E9: 45    Refresh objects
CC/C3EA: FE    Return

You'll need to add a block of new commands to account for the new characters:

Code:
CC/C3DA: C0    If ($1E80($1AB) [$1EB5, bit 3] is clear), branch to $CCC3EA
CC/C3E0: 3D    Create object $YY
CC/C3E2: 17    Begin action queue for character $YY (NPC $YY), 3 bytes long (Wait until complete)
CC/C3E4: D7        Center screen on vehicle/entity
CC/C3E5: 82        Move vehicle/entity down 1 tile
CC/C3E6: FF        End queue
CC/C3E7: 41    Show object $YY
CC/C3E9: 45    Refresh objects
CC/C3EA: FE    Return

You'll need to make new changes: It has to branch to the new location of FE. Depending on which character you need to add, you'll also have to change the corresponding bit (at the first line):

Code:
1A0 B4:0 Multipurpose bit for Terra; CaseWord bit 0
1A1 B4:1 Multipurpose bit for Locke; CaseWord bit 1
1A2 B4:2 Multipurpose bit for Cyan; CaseWord bit 2
1A3 B4:3 Multipurpose bit for Shadow; CaseWord bit 3
1A4 B4:4 Multipurpose bit for Edgar
1A5 B4:5 Multipurpose bit for Sabin
1A6 B4:6 Multipurpose bit for Celes
1A7 B4:7 Multipurpose bit for Strago
1A8 B5:0 Multipurpose bit for Relm
1A9 B5:1 Multipurpose bit for Setzer
1AA B5:2 Multipurpose bit for Mog
1AB B5:3 Multipurpose bit for Gau
1AC B5:4 Multipurpose bit for Gogo
1AD B5:5 Multipurpose bit for Umaro
1AE B5:6 Multipurpose bit for guest 1
1AF B5:7 Multipurpose bit for guest 2

Now, be sure to go to the Level Editor and make sure each NPC has his corrent event associated; if we've moved the code to make space, this will surely need to be corrected.

See the save point? If you step on it, the character's places will return to their original position. I don't see the point of this and I don't think it is necesary at all. Since you'll need to also take account for the new character, the simplest thing to do would be removing the code and replacing it with a regular Save point. It won't make a diference and you'll have a few lines to write custom events, such as this one.

Now, to actually add Shadow as one of the fighters to put in the character selection screen:

Code:
CC/C642: 4B    Display dialogue message $036E, wait for button press
               You'll fight in 3 groups.
               Use the Y Button to switch between them.
               Defeat Kefka before his men reach Banon. Otherwise, you lose!
CC/C645: D4    Set event bit $1E80($2F1) [$1EDE, bit 1]
CC/C647: D4    Set event bit $1E80($2F2) [$1EDE, bit 2]
CC/C649: D4    Set event bit $1E80($2F4) [$1EDE, bit 4]
CC/C64B: D4    Set event bit $1E80($2F5) [$1EDE, bit 5]
CC/C64D: D4    Set event bit $1E80($2F6) [$1EDE, bit 6]
CC/C64F: D4    Set event bit $1E80($2FB) [$1EDF, bit 3]
CC/C651: D4    Set event bit $1E80($2F0) [$1EDE, bit 0]
CC/C653: D5    Clear event bit $1E80($2F3) [$1EDE, bit 3] < The character you wish to have on the selection screen you set the event bit (switch D5 to D4)
CC/C655: D5    Clear event bit $1E80($2F7) [$1EDE, bit 7]
CC/C657: D5    Clear event bit $1E80($2F8) [$1EDF, bit 0]
CC/C659: D5    Clear event bit $1E80($2F9) [$1EDF, bit 1]
CC/C65B: D5    Clear event bit $1E80($2FA) [$1EDF, bit 2]
CC/C65D: D5    Clear event bit $1E80($2FC) [$1EDF, bit 4]
CC/C65F: D5    Clear event bit $1E80($2FD) [$1EDF, bit 5]
CC/C661: B2    Call subroutine $CACBAF
CC/C665: 99    Invoke party selection screen (3 groups) (force characters: [$0000] ()
CC/C669: 46    Make party 1 the current party
CC/C66B: B2    Call subroutine $CACCA4
CC/C66F: DD    Clear event bit $1E80($61B) [$1F43, bit 3]
CC/C671: DC    Set event bit $1E80($628) [$1F45, bit 0]
CC/C673: 6B    Load map $0016 (Narshe, hills maze (WoB)) instantly, (upper bits $3000), place party at (20, 10), facing left
CC/C679: 3D    Create object $00
CC/C67B: 3D    Create object $01
CC/C67D: 3D    Create object $06
CC/C67F: 3D    Create object $04
CC/C681: 3D    Create object $05
CC/C683: 3D    Create object $02
CC/C685: 3D    Create object $0B < Make sure you create your character here
CC/C687: 45    Refresh objects

If you wish to give him/her a line while on the battle:

Code:
CC/C6C6: 7A    Change event address for object $00 to address $CCC8AB
CC/C6CB: 7A    Change event address for object $01 to address $CCC8B3
CC/C6D0: 7A    Change event address for object $04 to address $CCC8C3
CC/C6D5: 7A    Change event address for object $05 to address $CCC8CB
CC/C6DA: 7A    Change event address for object $02 to address $CCC8D3
CC/C6DF: 7A    Change event address for object $0B to address $CCC8DB
CC/C6E4: 7A    Change event address for object $06 to address $CCC8BB

Add your piece of code there and give it a subroutine where it plays this:

Code:
CC/C8AB: 00    Begin action queue for character $00 (Actor in stot 0), 2 bytes long (Wait until complete)
CC/C8AD: 20        Do vehicle/entity graphical action $20
CC/C8AE: FF        End queue
CC/C8AF: 48    Display dialogue message $036F, continue executing commands
               TERRA: Kefka…
               He stuck that crown on me?
CC/C8B2: FE    Return

Edit it as you please.
Also, when Banon yells "They're coming!", if you made your character the party leader, you might want to give him/her a custom "ready" pose:

Code:
CC/C6F8: 00    Begin action queue for character $00 (Actor in stot 0), 2 bytes long (Wait until complete)
CC/C6FA: 0A        Do vehicle/entity graphical action $0A
CC/C6FB: FF        End queue
CC/C6FC: 02    Begin action queue for character $02 (Actor in stot 2), 2 bytes long (Wait until complete)
CC/C6FE: 0A        Do vehicle/entity graphical action $0A
CC/C6FF: FF        End queue
CC/C700: 01    Begin action queue for character $01 (Actor in stot 1), 2 bytes long (Wait until complete)
CC/C702: 0A        Do vehicle/entity graphical action $0A
CC/C703: FF        End queue
CC/C704: 0B    Begin action queue for character $0B (Actor in stot 11), 2 bytes long (Wait until complete)
CC/C706: 4A        Do vehicle/entity graphical action $0A, flipped horizontally
CC/C707: FF        End queue
CC/C708: 05    Begin action queue for character $05 (Actor in stot 5), 2 bytes long (Wait until complete)
CC/C70A: 0A        Do vehicle/entity graphical action $0A
CC/C70B: FF        End queue
CC/C70C: 06    Begin action queue for character $06 (Actor in stot 6), 2 bytes long (Wait until complete)
CC/C70E: 0A        Do vehicle/entity graphical action $0A
CC/C70F: FF        End queue
CC/C710: 04    Begin action queue for character $04 (Actor in stot 4), 2 bytes long (Wait until complete)
CC/C712: 4A        Do vehicle/entity graphical action $0A, flipped horizontally
CC/C713: FF        End queue

Add a command line to refer to the new character.

Conglaturation !!! You have sucessfully added a new character into the Narshe battlefield event! ...probably.


Step forward, spriters! We are also responsible to make hacks look new and fresh, we are no less important than code or ASM hackers! CHARGE!!
Quote  

#2
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
Haven't went through all of it yet but seems like you have most of it covered, you need to include on the part about placing the npc, that whereever they get placed, you have to be able to only talk to them from the top.

If not, say you place them off to the side instead of in line with the rest, you'll have to add a check for what direction your facing before you can do the move down command. (If your talking to them from the left side, it won't "swap" them by moving your character down 1 square.) In other words for all practical reasons, you "must" have the new characters in line with the original to prevent even more required code.

The "load caseword" command, loads the name of the character your doing the talking with, I believe. That subroutine at CC/C39A will need to be extended to account for any new characters added.


The only true wisdom is knowing you know nothing.
  Find
Quote  

#3
Posts: 3,971
Threads: 279
Thanks Received: 237
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(12-28-2015, 05:18 AM)catone Wrote: The "load caseword" command, loads the name of the character your doing the talking with, I believe.

Close but not exact; case-word is a two byte value (a word) containing active party members or characters recruited so far, depending of the caseword loading command used. Each actor will have a specific bit set in the caseword.
  Find
Quote  

#4
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
It has been a day or two... was going for short answer. More so the effect than the how, least that excuse sounds decent to me.

That aside, the other part is correct. That subroutine will need to be extended to check for your new added character to properly do the swap. It checks who your currently in control of, creates their sprite, then moves it down one tile to replace the character your taking control of. Another reason its absolutely essential to be only able to talk to any of the characters from the top (1 space above) them. Have to block any side or front access.

If it is still giving you trouble this afternoon, I did get most of that done on my attempt before I went to something else. I can send you what I have but not sure it would be alot of help. I had set out to rewrite the whole thing, not add it in, which means I broke the original code apart into as many subroutines as I could so I could reuse them as often as possible. Those notes are also in form of a spreadsheet so you might end up spending longer navigating my notes than getting answers from them, but the offer is there if you want it. They are commented pretty completely and straight forward, just not all 100% required changes.


The only true wisdom is knowing you know nothing.
  Find
Quote  

#5
Posts: 378
Threads: 94
Thanks Received: 17
Thanks Given: 26
Joined: Jul 2013
Reputation: 11
Status
Charmed
Okay, I've got this advancing. The only thing I seem to not get done is having Shadow swap positions with the other characters. Everybody else works just fine, though. Looking at the code I see it calls if a bit (1, 2, 3, 4, 5, 6 in no particular order) is clear. I'm assuming I need to look for an unused bit in the game, or...?

Also another thing: The save point. If you touch it, it resets positions of the characters. I don't think this is necesary, and it saves a good piece of code you can use to avoid using subroutines. I've replaced it with a normal save point; it seems to work just fine.


Step forward, spriters! We are also responsible to make hacks look new and fresh, we are no less important than code or ASM hackers! CHARGE!!
Quote  

#6
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
Event Bits Document: "1A3 B4:3 Multipurpose, Shadow-Related bit; Caseword bit 3"

That whole section of "Multipurpose" are tye bits for checking against CaseWords including the two at the end for the two guest slots, (incase you wanted Banon to be in the rotation). As I said before, you'll need to add that check to the subroutine at CC/C39A so it will run every time a "swap" in run.

As for the reset when touching the save point, don't recall any valid reason for it. Might be something to prevent a cluster puck of some sort if you swapped the characters around exactly 666 times, but I doubt it. Should be able to cut that code without any noticable issues.

On a side note, subroutines are actually really important and valuable if used properly. Granted 90% of the time we use them here to "jump to free space" however they are intended for blocks of code that need to be repeated. Actually funny to look through the code at the different programmers. Some use subroutines every chance they get, others you'd think they never heard of it before. Can really tell the variety in skill levels of the original programmers.


The only true wisdom is knowing you know nothing.
  Find
Quote  
[-] The following 1 user says Thank You to Catone for this post:
  • Kugawattan (12-28-2015)

#7
Posts: 378
Threads: 94
Thanks Received: 17
Thanks Given: 26
Joined: Jul 2013
Reputation: 11
Status
Charmed
Thanks Catone! That worked just fine! I can now swap Shadow with no problem at all. Now, we need to add him to the character select screen! Any clue?


Step forward, spriters! We are also responsible to make hacks look new and fresh, we are no less important than code or ASM hackers! CHARGE!!
Quote  

#8
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
Starting at CC/C645 (it reaches this adress starting at telling Banon "Yes" on "Prepared" dialog, after the black screen and Mog asking if you need an explination on 3 party battles.)

This is where all bits are set to enable every character available for the party selection screen.

What you can do, is change the adress of the destinations at CC/C63A.
B6 00 00 00 :Adress of "Yes" code
00 00 00 :Adress of "No" code
If "Yes" branch to code:

D4 F3. : Set Bit $2F3 (Shadow is available for party)
C0 F3 82 : Is Bit $2F3 set? (Always yes, you just set it before this)
42 6C 02. :Branch to CC/C642 (Mog explains battlefield)

If "No" go to another block of code that:

D4 F3. :Set Bit $2F3
C0 F3 82 :Is $2F3 set?
45 C6 02. :Always branch to CC/C645 (normal code destination for "No" reply.)


The only true wisdom is knowing you know nothing.
  Find
Quote  

#9
Posts: 378
Threads: 94
Thanks Received: 17
Thanks Given: 26
Joined: Jul 2013
Reputation: 11
Status
Charmed
I managed to get Shadow to the party select screen by simply having a D4 where it said D5 there:

Code:
CC/C653: D5    Clear event bit $1E80($2F3) [$1EDE, bit 3]

I've updated the main post with more info on how to get professional with additional events but yeah.


I've recently noticed an issue. When the main battle starts, Kefka's soldiers stay down without moving. If you defeat one, another one immediately drops on its place. I don't remember having changed anything relating to the Soldier's code, so I'm assuming when I added the Shadow NPC I must've tampered with the ai somehow?


Step forward, spriters! We are also responsible to make hacks look new and fresh, we are no less important than code or ASM hackers! CHARGE!!
Quote  

#10
Posts: 676
Threads: 44
Thanks Received: 26
Thanks Given: 21
Joined: Jan 2015
Reputation: 11
Status
Zombie
LOL, yeah I forgot that's the first party select screen since Shadow left. They had that there to make sure he got removed completely. The method I posted would be needed if adding Banon or some other extra member, but yes not for Shadow.

As for the other issue, your still hitting the code to enable the soldier's to run their event on contact (start the battle) but it sounds like you've missed the part that jumps over to them walking somehow. Off the top of my head I'm fairly certain it is a list of subroutine jumps for every individual soldier all back to back, but I forget where it starts. That whole part is pretty odd where it jumps to what, one of the reasons why I started into rewriting all of it, got lost to many times trying to track it all out. I know I covered that part but will be awhile before I can get to my notes to back track it better. Will get it when able if your not there by then.

*Edit* CC/CBFB is the part your not hitting I'm pretty certain. Might check if bit $132 is being set. If your not getting that set, they won't start marching and won't clear if killed. Set at CC/C834. If not that, check the other two checked bits at /CBFB and make sure it is clearing those checks.


The only true wisdom is knowing you know nothing.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite