Banon's Donkey Farm > Game Modification Station

Party Leader identification

(1/1)

Madsiur:
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:


--- Code: ---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

--- End code ---

I think I'm missing something or don't fully understand the part at C0/B4D1...

Thanks in advance!

Lenophis:
The leader is always in the first slot. This routine is setting the caseword to whoever is in the lead slot.

assassin:
huh?

so if you have a party of:
[blank]
Terra
Locke
Edgar

will Terra's info be shifted up into the first slot?

Madsiur:

--- Quote from: Lenophis on January 17, 2012, 02:25:51 AM ---The leader is always in the first slot. This routine is setting the caseword to whoever is in the lead slot.

--- End quote ---

If there is no one in the first slot, would the subroutine consider the party member in the second slot as the party leader?

More preciscely, what interest me is the party leader actor number stored in $1E if I'm right.  When would it not branch (BCS) to C0/B4D7 and instead store the value in $1E (C0/B4D5) and change the value of $1A (C0/B4D3)? When the result of the CMP is negative, positive or equals 0? (So when does the carry flag is set?)

From what I'm understanding if $1A holds #$20 the first time and A holds either #$00, #$08, #$10 or #$18 each time, the result of the CMP $1A would always be negative each time it loops no?

There's probably something I don't understand right... :sad:

And by setting the caseword to whoever is the party leader, does it mean it will in the end set one of the following event bits with the STA $1EB4 at C0/B4E8? Sorry but I never used an event command setting/using a caseword ...


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

--- End code ---

Lenophis:

--- Quote from: assassin on January 17, 2012, 04:05:50 AM ---huh?

so if you have a party of:
[blank]
Terra
Locke
Edgar

will Terra's info be shifted up into the first slot?
--- End quote ---
Since she's in the front, I would imagine so. As far as the game is concerned with events, the party takes up slots $31, $32, and $33 ($30 is the camera).


--- Quote from: Madsiur on January 17, 2012, 09:13:09 AM ---And by setting the caseword to whoever is the party leader, does it mean it will in the end set one of the following event bits with the STA $1EB4 at C0/B4E8? Sorry but I never used an event command setting/using a caseword ...
--- End quote ---
You just answered your own question.

Navigation

[0] Message Index

Go to full version