Request for Help to Adapt a Code For Give Items to Players
#1
I have a code that gives 1 green shell to Player 1 when a button is pressed :

283457E2 00000200 
48000000 809C1900 
DE000000 80008180 
58010000 00000008 
DE000000 80008180 
48100000 80001500 
DE000000 80008180 
1000008F 00000000 
10000093 00000001 
E0000000 80008000 

I would like to adapt this code so that when a button is pressed by Player 2 or Player 3, it gives a green shell to the corresponding player:
  • Player 2's button pressed = green shell for Player 2.
  • Player 3's button pressed = green shell for Player 3.
If someone has a solution, I would also appreciate an explanation of how it works so I can replicate it for other items. Thanks in advance for your help!
Reply
#2
The code was originally found here.

Code:
[PAL]
$Item Modifier - Wii Remote Button Activator/Trigger [Master Kirby]
283457E2 0000WWWW
48000000 809C1900
DE000000 80008180
58010000 00000008
DE000000 80008180
48100000 80001500
DE000000 80008180
1000008F 000000YY
10000093 0000000Z
E0000000 80008000

With X,Y,Z values added, the code is this:

Code:
[PAL]
$Item Modifier [Master Kirby]
2834XXXX YYYYZZZZ
48000000 809C1900
DE000000 80008180
58010000 00000008
DE000000 80008180
48100000 80001500
DE000000 80008180
1000008F 000000II
10000093 0000000Q
E0000000 80008000

[NTSC-U]
$Item Modifier [Master Kirby]
2834XXXX YYYYZZZZ
48000000 809BEE20
DE000000 80008180
58010000 00000014
DE000000 80008180
48100000 80001500
DE000000 80008180
1000008F 000000II
10000093 0000000Q
E0000000 80008000

II = Item ID
Q = Quantity
Fill in the X,Y,Z values according to this page.
Reply
#3
(12-23-2024, 05:35 PM)TomCube Wrote: The code was originally found here.

Code:
[PAL]
$Item Modifier - Wii Remote Button Activator/Trigger [Master Kirby]
283457E2 0000WWWW
48000000 809C1900
DE000000 80008180
58010000 00000008
DE000000 80008180
48100000 80001500
DE000000 80008180
1000008F 000000YY
10000093 0000000Z
E0000000 80008000

With X,Y,Z values added, the code is this:

Code:
[PAL]
$Item Modifier [Master Kirby]
2834XXXX YYYYZZZZ
48000000 809C1900
DE000000 80008180
58010000 00000008
DE000000 80008180
48100000 80001500
DE000000 80008180
1000008F 000000II
10000093 0000000Q
E0000000 80008000

[NTSC-U]
$Item Modifier [Master Kirby]
2834XXXX YYYYZZZZ
48000000 809BEE20
DE000000 80008180
58010000 00000014
DE000000 80008180
48100000 80001500
DE000000 80008180
1000008F 000000II
10000093 0000000Q
E0000000 80008000

II = Item ID
Q = Quantity
Fill in the X,Y,Z values according to this page.

I've set up the buttons for all 3 players, but when I press the corresponding button on player 2 or 3's controller, the green shell is assigned to player 1.

So that changes the buttons, but I'd also like to change the destination of the objects.
Reply
#4
If you want I can give you the code for all Players in games (All players and also CPUs). You need to tell me your game region.
Reply
#5
(12-25-2024, 05:45 PM)Unnamed Wrote: If you want I can give you the code for all Players in games (All players and also CPUs). You need to tell me your game region.

Really? I'm in the PAL region
If you have this, it would be a huge help.
Reply
#6
Nevermind the Region, I have written a region free code that can be used to assign Items to all offline racers, including CPUs

Source is ofc added, if anyone wants to modify it.


C0000000 00000014
3D208000 89695F27
3D40809C 2C0B00EC
80AA3618 41820030
2C0B008C 80AAEE20
41820024 2C0B0010
80AA2678 41820018
2C0B0054 3D40809B
80AA1C58 41820008
48000058 2C050000
41820050 39290FC4
81450014 38A00000
54AB083C 7C0958AE
396B0001 7C6958AE
2C030000 40A2000C
2C000000 41820018
1D850248 398C008C
7C0A612E 398C0004
7C6A612E 38A50001
2C05000C 4180FFC4
4E800020 00000000


The code will load Item and amount for each player, starting from adress 80000FC4. To set your specific item, you can use Button activators.

283PXXXX YYYYZZZZ
0200SSSS 0000II0Q
E0000000 00000000

where

XXXX: Controller adress
ZZZZ: Button Activator
YYYY = FFFF - ZZZZ, or YYYY = 0000 if only these buttons should be pressed
P = 3 for Korea, P = 4 else

SSSS: Player offset
0FC4 = Player 1
0FC6 = Player 2/CPU 1
0FC8 = Player 3/CPU 2
0FCA = Player 4/CPU 3
0FCC = CPU 4
0FCE = CPU 5
0FD0 = CPU 6
0FD2 = CPU 7
0FD4 = CPU 8
0FD6 = CPU 9
0FD8 = CPU 10
0FDA = CPU 11

II and Q: Item and Amount
II = 12, Q = 3: Triple Bannans
II = 11, Q = 3: Triple Reds
II = 10, Q = 3: Triple Greens
II = 0F, Q = 1: Bullet Bill
II = 0E, Q = 1: Cloud
II = 0D, Q = 1: POW
II = 0C, Q = 1: Blooper
II = 0B, Q = 1: Mega Shroom
II = 0A, Q = 1: Gold Shroom
II = 09, Q = 1: Star Power
II = 08, Q = 1: Lightning
II = 07, Q = 1: Blue shell
II = 06, Q = 1: Bomb
II = 05, Q = 3: Shrooms
II = 04, Q = 1: 1 Shroom
II = 03, Q = 1: Fake Box
II = 02, Q = 1: Bannana
II = 01, Q = 1: Red shell
II = 00, Q = 1: Green Shell
II = 14, Q = 0: Nothing


Here is an example how to setup it with Button activators
28345842 00000088 First Player Classic Controller PAL, Buttons X and Zl
02000FC4 00000101 Red Shell for Player 1
E0000000 00000000
28345842 00000028 First Player Classic Controller PAL, Buttons X and Y
02000FC4 00000201 Banana for Player 1
E0000000 00000000
28345D1A 00001000 Second Player Wiimote PAL, button -
02000FC6 00000701 Blue Shell for Player 2
E0000000 00000000
28345D1A 00000010 Second Player Wiimote PAL, button +
02000FC6 00000901 Star for Player 2
E0000000 00000000
E0000000 80008000


Source:
lis r9, 0x8000

#Find Region of Game

lbz r11, 0x5F27 (r9) #Instruction here is vital. Virtually impossible for this to be modded by something unrelated

lis r10, 0x809C #Prepare PlayerHolder

cmpwi r11, 0xEC #pal
lwz r5, 0x3618 (r10)
beq- next

cmpwi r11, 0x8C #usa
lwz r5, 0xFFFFEE20 (r10)
beq- next

cmpwi r11, 0x10 #japan
lwz r5, 0x2678 (r10)
beq- next

cmpwi r11, 0x54 #korea
lis r10, 0x809B
lwz r5, 0x1C58 (r10)
beq- next

#unknown region
b end

next:
cmpwi r5, 0 # check if PlayerHolder is active
beq- end

addi r9, r9, 0x0FC4
lwz r10, 0x14 (r5)
li r5, 0

# r0 = Item
# r3 = Amount
# r5 = counter
# r9 = Source Adress
# r10 = Target Adress
# r11 = Source Player offset
# r12 = Target Player offset

loop:
# load amount and Item
slwi r11, r5, 1
lbzx r0, r9, r11 # load custom Item
addi r11, r11, 1
lbzx r3, r9, r11 # load custom amount

cmpwi r3, 0x0
bne+ item_ok
cmpwi r0, 0
beq- deac_skip

item_ok:
mulli r12, r5, 584
addi r12, r12, 0x8c # 0x8c is Item offset
stwx r0, r10, r12 # store it to Item offset
addi r12, r12, 0x4 # 0x90 is amount offset
stwx r3, r10, r12 # store amount to offset
deac_skip:

addi r5, r5, 1
cmpwi r5, 12
blt loop

end:
Reply
#7
(12-27-2024, 03:45 PM)Unnamed Wrote: Nevermind the Region, I have written a region free code that can be used to assign Items to all offline racers, including CPUs

Source is ofc added, if anyone wants to modify it.


C0000000 00000014
3D208000 89695F27
3D40809C 2C0B00EC
80AA3618 41820030
2C0B008C 80AAEE20
41820024 2C0B0010
80AA2678 41820018
2C0B0054 3D40809B
80AA1C58 41820008
48000058 2C050000
41820050 39290FC4
81450014 38A00000
54AB083C 7C0958AE
396B0001 7C6958AE
2C030000 40A2000C
2C000000 41820018
1D850248 398C008C
7C0A612E 398C0004
7C6A612E 38A50001
2C05000C 4180FFC4
4E800020 00000000


The code will load Item and amount for each player, starting from adress 80000FC4. To set your specific item, you can use Button activators.

283PXXXX YYYYZZZZ
0200SSSS 0000II0Q
E0000000 00000000

where

XXXX: Controller adress
ZZZZ: Button Activator
YYYY = FFFF - ZZZZ, or YYYY = 0000 if only these buttons should be pressed
P = 3 for Korea, P = 4 else

SSSS: Player offset
0FC4 = Player 1
0FC6 = Player 2/CPU 1
0FC8 = Player 3/CPU 2
0FCA = Player 4/CPU 3
0FCC = CPU 4
0FCE = CPU 5
0FD0 = CPU 6
0FD2 = CPU 7
0FD4 = CPU 8
0FD6 = CPU 9
0FD8 = CPU 10
0FDA = CPU 11

II and Q: Item and Amount
II = 12, Q = 3: Triple Bannans
II = 11, Q = 3: Triple Reds
II = 10, Q = 3: Triple Greens
II = 0F, Q = 1: Bullet Bill
II = 0E, Q = 1: Cloud
II = 0D, Q = 1: POW
II = 0C, Q = 1: Blooper
II = 0B, Q = 1: Mega Shroom
II = 0A, Q = 1: Gold Shroom
II = 09, Q = 1: Star Power
II = 08, Q = 1: Lightning
II = 07, Q = 1: Blue shell
II = 06, Q = 1: Bomb
II = 05, Q = 3: Shrooms
II = 04, Q = 1: 1 Shroom
II = 03, Q = 1: Fake Box
II = 02, Q = 1: Bannana
II = 01, Q = 1: Red shell
II = 00, Q = 1: Green Shell
II = 14, Q = 0: Nothing


Here is an example how to setup it with Button activators
28345842 00000088 First Player Classic Controller PAL, Buttons X and Zl
02000FC4 00000101 Red Shell for Player 1
E0000000 00000000
28345842 00000028 First Player Classic Controller PAL, Buttons X and Y
02000FC4 00000201 Banana for Player 1
E0000000 00000000
28345D1A 00001000 Second Player Wiimote PAL, button -
02000FC6 00000701 Blue Shell for Player 2
E0000000 00000000
28345D1A 00000010 Second Player Wiimote PAL, button +
02000FC6 00000901 Star for Player 2
E0000000 00000000
E0000000 80008000


Source:
lis r9, 0x8000

#Find Region of Game

lbz r11, 0x5F27 (r9) #Instruction here is vital. Virtually impossible for this to be modded by something unrelated

lis r10, 0x809C #Prepare PlayerHolder

cmpwi r11, 0xEC #pal
lwz r5, 0x3618 (r10)
beq- next

cmpwi r11, 0x8C #usa
lwz r5, 0xFFFFEE20 (r10)
beq- next

cmpwi r11, 0x10 #japan
lwz r5, 0x2678 (r10)
beq- next

cmpwi r11, 0x54 #korea
lis r10, 0x809B
lwz r5, 0x1C58 (r10)
beq- next

#unknown region
b end

next:
cmpwi r5, 0 # check if PlayerHolder is active
beq- end

addi r9, r9, 0x0FC4
lwz r10, 0x14 (r5)
li r5, 0

# r0 = Item
# r3 = Amount
# r5 = counter
# r9 = Source Adress
# r10 = Target Adress
# r11 = Source Player offset
# r12 = Target Player offset

loop:
# load amount and Item
slwi r11, r5, 1
lbzx r0, r9, r11 # load custom Item
addi r11, r11, 1
lbzx r3, r9, r11 # load custom amount

cmpwi r3, 0x0
bne+ item_ok
cmpwi r0, 0
beq- deac_skip

item_ok:
mulli r12, r5, 584
addi r12, r12, 0x8c # 0x8c is Item offset
stwx r0, r10, r12 # store it to Item offset
addi r12, r12, 0x4 # 0x90 is amount offset
stwx r3, r10, r12 # store amount to offset
deac_skip:

addi r5, r5, 1
cmpwi r5, 12
blt loop

end:

Thank you so much for your help. I'll give it a try.

I just have one question, does the Nothing allow you to remove an item or does it count as an item in its own right?
Because I'd really like to be able to remove an item, whether it's for a player or a CPU.

Sincerely
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)