Hi everyone,
I have a new question. I would like to use an *unused* event command and make a custom command that would make checks on the party leader (of the active party). It could be any characteristic of the Actor starting at $1600. So I could do something like: If party leader level is below 50 (parameter of the command) branch to $CA/0000 + $XX/XXXX (bytes 2, 3, 4 of the parameter). Or I could make a check on a item equipped ($161F to $1622) I haven't deceided yet. Now I found a portion of code in C0 that identify the actor number of the party leader, and this would be the first step of my command.
But from what I understand of the code comes a question: Is this function only good if the leader is in slot 0 or would I get the party leader actor number even if he's in slot #1 and there's no one in slot 0? I don't know if my understanding of the opcodes are good enough but here it is:
C0/B4B9: A920 LDA #$20
C0/B4BB: 851A STA $1A (Store #$20 in $1A)
C0/B4BD: A400 LDY $00 (Load $00 in Y, probably #$00)
C0/B4BF: BB TYX (Transfer Y to X, probably to zero X)
C0/B4C0: B95018 LDA $1850,Y (Load place of the Actor Y in the parties (value: either E1, E9, F1 or F9 for 1 party))
(E2, EA, F2 or FA for party #2 and E3, EB, F3 or FB for party 3)
C0/B4C3: 2907 AND #$07 (Bitwise #$07 AND A, the result will always be 1, 2 or 3 (party number of character Y))
C0/B4C5: CD6D1A CMP $1A6D (compare with active party number)
C0/B4C8: D00D BNE $B4D7 (Branch if not equal)
C0/B4CA: B95018 LDA $1850,Y (Load place of the Actor Y in the active party)
C0/B4CD: 2918 AND #$18 (A = 0, 8, 16 or 24 dependig in which slot is the character)
C0/B4CF: C51A CMP $1A (compare A with $1A)
C0/B4D1: B004 BCS $B4D7 (Branch on Carry set so when equals to 0?)
(I'm not sure but this would only happend only if $1A already equals 0
so once $1E would already hold character number in slot 0???)
C0/B4D3: 851A STA $1A (Store A (the position in party) in $1A)
C0/B4D5: 861E STX $1E (Store X (character number) to $1E)
C0/B4D7: E8 INX (increment X by 1)
C0/B4D8: C8 INY (Increment Y by 1)
C0/B4D9: C01000 CPY #$0010 (Y - 16)
C0/B4DC: D0E2 BNE $B4C0 (branch if we didn't looped 16 times)
C0/B4DE: C220 REP #$20 (16 bit accum./memory)
C0/B4E0: A51E LDA $1E (Load $1E (the party Leader actor number in the accumulator) (A number from 0 to 15)
***This part is not really useful for what I want to make***
C0/B4E2: 0A ASL A (multiply by two the actor number (now a even number from 0 to 30))
C0/B4E3: AA TAX (Transfer A to X)
C0/B4E4: BFF3B4C0 LDA $C0B4F3,X (load caseword (2 bytes, binary encoding?))
C0/B4E8: 8DB41E STA $1EB4 (save CaseWord)
C0/B4EB: 7B TDC (Transfer D to C, zero A)
C0/B4EC: E220 SEP #$20 (8 bit accum./memory)
C0/B4EE: A901 LDA #$01
C0/B4F0: 4C5C9B JMP $9B5C
I think I'm missing something or don't fully understand the part at C0/B4D1...
Thanks in advance!