Equal Item Probability [Vega]
#1
Equal Item Probability [Vega]

NOTE: Outdated by my single 04 line version in main Codes forum.

This code will make all Item Probabilities exactly equal. Thus creating a Random Item code. It works for all items, any position, in any size room. This code is modifying your item probability table after it is calculated from itemslot.bin and the in-race room size.

NTSC-U
C27ACBCC 00000004
7EE41A14 3960000A
39800013 7D8903A6
3997FFFE B56C0002
4200FFFC 00000000

PAL
C27BB62C 00000004
7EE41A14 3960000A
39800013 7D8903A6
3997FFFE B56C0002
4200FFFC 00000000

NTSC-J
C27BAC98 00000004
7EE41A14 3960000A
39800013 7D8903A6
3997FFFE B56C0002
4200FFFC 00000000

NTSC-K
C27A99EC 00000004
7EE41A14 3960000A
39800013 7D8903A6
3997FFFE B56C0002
4200FFFC 00000000

Source:
####################
###START ASSEMBLY###
####################

#

##########################################################
##Default ASM, Navigate to Positional Row of Game's Item##
##########################################################

add r23, r4, r3 #Default ASM

###############################################################
##Load 0x000A as the Item Probability Value that will be used##
###############################################################

li r11, 0xA

#############################
##Set Count Register Amount##
#############################

li r12, 0x13 #Load 0x13 (19) for how many item halfwords are on the positional row
mtctr r12 #MOve 0x13 value to the Count Register

###############################
##Set Loop First Load Address##
###############################

addi r12, r23, -0x2 #Since we are dealing with halfwords and a 0x2 offset for sthu function in the loop, set the first address -0x2 before the green shell halfword for whatever positional row you are in

########
##LOOP##
########

##The loop will write the halfword 0x000A to every item halfword for your current positional row of the game's item table, all items now have equal probability##

the_loop:
sthu r11, 0x2 (r12)
bdnz+ the_loop

#

##################
###END ASSEMBLY###
##################

Code creator: Vega
Code credits: XeR (subroutine founder)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)