Well another week and another event command!
This one check if all the active party members have levels equal or higher than level X (passed as the first parameter of the command). The rest is similar to the other command I did, parameters 2, 3 and 4 are the offset you jump to if the levels meet the requirement. It works with 1 to 4 characters in the party since it checks all 16 characters. It's based on the same model that my command that check for status, except this one check if the level is higher for all the members of the party. Here's the code (that could be optimized I'm sure but I don't have the skills for that yet):
Edit: Why is my code always twisted. Why doesn't it align itself properly ???
If you want that command badly, you have enough there to inspire you to write it. Here's a little (and boring) example:
Event Command 6D (previously unused)
This one check if all the active party members have levels equal or higher than level X (passed as the first parameter of the command). The rest is similar to the other command I did, parameters 2, 3 and 4 are the offset you jump to if the levels meet the requirement. It works with 1 to 4 characters in the party since it checks all 16 characters. It's based on the same model that my command that check for status, except this one check if the level is higher for all the members of the party. Here's the code (that could be optimized I'm sure but I don't have the skills for that yet):
Code:
F1/A080 A6 00 LDX $00 (zero X)
F1/A082 9B TXY (zero Y)
F1/A083 48 PHA (Push #$00 in the stack)
F1/A084 85 1B STA $1B (zero $1B)
F1/A086 7B TDC (zero A)
F1/A087 B9 67 08 LDA $0867,Y (current character's party)
F1/A08A E2 20 REP #$20 (8 bit)
F1/A08C 29 07 AND #$07 (check which party)
F1/A08E CD 6D 1A CMP $1A6D (compare A to the value of the active party stored in $1A6D)
F1/A091 D0 29 BNE $A0BC (branch if not the current party)
F1/A093 A5 1B LDA $1B (load number of member in the party so far)
F1/A095 1A INC (increment party members number by 1)
F1/A096 85 1B STA $1B (save number of members in $1B)
F1/A098 8E 02 42 STX $4202 (store character number as multiplier A)
F1/A09B A9 25 LDA #$25 (character data length)
F1/A09D 8D 03 42 STA $4203 (store character data length as multiplier B)
F1/A0A0 C2 20 REP #$20 (16 bit accum./memory)
F1/A0A2 EA NOP (wait for the multiplication to be done)
F1/A0A3 EA NOP (wait for the multiplication to be done)
F1/A0A4 EA NOP (wait for the multiplication to be done)
F1/A0A5 AC 16 42 LDY $4216 (store the result of the multiplication in A)
F1/A0A8 B9 08 16 LDA $1608,Y (load current level of the character)
F1/A0AB E2 20 SEP #$20 (8 bit accum./memory)
F1/A0AD C5 EB CMP $EB (compare to parameter)
F1/A0AF F0 08 BEQ $A0B9 (Branch to if level was initially equal or higher than parameter)
F1/A0B1 C9 01 CMP #$01 (check if it looped down to level 1)
F1/A0B3 F0 07 BEQ $A0BC (branch to if level was never equal or higher than parameter)
F1/A0B5 3A DEC (decrement level by 1)
F1/A0B6 4C AD A0 JMP $A0AD (Loop as long has the character'S level is not equal to parameter or level = 1)
F1/A0B9 68 PLA (pull number of party member who have a level higher than parameter)
F1/A0BA 1A INC (Add 1 to that number)
F1/A0BB 48 PHA (push back that number in the stack)
F1/A0BC E8 INX (Increment X by 1)
F1/A0BD 8A TXA (Transfer X to A)
F1/A0BE 89 10 BIT #$10 (Have we checked all 16 characters?)
F1/A0C0 F0 08 BEQ $A0CA (Branch if we have not checked all the characters)
F1/A0C2 68 PLA (pull number of party member with a level equal or higher than parameter)
F1/A0C3 C5 1B CMP $1B (compare to number of members in the party)
F1/A0C5 F0 2A BEQ $A0F1 (Branch if all characters level are equal or higher than parameter)
F1/A0C7 4C DD A0 JMP $A0DD (Jump if one or more character level is below parameter)
F1/A0CA 8E 02 42 STX $4202 (store next character number as multiplier A)
F1/A0CD A9 29 LDA #$29 (character data lenght)
F1/A0CF 8D 03 42 STA $4203 (store character data length as multiplier B)
F1/A0D2 C2 20 REP #$20 (16 bit accum./memory)
F1/A0D4 EA NOP (wait for the multiplication to be done)
F1/A0D5 EA NOP (wait for the multiplication to be done)
F1/A0D6 EA NOP (wait for the multiplication to be done)
F1/A0D7 AC 16 42 LDY $4216 (store the result of the multiplication in A)
F1/A0DA 4C 86 A0 JMP $A086 (Jump back to character's party check)
F1/A0DD C2 21 REP #$21
F1/A0DF A5 E5 LDA $E5 (Load low and middle byte of current offset)
F1/A0E1 69 05 00 ADC #$0005 (Command + parameters length)
F1/A0E4 85 E5 STA $E5 (Save in $E5)
F1/A0E6 7B TDC (Transfer D to C)
F1/A0E7 E2 20 SEP #$20 (8 bit accum./memory)
F1/A0E9 65 E7 ADC $E7 (Add to A $E7)
F1/A0EB 85 E7 STA $E7 (Store A in $E7)
F1/A0ED 5C 6D 9A C0 JMP $C09A6D (Make a 5 bytes jump from the command number in the event)
F1/A0F1 7B TDC (Transfer D to C)
F1/A0F2 A6 EC LDX $EC (Load parameter 2 and 3)
F1/A0F4 86 E5 STX $E5 (store the low and middle byte of the offset in $E5)
F1/A0F6 A5 EE LDA $EE (Load parameter 4)
F1/A0F8 18 CLC (clear carry)
F1/A0F9 69 CA ADC #$CA (Add #$CA to the high byte of the offset)
F1/A0FB 85 E7 STA $E7 (Store high byte of the offset in $E7)
F1/A0FD 5C 6D 9A C0 JMP $C09A6D (Make the event branching/jumping effective)
If you want that command badly, you have enough there to inspire you to write it. Here's a little (and boring) example:
Event Command 6D (previously unused)