Battle and boss songs randomizer -------------------------------- author: madsiur version: 1.1 date: 2016/04/28 Apply to FF3us 1.0 Files ----- randomsongsC2.asm: For implementation in bank $C2 randomsongsEE.asm: For implementation in bank $EE (or the bank of your choice) Apply with xkas 0.06 Command example: xkas randomsongsEE.asm romname.smc Space used ---------- randomsongsC2.asm: 64 bytes in bank $C2 randomsongsEE.asm: 76 bytes in bank $EE (or the bank of your choice) Bank $C2 and $EE implementations use by default respectively C2/6469 and $EE/AF01 as free space. Change the org offset (line 25) in the ASM file to move the code. Description ----------- Randomize the battle theme and default boss song. By default the max number of song for the battle theme is 8 and 4 for the boss theme. By default, battleTable and bossTable have their entries nullified with only the default song as entry. Replace the !noSong in a table to add a song choice. You can also reduce or expand the tables. If your table has 50% or more of null values (!nosong) it is more efficient to reduce it in half (e.g. remove 4 lines for a 8 song table) than nullifying most of the entries. You'll also need to change the !numSongBattle and/or !numSongBoss value(s). What the code does is if he picks a null value it will choose a new random number and repick from the table. If tables are modified properly, the repick probability will always be less than 50%, e.g. 44% maximum for a 16 songs table. The probability of a total of 3 picks before getting a song is 19% maximum and for 4 picks or more is 8,5%. So basically there can be relooping and cycles wasted but I don't consider it significant taking in account it was the easiest solution code-wise. To recap, if you want 12 possible songs for the battle theme, add 8 lines to the table and nullifie 4 entries (!noSong). Then you need to change the !numSongBattle variable to $0F. If you got any question, you can send me a email at themadsiur@gmail.com.