Offset(x00186000) //Map: 74 Arena //Track 01: 26 Treasure //Track 02: 5B Sky Travel LoadConditionals(x00C2) GoTo(x00) //This is the section for determining loot from the Treasure Wheel. There are nine sections, dividing the rewards up by the progression required to unlock the battle, rather than dividing the loot up depending on the battle. Within those sections are another four subsections; Weapons, Armor, Accessories, Consumables - unless this is a Chapter 4 Rendezvous, in which case there are FOUR MORE subsections: Rare Weapons, Rare Armor, Rare Accessories, Rare Consumables. //Also, each individual subsection needs to set a variable to the number of possible outcomes. This is to allow the randomly generated number to determine the proper result. If you intend to change the equipment available, make sure you have that number set properly. And it has to be set in HEX format, not DECIMAL. //====================================================== //CHAPTER 1: "Chocobo Defense" //WEAPONS //====================================================== GoToTarget(x9C) //Currently 6 weapons. Get a random result from 1-6. Random(x01,00006) //Zero out Variable x00. ZERO(x0000) //Set the Current Item to match the first item. //02 Mythril Knife SET(x0036,x0002) //Check if Variable x00's value is less than x01's. LT() //If Variable x00 was NOT less than x01, then both values were zero. Stop here and return to the rest of the event, leaving Current Item set to the first item. JumpForwardIfZero(xF0) //If it was, the event will continue. //Set the Current Item to match the second item. //03 Blind Knife SET(x0036,x0003) //Variable x00 is now set to a value of 01; try the same Less Than command again. LT() JumpForwardIfZero(xF0) //Var x00 will remain at a value of 01. Now we start subtracting 1 from Variable x01, checking it against every remaining item. //14 Long Sword SET(x0036,x0014) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //15 Iron Sword SET(x0036,x0015) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //3C White Staff SET(x0036,x003C) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //54 Silver Bow SET(x0036,x0054) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //Out of items. //==================== //CH. 1 - ARMOR //==================== GoToTarget(x9D) //6 pieces of armor. Random(x01,00006) //Zero out Variable x00. ZERO(x0000) //82 Bronze Shield SET(x0036,x0082) LT() JumpForwardIfZero(xF0) //92 Iron Helmet SET(x0036,x0092) LT() JumpForwardIfZero(xF0) //9F Red Hood SUB(x0001,x0001) SET(x0036,x009F) LT() JumpForwardIfZero(xF0) //AF Chain Mail SUB(x0001,x0001) SET(x0036,x00AF) LT() JumpForwardIfZero(xF0) //BD Chain Vest SUB(x0001,x0001) SET(x0036,x00BD) LT() JumpForwardIfZero(xF0) //C8 Linen Robe SUB(x0001,x0001) SET(x0036,x00C8) LT() JumpForwardIfZero(xF0) //==================== //CH. 1 - ACCESSORIES //==================== GoToTarget(x9E) //2 accessories. Random(x01,00002) //Zero out Variable x00. ZERO(x0000) //D0 Battle Boots SET(x0036,x00D0) LT() JumpForwardIfZero(xF0) //E5 Small Mantle SET(x0036,x00E5) LT() JumpForwardIfZero(xF0) //========================================== //CH. 1 - CONSUMABLES //Also used for visiting lower level wheels. //========================================== GoToTarget(x9F) //Elxirs only. //If this is a lower level wheel, increase the Random number to 10. SETVar(x0000,x0085) If() Random(x29,00010) Else() Random(x29,00005) EndIf() //ADD x01 to x29 because the random result can be 00. ADD(x0029,x0001) //F5 Eixirs SET(x0036,x00F5) JumpForward(xF0) //===================================================== //START CHAPTER 2: "Chicken Race" and "Treasure Hunt". //WEAPONS //===================================================== GoToTarget(xA0) //14 items. Random(x01,00014) //Zero out Variable x00. ZERO(x0000) //Set the Current Item to match the first item. //04 Mage Masher SET(x0036,x0004) //Check if Variable x00's value is less than x01's. LT() //If Variable x00 was NOT less than x01, then both values were zero. Stop here and return to the rest of the event, leaving Current Item set to the first item. JumpForwardIfZero(xF0) //If it was, the event will continue. //Set the Current Item to match the second item. //0B Hidden Knife SET(x0036,x000B) //Variable x00 is now set to a value of 01; try the same Less Than command again. LT() JumpForwardIfZero(xF0) //Var x00 will remain at a value of 01. Now we start subtracting 1 from Variable x01, checking it against every remaining item. //16 Mythril Sword SET(x0036,x0016) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //26 Asura Knife SET(x0036,x0026) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //30 Battle Axe SET(x0036,x0030) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //34 Thunder Rod SET(x0036,x0034) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //35 Flame Rod SET(x0036,x0035) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //36 Ice Rod SET(x0036,x0036) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //3D Healing Staff SET(x0036,x003d) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //4E Night Killer SET(x0036,x004e) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //55 Ice Bow SET(x0036,x0055) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //5F Battle Dict SET(x0036,x005f) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //63 Javelin SET(x0036,x0063) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //6B Cypress Rod SET(x0036,x006b) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //Out of items. //==================== //START CH. 2 - ARMOR //==================== GoToTarget(xA1) //12 items. Random(x01,00012) //Zero out Variable x00. ZERO(x0000) //83 Round Shield SET(x0036,x0083) LT() JumpForwardIfZero(xF0) //84 Mythril Shield SET(x0036,x0084) LT() JumpForwardIfZero(xF0) //93 Barbuta SUB(x0001,x0001) SET(x0036,x0093) LT() JumpForwardIfZero(xF0) //94 Mythril Helmet SUB(x0001,x0001) SET(x0036,x0094) LT() JumpForwardIfZero(xF0) //A0 Headgear SUB(x0001,x0001) SET(x0036,x00A0) LT() JumpForwardIfZero(xF0) //A1 Triangle Hat SUB(x0001,x0001) SET(x0036,x00A1) LT() JumpForwardIfZero(xF0) //B0 Mythril Armor SUB(x0001,x0001) SET(x0036,x00B0) LT() JumpForwardIfZero(xF0) //B1 Plate Mail SUB(x0001,x0001) SET(x0036,x00B1) LT() JumpForwardIfZero(xF0) //BE Mythril Vest SUB(x0001,x0001) SET(x0036,x00BE) LT() JumpForwardIfZero(xF0) //BF Adaman Vest SUB(x0001,x0001) SET(x0036,x00BF) LT() JumpForwardIfZero(xF0) //C9 Silk Robe SUB(x0001,x0001) SET(x0036,x00C9) LT() JumpForwardIfZero(xF0) //CA Wizard Robe SUB(x0001,x0001) SET(x0036,x00CA) LT() JumpForwardIfZero(xF0) //=========================== //START CH.2 ACCESSORIES //=========================== GoToTarget(xA2) //7 items. Random(x01,00007) ZERO(x0000) //D0 Battle Boots SET(x0036,x00D0) LT() JumpForwardIfZero(xF0) //D1 Spike Shoes SET(x0036,x00D1) LT() JumpForwardIfZero(xF0) //D3 Rubber Shoes SUB(x0001,x0001) SET(x0036,x00D3) LT() JumpForwardIfZero(xF0) //D7 Power Wrist SUB(x0001,x0001) SET(x0036,x00D7) LT() JumpForwardIfZero(xF0) //DC Defense Ring SUB(x0001,x0001) SET(x0036,x00DC) LT() JumpForwardIfZero(xF0) //E6 Leather Mantle SUB(x0001,x0001) SET(x0036,x00E6) LT() JumpForwardIfZero(xF0) //E7 Wizard Mantle SUB(x0001,x0001) SET(x0036,x00E7) LT() JumpForwardIfZero(xF0) //============================ //START CH. 2 CONSUMABLES //============================ GoToTarget(xA3) //Now, obviously, we're not going to do some shit like give someone ONE SINGLE POTION and pretend that's as useful as a weapon. This time, we'll set the Number Of Items (Variable x0E) along with the Current Item (x0B). I'm thinking 3 katanas, 5 shuriken, and 10 (hex 0A) chemist items. //5 items. Random(x01,00003) ZERO(x0000) //26 Asura Knife SET(x0029,x0003) SET(x0036,x0026) LT() JumpForwardIfZero(xF0) //7A Shuriken SET(x0029,x0005) SET(x0036,x007A) LT() JumpForwardIfZero(xF0) //F5 5 Elixirs SET(x0029,x0005) SUB(x0001,x0001) SET(x0036,x00F5) LT() JumpForwardIfZero(xF0) //============================= //TEIOH WEAPONS //============================ GoToTarget(xA4) //14 items. Random(x01,00014) ZERO(x0000) //05 Platina Dagger SET(x0036,x0005) LT() JumpForwardIfZero(xF0) //18 Coral Sword SET(x0036,x0018) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //27 Koutetsu Knife SET(x0036,x0027) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //37 Poison Rod SET(x0036,x0037) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //3E Rainbow Staff SET(x0036,x003E) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //43 Flail SET(x0036,x0043) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //47 Romanda Gun SET(x0036,x0047) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //4F Cross Bow SET(x0036,x004F) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //56 Lightning Bow SET(x0036,x0056) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //5C Ramia Harp SET(x0036,x005C) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //64 Spear SET(x0036,x0064) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //6C Battle Bamboo SET(x0036,x006C) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //73 C Bag SET(x0036,x0073) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //77 Persia SET(x0036,x0077) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //============ //TEIOH ARMOR //============ GoToTarget(xA5) //6 items Random(x01,00006) ZERO(x0000) //85 Gold Shield SET(x0036,x0085) LT() JumpForwardIfZero(xF0) //95 Gold Helmet SET(x0036,x0095) LT() JumpForwardIfZero(xF0) //96 Cross Helmet SET(x0036,x0096) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //A2 Green Beret SET(x0036,x00A2) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //B2 Gold Armor SET(x0036,x00B2) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //C0 Wizard Outfit SET(x0036,x00C0) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //================= //TEIOH ACCESSORIES //================= GoToTarget(xA6) //4 items Random(x01,00004) ZERO(x0000) //E4 Defense Armlet SET(x0036,x00E4) LT() JumpForwardIfZero(xF0) //E0 Diamond Armlet SET(x0036,x00E0) LT() JumpForwardIfZero(xF0) //D0 Battle Boots SET(x0036,x00D0) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //E7 Wizard Mantle SET(x0036,x00E7) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //================= //TEIOH CONSUMABLES //================= GoToTarget(xA7) //5 items Random(x01,00005) ZERO(x0000) SET(x0029,x0003) //27 Koutetsu Knife SET(x0036,x0027) LT() JumpForwardIfZero(xF0) SET(x0029,x0014) //7E Water Ball SET(x0036,x007E) LT() JumpForwardIfZero(xF0) //7F Lightning Ball SET(x0036,x007F) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //7D Fire Ball SET(x0036,x007D) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) SET(x0029,x0005) //F5 Elixirs SET(x0036,x00F5) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //============================= //LOST HEIRLOOM WEAPONS //============================= GoToTarget(xA8) //10 items Random(x01,00010) ZERO(x0000) //0C Ninja Knife SET(x0036,x000C) LT() JumpForwardIfZero(xF0) //19 Ancient Sword SET(x0036,x0019) LT() JumpForwardIfZero(xF0) //28 Bizen Boat SET(x0036,x0028) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //31 Giant Axe SET(x0036,x0031) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //3F Wizard Staff SET(x0036,x003F) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //50 Poison Bow SET(x0036,x0050) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //58 Mithril Bow SET(x0036,x0058) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //60 Monster Dict SET(x0036,x0060) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //65 Mythril Spear SET(x0036,x0065) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //6D Musk Rod SET(x0036,x006D) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //=========================== //LOST HEIRLOOM ARMOR //=========================== GoToTarget(xA9) //7 items Random(x01,00007) ZERO(x0000) //86 Ice Shield SET(x0036,x0086) LT() JumpForwardIfZero(xF0) //87 Flame Shield SET(x0036,x0087) LT() JumpForwardIfZero(xF0) //97 Diamond Helmet SET(x0036,x0097) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //A3 Twist Headband SET(x0036,x00A3) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //B3 Diamond Armor SET(x0036,x00B3) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //C1 Brigandine SET(x0036,x00C1) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //CB Chameleon Robe SET(x0036,x00CB) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //===================== //LOST HEIRLOOM ACCESSORIES //========================== GoToTarget(xAa) //3 items Random(x01,00003) ZERO(x0000) //D4 Feather Boots SET(x0036,x00D4) LT() JumpForwardIfZero(xF0) //D9 Magic Gauntlet SET(x0036,x00D9) LT() JumpForwardIfZero(xF0) //DB Reflect Ring SET(x0036,x00DB) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //==================== //LOST HEIRLOOM CONSUMABLES //========================= GoToTarget(xAB) //5 items Random(x01,00005) ZERO(x0000) SET(x0029,x0003) //28 Bizen Boat SET(x0036,x0028) LT() JumpForwardIfZero(xF0) SET(x0029,x0014) //7D Fire Ball SET(x0036,x007D) LT() JumpForwardIfZero(xF0) //7E Water Ball SET(x0036,x007E) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //7F Lightning Ball SET(x0036,x007F) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) SET(x0029,x0005) //F5 Elixir SET(x0036,x00F5) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //================= //THE FETE WEAPONS //================= GoToTarget(xAC) //14 items Random(x01,00014) ZERO(x0000) //06 Main Gauche SET(x0036,x0006) LT() JumpForwardIfZero(xF0) //1A Sleep Sword SET(x0036,x001A) LT() JumpForwardIfZero(xF0) //1C Diamond Sword SET(x0036,x001C) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //29 Murasame SET(x0036,x0029) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //38 Wizard Rod SET(x0036,x0038) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //40 Gold Staff SET(x0036,x0040) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //44 Flame Whip SET(x0036,x0044) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //48 Mythril Gun SET(x0036,x0048) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //51 Hunting Bow SET(x0036,x0051) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //57 Windslash Bow SET(x0036,x0057) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //5D Bloody Strings SET(x0036,x005d) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //66 Partisan SET(x0036,x0066) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //6E Iron Fan SET(x0036,x006E) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //75 P Bag SET(x0036,x0075) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //============== //THE FETE ARMOR //============== GoToTarget(xAd) //5 items Random(x01,00005) ZERO(x0000) //88 Aegis Shield SET(x0036,x0088) LT() JumpForwardIfZero(xF0) //98 Platina Helmet SET(x0036,x0098) LT() JumpForwardIfZero(xF0) //A4 Holy Miter SET(x0036,x00A4) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //C2 Judo Outfit SET(x0036,x00C2) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //CC White Robe SET(x0036,x00CC) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //==================== //THE FETE ACCESSORIES //==================== GoToTarget(xAe) //5 items Random(x01,00005) ZERO(x0000) //D2 Germinas Boots SET(x0036,x00D2) LT() JumpForwardIfZero(xF0) //DA Bracer SET(x0036,x00DA) LT() JumpForwardIfZero(xF0) //DD Magic Ring SET(x0036,x00DD) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //E3 N-Kai Armlet SET(x0036,x00E3) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //E8 Elf Mantle SET(x0036,x00E8) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //==================== //THE FETE CONSUMABLES //==================== GoToTarget(xAf) //3 items Random(x01,00003) ZERO(x0000) SET(x0029,x0003) //29 Murasame SET(x0036,x0029) LT() JumpForwardIfZero(xF0) SET(x0029,x0014) //7B Magic Shuriken SET(x0036,x007B) LT() JumpForwardIfZero(xF0) SET(x0029,x0007) //F5 Elixir SET(x0036,x00F5) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //====================== //DESERT MINEFIELD WEAPONS //========================= GoToTarget(xB0) //8 items Random(x01,00008) ZERO(x0000) //07 Orichalcum SET(x0036,x0007) LT() JumpForwardIfZero(xF0) //0D Short Edge SET(x0036,x000D) LT() JumpForwardIfZero(xF0) //1B Platinum Sword SET(x0036,x001B) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //2A Heaven's Cloud SET(x0036,x002A) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //32 Slasher SET(x0036,x0032) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //61 Papyrus Plate SET(x0036,x0061) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //6F Gokuu Rod SET(x0036,x006F) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //78 Cashmere SET(x0036,x0078) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //=================== //DESERT MINEFIELD ARMOR //====================== GoToTarget(xB1) //5 items Random(x01,00005) ZERO(x0000) //89 Diamond Shield SET(x0036,x0089) LT() JumpForwardIfZero(xF0) //99 Circlet SET(x0036,x0099) LT() JumpForwardIfZero(xF0) //A5 Black Hood SET(x0036,x00A5) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //B4 Platina Armor SET(x0036,x00B4) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //C3 Power Sleeve SET(x0036,x00C3) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //======================= //DESERT MINEFIELD ACCESSORIES //============================ GoToTarget(xB2) //3 items Random(x01,00003) ZERO(x0000) //D5 Sprint Shoes SET(x0036,x00D5) LT() JumpForwardIfZero(xF0) //E2 108 Gems SET(x0036,x00E2) LT() JumpForwardIfZero(xF0) //E9 Dracula Mantle SET(x0036,x00E9) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //========================= //DESERT MINEFIELD CONSUMABLES //============================ GoToTarget(xB3) //3 items Random(x01,00003) ZERO(x0000) SET(x0029,x0003) //2a Heaven's Cloud SET(x0036,x002A) LT() JumpForwardIfZero(xF0) SET(x0029,x0014) //7B Magic Shuriken SET(x0036,x007B) LT() JumpForwardIfZero(xF0) SET(x0029,x0007) //F5 Elixirs SET(x0036,x00F5) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //======================= //LITTERING WEAPONS //======================= GoToTarget(xB4) //7 items Random(x01,00007) ZERO(x0000) //08 Assassin Dagger SET(x0036,x0008) LT() JumpForwardIfZero(xF0) //0E Ninja Edge SET(x0036,x000E) LT() JumpForwardIfZero(xF0) //1D Ice Brand SET(x0036,x001D) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //2B Kiyomori SET(x0036,x002B) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //45 Morning Star SET(x0036,x0045) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //70 Ivory Rod SET(x0036,x0070) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //76 H Bag SET(x0036,x0076) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //============================ //LITTERING ARMOR //============================ GoToTarget(xB5) //6 items Random(x01,00006) ZERO(x0000) //8A Platina Shield SET(x0036,x008A) LT() JumpForwardIfZero(xF0) //9A Crystal Helmet SET(x0036,x009A) LT() JumpForwardIfZero(xF0) //A6 Golden Hairpin SET(x0036,x00A6) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //B5 Carabini Mail SET(x0036,x00B5) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //C4 Earth Clothes SET(x0036,x00C4) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //CD Black Robe SET(x0036,x00CD) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //======================= //LITTERING ACCESSORIES //======================= GoToTarget(xB6) //3 items Random(x01,00003) ZERO(x0000) //D5 Sprint Shoes SET(x0036,x00D5) LT() JumpForwardIfZero(xF0) //DF Angel Ring SET(x0036,x00DF) LT() JumpForwardIfZero(xF0) //E9 Dracula Mantle SET(x0036,x00E9) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //================== //LITTERING CONSUMABLES //===================== GoToTarget(xB7) //3 items Random(x01,00003) ZERO(x0000) SET(x0029,x0003) //2B Kiyomori SET(x0036,x002B) LT() JumpForwardIfZero(xF0) SET(x0029,x0014) //7C Yagyu Darkness SET(x0036,x007B) LT() JumpForwardIfZero(xF0) SET(x0029,x0007) //F5 Elixirs SET(x0036,x00F5) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //====================================== //ALL CHAPTER 4 COMMON WEAPONS //====================================== GoToTarget(xB8) //9 items Random(x01,00009) ZERO(x0000) //09 Air Knife SET(x0036,x0009) LT() JumpForwardIfZero(xF0) //0F Spell Edge SET(x0036,x000F) LT() JumpForwardIfZero(xF0) //1E Rune Blade SET(x0036,x001E) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //2C Muramasa SET(x0036,x002C) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //2D Kikuichimoji SET(x0036,x002D) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //52 Gastrafitis SET(x0036,x0052) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //59 Ultimus Bow SET(x0036,x0059) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //67 Oberisk SET(x0036,x0067) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //71 Octagon Rod SET(x0036,x0071) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //=========================== //ALL CHAPTER 4 COMMON ARMOR //=========================== GoToTarget(xB9) //8 items Random(x01,00008) ZERO(x0000) //8B Crystal Shield SET(x0036,x008B) LT() JumpForwardIfZero(xF0) //9A Crystal Helmet SET(x0036,x009A) LT() JumpForwardIfZero(xF0) //A7 Flash Hat SET(x0036,x00A7) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //A8 Thief Hat SET(x0036,x00A8) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //B6 Crystal Mail SET(x0036,x00B6) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //B8 Reflect Mail SET(x0036,x00B8) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //C6 Black Costume SET(x0036,x00C6) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //CE Light Robe SET(x0036,x00Ce) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //================================ //ALL CHAPTER 4 COMMON ACCESSORIES //================================ GoToTarget(xBa) //3 items. Random(x01,00003) ZERO(x0000) //D6 Red Shoes SET(x0036,x00D6) LT() JumpForwardIfZero(xF0) //DF Angel Ring SET(x0036,x00DF) LT() JumpForwardIfZero(xF0) //EA Feather Mantle SET(x0036,x00EA) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //========================= //ALL CHAPTER 4 COMMON CONSUMABLES //================================ GoToTarget(xBB) //3 items. Random(x01,00003) ZERO(x0000) SET(x0029,x0003) //2C Muramasa SET(x0036,x002c) LT() JumpForwardIfZero(xF0) //2D Kikuichimoji SET(x0036,x002D) LT() JumpForwardIfZero(xF0) SET(x0029,x000A) //F5 Elixir SET(x0036,x00F5) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //============================== //SHADES OF THE PAST RARE WEAPONS //=============================== GoToTarget(xBC) //11 items. (B in hex) Random(x01,00011) //Unless this is post-All-Stars Knights Templar. SETVar(x0000,x0084) If() Random(x01,00020) EndIf() ZERO(x0000) //0A Zorlin Shape SET(x0036,x000A) LT() JumpForwardIfZero(xF0) //10 Sasuke Knife SET(x0036,x0010) LT() JumpForwardIfZero(xF0) //20 Materia Blade SET(x0036,x0020) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //21 Defender SET(x0036,x0021) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //39 Dragon Rod SET(x0036,x0039) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //46 Scorpion Tail SET(x0036,x0046) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //5A Yoichi Bow SET(x0036,x005A) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //5E Fairy Harp SET(x0036,x005E) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //62 Madlemgen SET(x0036,x0062) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //68 Holy Lance SET(x0036,x0068) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //79 Ryozan Silk SET(x0036,x0079) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //====================================== //ALL-STARS RARE WEAPONS //====================================== GoToTarget(xC0) //9 items Random(x01,00009) ZERO(x0000) //11 Iga Knife SET(x0036,x0011) LT() JumpForwardIfZero(xF0) //12 Koga Knife SET(x0036,x0012) LT() JumpForwardIfZero(xF0) //22 Save the Queen SET(x0036,x0022) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //2E Masamune SET(x0036,x002E) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //42 Sage Staff SET(x0036,x0042) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //49 Stone Gun SET(x0036,x0049) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //69 Dragon Whisker SET(x0036,x0069) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //72 Whale Whisker SET(x0036,x0072) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //74 FS Bag SET(x0036,x0074) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //=========================== //SHADES OF THE PAST RARE ARMOR //============================= GoToTarget(xBd) //03 items. Random(x01,00003) //Unless this is post-All-Stars Knights Templar. SETVar(x0000,x0084) If() Random(x01,00006) EndIf() ZERO(x0000) //8C Genji Shield SET(x0036,x008C) LT() JumpForwardIfZero(xF0) //9B Genji Helmet SET(x0036,x009B) LT() JumpForwardIfZero(xF0) //B7 Genji Armor SET(x0036,x00B7) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //===================================== //ALL-STARS RARE ARMOR //===================================== GoToTarget(xC1) //3 items Random(x01,00003) ZERO(x0000) //A9 Cachusha SET(x0036,x00A9) LT() JumpForwardIfZero(xF0) //AA Barette SET(x0036,x00AA) LT() JumpForwardIfZero(xF0) //C5 Secret Clothes SET(x0036,x00C5) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //=========================== //SHADES OF THE PAST RARE ACCESSORIES //=================================== GoToTarget(xBE) //1 item //Unless this is post-All-Stars Knights Templar. SETVar(x0000,x0084) If() Random(x01,00003) EndIf() ZERO(x0000) //D8 Genji Gauntlet SET(x0036,x00d8) LT() JumpForwardIfZero(xF0) //========================= //ALL-STARS RARE ACCESSORIES //================================ GoToTarget(xC2) //2 items Random(x01,00002) ZERO(x0000) //ED Cherche SET(x0036,x00ED) LT() JumpForwardIfZero(xF0) //EF Salty Rage SET(x0036,x00EF) LT() JumpForwardIfZero(xF0) //================================= //SHADES OF THE PAST RARE CONSUMABLES //=================================== GoToTarget(xBF) //1 item. //Unless this is post-All-Stars Knights Templar. SETVar(x0000,x0084) If() Random(x01,00002) EndIf() ZERO(x0000) SET(x0029,x0003) //2E Masamune SET(x0036,x002E) LT() JumpForwardIfZero(xF0) //=============================== //ALL-STARS RARE CONSUMABLES //================================ GoToTarget(xC3) //1 item SET(x0029,x0003) //2F Chirijiraden SET(x0036,x002F) LT() JumpForwardIfZero(xF0) //====================================== //ENDGAME RARE WEAPONS //====================================== GoToTarget(xC4) //12 items (C in hex) Random(x01,00012) ZERO(x0000) //1F Nagrarock SET(x0036,x001F) LT() JumpForwardIfZero(xF0) //23 Excalibur SET(x0036,x0023) LT() JumpForwardIfZero(xF0) //24 Ragnarok SET(x0036,x0024) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //25 Chaos Blade SET(x0036,x0025) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //2F Chirijiraden SET(x0036,x002F) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //3A Faith Rod SET(x0036,x003A) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //41 Mace of Zeus SET(x0036,x0041) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //4A Blaze Gun SET(x0036,x004A) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //4B Glacier Gun SET(x0036,x004B) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //4C Blast Gun SET(x0036,x004C) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //5B Perseus Bow SET(x0036,x005B) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //6A Javelin II SET(x0036,x006A) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //===================================== //ENDGAME RARE ARMOR //===================================== GoToTarget(xC5) //8 items Random(x01,00008) ZERO(x0000) //8D Kaiser Plate SET(x0036,x008D) LT() JumpForwardIfZero(xF0) //8E Venetian Shield SET(x0036,x008E) LT() JumpForwardIfZero(xF0) //8F Escutcheon II SET(x0036,x008F) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //9C Grand Helmet SET(x0036,x009C) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //AB Ribbon SET(x0036,x00AB) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //B9 Maximillian SET(x0036,x00B9) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //C7 Rubber Costume SET(x0036,x00C7) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //CF Robe of Lords SET(x0036,x00CF) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //========================= //ENDGAME RARE ACCESSORIES //================================ GoToTarget(xC6) //3 items Random(x01,00003) ZERO(x0000) //EB Vanish Mantle SET(x0036,x00EB) LT() JumpForwardIfZero(xF0) //EC Chantage SET(x0036,x00EC) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //EE Setiemson SET(x0036,x00EE) SUB(x0001,x0001) LT() JumpForwardIfZero(xF0) //=============================== //ENDGAME RARE CONSUMABLES //================================ GoToTarget(xC7) //2 items. Random(x01,00002) ZERO(x0000) SET(x0029,x0003) //2F Chirijiraden SET(x0036,x002F) LT() JumpForwardIfZero(xF0) //2E Masamune SET(x0036,x002E) LT() JumpForwardIfZero(xF0) //=========================== //OF VAGRANTS WEAPONS GoToTarget(x98) //=========================== //2 items. Random(x01,00002) ZERO(x0000) //17 Blood Sword SET(x0036,x0017) LT() JumpForwardIfZero(xF0) //25 Chaos Blade SET(x0036,x0025) LT() JumpForwardIfZero(xF0) //=========================== //OF VAGRANTS ARMOR GoToTarget(x99) //=========================== //2 items. Random(x01,00002) ZERO(x0000) //AB Ribbon SET(x0036,x00AB) LT() JumpForwardIfZero(xF0) //CF Robe Of Lords SET(x0036,x00CF) LT() JumpForwardIfZero(xF0) //=========================== //OF VAGRANTS ACCESSORIES GoToTarget(x9A) //=========================== //2 items. Random(x01,00002) ZERO(x0000) //E9 Dracula Mantle SET(x0036,x00E9) LT() JumpForwardIfZero(xF0) //DE Cursed Ring SET(x0036,x00DE) LT() JumpForwardIfZero(xF0) //=========================== //OF VAGRANTS CONSUMABLES GoToTarget(x9B) //=========================== //2 items. Random(x01,00002) ZERO(x0000) //2E Masamune SET(x0036,x002E) SET(x0029,x0005) LT() JumpForwardIfZero(xF0) //F5 Elixirs SET(x0036,x00F5) SET(x0029,x0019) LT() JumpForwardIfZero(xF0) //=================================================== //THE REST OF THE EVENT. //DON'T TOUCH THIS UNLESS YOU KNOW WHAT YOU'RE DOING. //=================================================== GoToTarget(x00) ZERO(x0080) ZERO(x007D) //Check how many Rendezvous have been unlocked and set the Silver rare variable accordingly. If x7D later turns out to be higher than x7C, we know we're doing an earlier Wheel. //Also, set the bonus gil accordingly while we're at it. We'll start by setting it to a base of 500 (hex 1F4) for Chocobo Defense. SET(x0024,x01F4) SETVar(x0075,x01A6) SETVar(x0074,x01A8) SETVar(x0073,x01A9) SETVar(x0072,x01AA) SETVar(x0071,x01AB) SETVar(x0070,x01AC) SETVar(x0076,x01AD) SETVar(x0077,x01AF) SETVar(x0000,x01B0) //Guarded Temple If() SET(x007D,x00BB) SET(x0080,x0001) SET(x0024,x2710) //All-Star Melee ElseIf(x77) SET(x007D,x00BB) SET(x0080,x0001) SET(x0024,x1D4C) //Shades of the Past ElseIf(x76) SET(x007D,x00BB) SET(x0080,x0001) SET(x0024,x1388) //Littering ElseIf(x70) SET(x007D,x00B7) SET(x0024,x0FA0) //Desert Minefield ElseIf(x71) SET(x007D,x00B3) SET(x0024,x0BB8) //The Fete ElseIf(x72) SET(x007D,x00AF) SET(x0024,x09C4) //Lost Heirloom ElseIf(x73) SET(x007D,x00AB) SET(x0024,x07D0) //Teioh ElseIf(x74) SET(x007D,x00A7) SET(x0024,x05DC) //Chicken Race (Treasure Hunt shares the same unlock) ElseIf(x75) SET(x007D,x00A3) SET(x0024,x03E8) EndIf() //Check Previous ENTD. Switch(x15) //Chapter 1 Skip: Use Chocobo Defense, except set the Chests Left higher. Case(x1000) //Set Var 8F to mark this as the Ch. 1 skip SET(x008F,x0001) //Chocobo Defense. A Silver event. Case(x019B) Case(x0010) SET(x0054,x0003) SET(x0028,x0019) SET(x0001,x009B) SET(x007C,x009F) SET(x002A,x0005) Break() //Chicken Race. A Silver event. Case(x019C) Case(x0011) //Treasure Hunt. A Silver event. Case(x019D) SET(x0054,x0003) SET(x0028,x0032) SET(x0001,x009F) SET(x007C,x00A3) SET(x002a,x000A) Break() //Teioh. A Silver event. Case(x019E) Case(x0012) SET(x0054,x0003) SET(x0028,x0032) SET(x0001,x00A3) SET(x007C,x00A7) SET(x002a,x000A) Break() //Lost Heirloom. Silver. Case(x019F) Case(x0013) SET(x0054,x0003) SET(x0028,x0032) SET(x0001,x00A7) SET(x007C,x00AB) SET(x002a,x000A) Break() //The Fete. A Silver event. Case(x01A0) Case(x0014) SET(x0054,x0003) SET(x0028,x0032) SET(x0001,x00AB) SET(x007C,x00AF) SET(x002a,x000A) Break() //Desert Minefield. A Silver event. Case(x01A1) Case(x0015) SET(x0054,x0003) SET(x0028,x0032) SET(x0001,x00AF) SET(x007C,x00B3) SET(x002A,x000A) Break() //Littering. A Silver event. Case(x01A2) Case(x0016) SET(x0054,x0003) SET(x0028,x0032) SET(x0001,x00B3) SET(x007C,x00B7) SET(x002A,x000A) Break() //Shades of the Past. A Gold event. Case(x01A3) Case(x0017) SET(x0054,x0003) SET(x0028,x000A) SET(x0001,x00B7) SET(x007C,x00BB) SET(x002A,x0005) SET(x0080,x0001) Break() //Knights Templar 1. As it's a battle sequence it gets more chests left & a higher chance of a Gold Chest. Case(x01A4) SET(x0054,x0006) SET(x0028,x0019) SET(x0001,x00B7) SET(x007C,x00BB) SET(x002A,x0005) SET(x0080,x0001) //Has All-Star Melee unlocked? If so, let KT dip into that loot pool, too. SETVar(x0000,x01AF) If() SET(x0084,x0001) EndIf() Break() //All-Star Melee. A Gold event. Case(x01A8) Case(x0018) SET(x0054,x0003) SET(x0028,x000A) SET(x0001,x00B7) SET(x007C,x00BF) SET(x002A,x0005) SET(x0080,x0001) Break() //Nightmares. A Gold event. Case(x01AA) //An Ill Wind. A Gold event. Case(x01B5) SET(x0054,x0003) SET(x0028,x000A) SET(x0001,x00B7) SET(x007C,x00C3) SET(x002A,x0005) SET(x0080,x0001) Break() //The Guarded Temple. A very tough Gold event. Case(x01A9) //Bravestory 1. Gold. Battle sequence. Case(x01AB) Case(x0019) SET(x0054,x000C) SET(x0028,x0032) SET(x0001,x00B7) SET(x007C,x00C3) SET(x002A,x0005) SET(x0080,x0001) Break() //Mirror Match: A dynamic event. Case(x01B7) SET(x0054,x0003) SET(x0028,x000A) SET(x0001,x00B7) SET(x007C,x00C3) SET(x002A,x0005) SET(x0080,x0001) //Was this Round 2? If so, increase chests & rare odds. SETVar(x0000,x00D1) If() SET(x0054,x0006) SET(x0028,x0019) SET(x002A,x000A) EndIf() //Was this Round 3? If so, increase odds further. SETVar(x0000,x00D2) If() SET(x0054,x0009) SET(x0028,x0032) SET(x002A,x0014) EndIf() //Are we in Ch. 4? If so, increase even further beyond SETVar(x0000,x00D3) If() SET(x0054,x000C) SET(x0028,x0064) SET(x002A,x001E) EndIf() Break() //Of Vagrants. Purple event. Zero out x7D while we're here. Case(x001A) Case(x01B8) ZERO(x0028) ZERO(x002A) SET(x0081,x0001) SET(x0080,x0001) SET(x0054,x0006) SET(x0001,x0097) SET(x007C,x0097) ZERO(x007D) Break() Default() //Invalid map. Zero things out. //No Loot Set. Testing purposes? Let the player choose their loot set. Camera(+00590,-04000,+00350,+01500,-00000,+00000,+02048,+00000) Reveal(001) Wait(00002) DisplayMessage(x10,x63,x0001,x90,x00,x00,+00000,+00000,+00000,x03) WaitForInstruction(x01,x00) ADD(x0018,x0010) SETVar(x0015,x0018) //Max out gil. SET(x002C,xFFFF) MULT(x002C,x00FF) GoTo(x00) Break() EndSwitch() //Now replace the value of x0015 with what's stored in x0001. Figured I might as well cut down even more of the variables being used, after all! SETVar(x0015,x0001) //Was this the Ch. 1 skip? If so, set the Chests Left to 12. SETVar(x0000,x008F) If() SET(x0054,x000C) EndIf() //Main loot set determined. But what if the player's in a lower level Wheel? If they are, set x7C to x7D's value, and activate x85. Decrease the odds of rare items & rare chests as well. SETVar(x0000,x007C) SETVar(x0001,x007D) LT() If() SETVar(x007C,x007D) SET(x0085,x0001) SET(x0028,x000A) SET(x002A,x0005) EndIf() //Coloring the field and possibly switching the music depending on the Loot Set. SETVar(x0000,x0081) SETVar(x0001,x0080) If() PlayTrack(x60) ColorField(x02,-003,-008,-002,000) ElseIf(x01) PlayTrack(x5B) ColorField(x02,+001,+001,-003,000) SET(x0083,x0001) Else() PlayTrack(x26) ColorField(x02,+001,+001,+002,000) ZERO(x0083) EndIf() Camera(+00590,-00000,+00350,+01500,-00000,+00000,+02048,+00000) LoadEVTCHR(x00,x6F,x00) WaitForInstruction(x34,x00) SaveEVTCHR(x00) //SaveAddress Pointer (Dialog Text) LUI(x002B,x8016) ADD(x002B,x5EF4) //SaveAddress Pointer (Item Text) SET(x0035,x3800) //SaveAddress Pointer (Inventory) LUI(x0037,x8005) ADD(x0037,x96E0) //SaveAddress Pointer (Unit Stats) LUI(x007F,x8019) ADD(x007F,x08CC) //LoadAddress Pointer (Button Presses) LUI(x0025,x8004) ADD(x0025,x5944) //Set Tribute Cost to 25,000 SET(x0022,x61A8) //Check if Chests Left has been set. SETVar(x0001,x0054) ZERO(x0000) EQ() JumpForwardIfZero(x0B) //Set Chests Left to 3. SET(x0054,x0003) ForwardTarget(x0B) //Set Current Chest to x90. SET(x0023,x0090) //Set x0000 to 12 (C). SET(x0000,x000C) //Set the chests' warp locations, initial sprite location, palette, and unitaddresses. BackTarget(x01) JumpForwardIfZero(x02) ADD(x0000,x008F) AlterParameter(x00,x00) WarpUnit(x90,x00,005,005,x00,x00) AlterParameter(x00,x00) EVTCHRPalette(x90,x00,x00,x01) AlterParameter(x00,x00) SpriteMove(x90,x00,-00010,+00000,-00000,x00,x02,+00000) Wait(00001) SUB(x0000,x0090) JumpBack(x01) ForwardTarget(x02) Reveal(080) UnitAnim(x90,x02,x0202,x00) //put chests in place SpriteMove(x91,x00,-00010,+00000,-00116,x00,x02,+00000) SpriteMove(x92,x00,+00036,-00000,-00092,x00,x02,+00000) SpriteMove(x93,x00,+00074,-00000,-00059,x00,x02,+00000) SpriteMove(x94,x00,+00095,-00000,-00000,x00,x02,+00000) SpriteMove(x95,x00,+00074,-00000,+00054,x00,x02,+00000) SpriteMove(x96,x00,+00036,-00000,+00088,x00,x02,+00000) SpriteMove(x97,x00,-00010,-00000,+00108,x00,x02,+00000) SpriteMove(x98,x00,-00056,-00000,+00088,x00,x02,+00000) SpriteMove(x99,x00,-00090,-00000,+00054,x00,x02,+00000) SpriteMove(x9a,x00,-00112,-00000,-00000,x00,x02,+00000) SpriteMove(x9b,x00,-00090,-00000,-00059,x00,x02,+00000) SpriteMove(x90,x00,-00056,-00000,-00092,x00,x02,+00000) SET(x0070,x0092) SET(x0071,x0093) SET(x0072,x0094) SET(x0073,x0095) SET(x0074,x0096) SET(x0075,x0097) SET(x0076,x0098) SET(x0077,x0099) SET(x0078,x009a) SET(x0079,x009b) SET(x007a,x0090) SET(x007b,x0091) SET(x007D,x000a) Camera(+00590,-00050,+00350,+00400,+00000,+00000,+04096,+00130) Wait(00010) BlockStart() Wait(00010) SoundEffect(x001e) BlockEnd() BackTarget(x4C) AlterParameter(x00,x70) SpriteMove(x90,x00,-00010,+00000,-00116,x00,x02,+00012) AlterParameter(x00,x71) SpriteMove(x91,x00,+00036,-00000,-00092,x00,x02,+00012) AlterParameter(x00,x72) SpriteMove(x92,x00,+00074,-00000,-00059,x00,x02,+00012) AlterParameter(x00,x73) SpriteMove(x93,x00,+00095,-00000,-00000,x00,x02,+00012) AlterParameter(x00,x74) SpriteMove(x94,x00,+00074,-00000,+00054,x00,x02,+00012) AlterParameter(x00,x75) SpriteMove(x95,x00,+00036,-00000,+00088,x00,x02,+00012) AlterParameter(x00,x76) SpriteMove(x96,x00,-00010,-00000,+00108,x00,x02,+00012) AlterParameter(x00,x77) SpriteMove(x97,x00,-00056,-00000,+00088,x00,x02,+00012) AlterParameter(x00,x78) SpriteMove(x98,x00,-00090,-00000,+00054,x00,x02,+00012) AlterParameter(x00,x79) SpriteMove(x99,x00,-00112,-00000,-00000,x00,x02,+00012) AlterParameter(x00,x7A) SpriteMove(x9a,x00,-00090,-00000,-00059,x00,x02,+00012) AlterParameter(x00,x7B) SpriteMove(x9b,x00,-00056,-00000,-00092,x00,x02,+00012) WaitSpriteMove(x90,x00) SETVar(x0000,x007D) JumpForwardIfZero(x4D) SUB(x007D,x0001) ADD(x0070,x0001) ADD(x0071,x0001) ADD(x0072,x0001) ADD(x0073,x0001) ADD(x0074,x0001) ADD(x0075,x0001) ADD(x0076,x0001) ADD(x0077,x0001) ADD(x0078,x0001) ADD(x0079,x0001) ADD(x007a,x0001) ADD(x007b,x0001) SET(x0001,x009B) SETVar(x0000,x0070) GT() JumpForwardIfZero(x40) SUB(x0070,x000C) ForwardTarget(x40) SETVar(x0000,x0071) GT() JumpForwardIfZero(x41) SUB(x0071,x000C) ForwardTarget(x41) SETVar(x0000,x0072) GT() JumpForwardIfZero(x42) SUB(x0072,x000C) ForwardTarget(x42) SETVar(x0000,x0073) GT() JumpForwardIfZero(x43) SUB(x0073,x000C) ForwardTarget(x43) SETVar(x0000,x0074) GT() JumpForwardIfZero(x44) SUB(x0074,x000C) ForwardTarget(x44) SETVar(x0000,x0075) GT() JumpForwardIfZero(x45) SUB(x0075,x000C) ForwardTarget(x45) SETVar(x0000,x0076) GT() JumpForwardIfZero(x46) SUB(x0076,x000C) ForwardTarget(x46) SETVar(x0000,x0077) GT() JumpForwardIfZero(x47) SUB(x0077,x000C) ForwardTarget(x47) SETVar(x0000,x0078) GT() JumpForwardIfZero(x48) SUB(x0078,x000C) ForwardTarget(x48) SETVar(x0000,x0079) GT() JumpForwardIfZero(x49) SUB(x0079,x000C) ForwardTarget(x49) SETVar(x0000,x007A) GT() JumpForwardIfZero(x4a) SUB(x007A,x000C) ForwardTarget(x4a) SETVar(x0000,x007B) GT() JumpForwardIfZero(x4b) SUB(x007b,x000C) ForwardTarget(x4b) JumpBack(x4C) ForwardTarget(x4D) //Save the value for Chests Left to text. SaveAddress(x54,x0000,x2B,004) DisplayMessage(x10,x81,x0006,x90,x00,x00,-00000,-00022,+00000,x00) SoundEffect(x0047) UnitAnim(x02,x02,x0201,x00) Wait(00003) UnitAnim(x02,x02,x0200,x00) Wait(00003) EVTCHRPalette(x90,x00,x00,x02) EVTCHRPalette(x91,x00,x00,x02) EVTCHRPalette(x92,x00,x00,x02) EVTCHRPalette(x93,x00,x00,x03) EVTCHRPalette(x94,x00,x00,x03) EVTCHRPalette(x95,x00,x00,x03) EVTCHRPalette(x96,x00,x00,x04) EVTCHRPalette(x97,x00,x00,x04) EVTCHRPalette(x98,x00,x00,x04) EVTCHRPalette(x99,x00,x00,x05) EVTCHRPalette(x9a,x00,x00,x05) EVTCHRPalette(x9b,x00,x00,x05) UnitAnim(x02,x02,x0201,x00) Wait(00003) UnitAnim(x02,x02,x0202,x00) Wait(00015) //Set all chests' status using variables 70-7B. 0 empty, 1 Weapon, 2 Armor, 3 Accessory, 4 Consumable, and then 5-8 repeating 1-4 but Rare. At the moment, nothing will be triggered Rare or Empty. SET(x0070,x0001) SET(x0071,x0001) SET(x0072,x0001) SET(x0073,x0002) SET(x0074,x0002) SET(x0075,x0002) SET(x0076,x0003) SET(x0077,x0003) SET(x0078,x0003) SET(x0079,x0004) SET(x007a,x0004) SET(x007b,x0004) //Check to see if we spawn any Rare Chests. //First, is this Of Vagrants? No rares there. Skip this. SETVar(x0000,x0081) If() JumpForward(x09) EndIf() //Will it be silver or gold? Gold is if it's a Rare item (only in Chapter 4), whereas silver is if it's just a later common item (previous chapters). SETVar(x0000,x0080) If() //Set x18 to 7, the value of the gold palette. SET(x0018,x0007) Else() //Set x18 to 6, the value of the silver palette. SET(x0018,x0006) EndIf() //Do the RNG calculation. Random(x01,00100) SETVar(x0000,x0028) GT() JumpForwardIfZero(x09) //Rare chest confirmed. Wait(00020) SoundEffect(x000A) //Which of the 12 will it be? Random(x00,00012) ADD(x0000,x0090) //Set the palette of the chest. Use AlterParameter to set the unit ID & the palette color. AlterParameter(x00,x00) AlterParameter(x03,x18) EVTCHRPalette(x9B,x00,x00,x0F) //Make the chest animate. AlterParameter(x00,x00) UnitAnim(x9B,x00,x0201,x00) Wait(00003) AlterParameter(x00,x00) UnitAnim(x9b,x00,x0200,x00) Wait(00006) AlterParameter(x00,x00) UnitAnim(x9B,x00,x0201,x00) Wait(00003) AlterParameter(x00,x00) UnitAnim(x9b,x00,x0202,x00) //Add 4 to the chest type. SUB(x0000,x0020) AlterParameter(x40,x00) ADD(x0070,x0004) //Reset Rare Chest Odds to 5%. Used for Tribute payments later. SET(x0028,x0005) ForwardTarget(x09) //Save their Chest Types to their PA. SET(x0018,x000B) SET(x007D,x0070) BackTarget(x04) AlterParameter(x00,x7D) SaveAddress(x70,x0036,x7F,001) //Get the loot set jumps set to their Current MA, and rares to their original MA. SET(x0000,x0005) AlterParameter(x42,x7D) SETVar(x0001,xFFFF) LTE() If() SUB(x0001,x0004) EndIf() //Check if this is a Consumable and we're in a lower level Wheel. If so, set this jump to match Chocobo Defense's Consumables. SET(x0000,x0004) EQ() If() SETVar(x0000,x0085) If() SET(x0000,x009F) EndIf() EndIf() //If either of the above results was No, then var x00 will have a value of zero. Otherwise, we'll skip setting the base jump location here. If() Else() //Var x15 has the base jump location. Add x01 to it. SETVar(x0000,x0015) ADDVar(x0000,x0001) EndIf() SaveAddress(x00,x0037,x7F,001) //Var x7C has the base rare jump location. Add x01 to it. SETVar(x0000,x007C) ADDVar(x0000,x0001) SaveAddress(x00,x0031,x7F,001) SETVar(x0000,x0018) If() SUB(x0018,x0001) ADD(x007D,x0001) ADD(x007F,x01C0) JumpBack(x04) EndIf() //Are we in Chapter 4 with sufficient gil, and this isn't Of Vagrants? Display the message letting players know how to pay tribute. SETVar(x0000,x0081) Not() If() SETVar(x0000,x0080) If() SETVar(x0001,x002C) SETVar(x0000,x0022) LTE() If() SetTextVal(x00,x0007) //Can the player cash out for JP? Add that to this message. SETVar(x0000,x01B0) If() SetTextVal(x00,x0013) EndIf() SetTextVar(x01,x22) DisplayMessage(x10,x63,x0009,x90,x00,x00,+00000,+00000,+00000,x03) WaitForInstruction(x01,x00) EndIf() EndIf() EndIf() //The backtarget for what goes on after setting the chests to move. BackTarget(x10) //Set x0001 to match the Current Chest #. SETVar(x0001,x0023) //Check if the Current Chest # is higher than 9B. If so that means it's time to loop it back around to 90. SET(x0000,x009C) LTE() JumpForwardIfZero(x11) SET(x0023,x0090) JumpForward(x12) //Check if it's less than 90. If so, that means it's time to loop it back around to x0B ForwardTarget(x11) SET(x0000,x0090) GT() JumpForwardIfZero(x12) SET(x0023,x009B) ForwardTarget(x12) //Set the parameters. SETVar(x0000,x0023) SETVar(x0070,x0000) ADD(x0000,x0001) SETVar(x0071,x0000) ADD(x0000,x0001) SETVar(x0072,x0000) ADD(x0000,x0001) SETVar(x0073,x0000) ADD(x0000,x0001) SETVar(x0074,x0000) ADD(x0000,x0001) SETVar(x0075,x0000) ADD(x0000,x0001) SETVar(x0076,x0000) ADD(x0000,x0001) SETVar(x0077,x0000) ADD(x0000,x0001) SETVar(x0078,x0000) ADD(x0000,x0001) SETVar(x0079,x0000) ADD(x0000,x0001) SETVar(x007A,x0000) ADD(x0000,x0001) SETVar(x007b,x0000) ADD(x0000,x0001) SETVar(x0000,x0023) SUB(x0000,x0090) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x007B,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x007A,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x0079,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x0078,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x0077,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x0076,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x0075,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x0074,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x0073,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x0072,x000C) JumpForwardIfZero(x13) SUB(x0000,x0001) SUB(x0071,x000C) ForwardTarget(x13) AlterParameter(x00,x70) SpriteMove(x90,x00,-00010,+00000,-00116,x00,x02,+00010) AlterParameter(x00,x71) SpriteMove(x91,x00,+00036,-00000,-00092,x00,x02,+00010) AlterParameter(x00,x72) SpriteMove(x92,x00,+00074,-00000,-00059,x00,x02,+00010) AlterParameter(x00,x73) SpriteMove(x93,x00,+00095,-00000,-00000,x00,x02,+00010) AlterParameter(x00,x74) SpriteMove(x94,x00,+00074,-00000,+00054,x00,x02,+00010) AlterParameter(x00,x75) SpriteMove(x95,x00,+00036,-00000,+00088,x00,x02,+00010) AlterParameter(x00,x76) SpriteMove(x96,x00,-00010,-00000,+00108,x00,x02,+00010) AlterParameter(x00,x77) SpriteMove(x97,x00,-00056,-00000,+00088,x00,x02,+00010) AlterParameter(x00,x78) SpriteMove(x98,x00,-00090,-00000,+00054,x00,x02,+00010) AlterParameter(x00,x79) SpriteMove(x99,x00,-00112,-00000,-00000,x00,x02,+00010) AlterParameter(x00,x7A) SpriteMove(x9a,x00,-00090,-00000,-00059,x00,x02,+00010) AlterParameter(x00,x7b) SpriteMove(x9b,x00,-00056,-00000,-00092,x00,x02,+00010) WaitSpriteMove(x90,x00) //Check if the player is holding Left or Right. If so, skip this. LoadAddress(x01,x0000,x25,004) SET(x0000,x2000) NEQ() JumpForwardIfZero(x14) SET(x0000,x8000) NEQ() JumpForwardIfZero(x14) //Save the words to set up the current Chest Type. BackTarget(x17) //Extract the Current Chest Type from the current chest's PA. AlterParameter(x00,x23) UnitAddress(x00,x7F) LoadAddress(x34,x0036,x7F,001) //Rare or blank: Set x0018 to 7, the eighth dialogue message here. Do a check to see if it's rare and, if so, subtract 1 from x0018, setting it to 7 instead. Also, subtract 4 from x0001 for the next section. SET(x0018,x0007) SETVar(x0001,x0034) SET(x0000,x0004) LT() If() SUB(x0018,x0001) SUB(x0001,x0004) EndIf() ZERO(x0000) EQ() If() LoadAddress(x01,x002A,x7F,002) ADD(x0001,x3800) EndIf() SaveAddress(x18,x0000,x2B,004) //Now save x0001 to text. SaveAddress(x01,x0004,x2B,004) WaitForInstruction(x01,x00) DisplayMessage(x10,x82,x000A,x90,x00,x00,-00000,+00092,+00000,x00) WaitForInstruction(x01,x00) ForwardTarget(x14) //===================================== //BUTTON PRESSES (x20s) //===================================== // 0x8000 Left // 0x4000 Down // 0x2000 Right // 0x1000 Up // 0x0800 Start // 0x0400 R3 // 0x0200 L3 // 0x0100 Select // 0x0080 Square // 0x0040 Cross (X) // 0x0020 Circle // 0x0010 Triangle // 0x0008 R1 // 0x0004 L1 // 0x0002 R2 // 0x0001 L2 BackTarget(x20) LoadAddress(x01,x0000,x25,004) Switch(x01) //Check if Left. Case(x8000) SUB(x0023,x0001) //Jump into the Right section to continue. JumpForward(x22) Break() //Right? Case(x2000) ADD(x0023,x0001) //Jump from the Left section. ForwardTarget(x22) SoundEffect(x0003) //Close Current Chest text. ChangeDialog(x02,xFFFF,x00,x00) JumpBack(x10) Break() //Square (Music)? Case(x0080) //Don't switch if this is Of Vagrants. SETVar(x0000,x0081) SETVar(x0001,x0083) If() ElseIf(x01) PlayTrack(x26) ZERO(x0083) Else() PlayTrack(x5B) SET(x0083,x0001) EndIf() Wait(00020) JumpBack(x20) Break() //Start (Cash In?) Case(x0800) //If Guarded Temple is unlocked (and we're in NG+), allow cashing in for JP. SetTextVal(x00,x0007) SETVar(x0000,x01B0) If() SetTextVal(x00,x0012) EndIf() DisplayMessage(x10,x63,x000D,x90,x00,x00,+00000,+00000,+00000,x03) WaitForInstruction(x01,x00) SETVar(x0000,x0018) If() //-------------------------------------------------------------- //Cashing in. Save the value for the correct message to the text variable SETVar(x0001,x0018) ADD(x0001,x000D) SetTextVar(x01,x01) //How much will we cash in for? SUB(x0000,x0001) //Store the Gil/JP choice in x86. SETVar(x0086,x0000) //JP: If() SET(x0001,x0032) //Gil: Else() SETVar(x0001,x0024) EndIf() MULTVar(x0001,x0054) SetTextVar(x00,x01) DisplayMessage(x10,x63,x000E,x90,x00,x00,+00000,+00000,+00000,x03) WaitForInstruction(x01,x00) SETVar(x0000,x0018) If() SETVar(x0000,x0086) //Cash in JP: If() SETVar(x0018,x0001) SoundEffect(x0098) DisplayMessage(x10,x63,x0011,x90,x00,x00,+00000,+00000,+00000,x03) WaitForInstruction(x01,x00) JumpForward(xFE) //Cash in Gil: Else() ADDVar(x0001,x002C) LUI(x0000,x05F5) ADD(x0000,xE0FF) LT() If() LUI(x0001,x05F5) ADD(x0001,xE0FF) EndIf() SETVar(x002C,x0001) SetTextVar(x02,x01) SoundEffect(x0097) DisplayMessage(x10,x63,x0012,x90,x00,x00,+00000,+00000,+00000,x03) WaitForInstruction(x01,x00) JumpForward(xFF) EndIf() EndIf() EndIf() //---------------------------------------------------------------- SoundEffect(x0002) Wait(00020) JumpBack(x20) Break() //Cross or Circle (Open)? Case(x0040) Case(x0020) //Make sure the chest isn't empty already. ZERO(x0000) SETVar(x0001,x0034) NEQ() JumpForwardIfZero(x28) //The chest isn't empty. Let's open it up! JumpForward(x2A) Break() //Triangle? Case(x0010) //Is this Of Vagrants? SETVar(x0000,x0081) If() JumpForward(x2C) EndIf() //Is this chest empty? SETVar(x0000,x0034) JumpForwardIfZero(x2C) //Check if this chest is rare. SET(x0001,x0005) LT() JumpForwardIfZero(x2C) //This chest is common. Are we in a Chapter 4 event? SETVar(x0000,x0080) JumpForwardIfZero(x2C) //Does the player have enough gil? SETVar(x0000,x0022) SETVar(x0001,x002C) LTE() JumpForwardIfZero(x2C) //We're in a Chapter 4 event with no Gold Chest. Offer the player the option to pay gil. SaveAddress(x28,x0000,x2B,004) SaveAddress(x2C,x0004,x2B,004) SaveAddress(x22,x0008,x2B,004) DisplayMessage(x10,x63,x000C,x90,x00,x00,+00000,+00000,+00000,x03) WaitForInstruction(x01,x00) SETVar(x0000,x0018) JumpForwardIfZero(x2C) SoundEffect(x0097) Wait(00010) SUBVar(x002C,x0022) MULT(x0028,x0002) Random(x01,00100) SETVar(x0000,x0028) GT() JumpForwardIfZero(x2C) //Gold chest generated. Turn the current chest into a Gold. //Erase current chest dialogue. ChangeDialog(x02,xFFFF,x00,x00) SoundEffect(x000A) //Reset Gold Chest odds to 5%. SET(x0028,x0005) //Add 4 to the Current Chest Type and save it to the current chest's PA. ADD(x0034,x0004) SaveAddress(x34,x0036,x7F,001) //Set the palette of the chest. Use AlterParameter to set the unit ID. AlterParameter(x00,x23) EVTCHRPalette(x9B,x00,x00,x07) //Make the chest animate. AlterParameter(x00,x23) UnitAnim(x9B,x00,x0201,x00) Wait(00003) AlterParameter(x00,x23) UnitAnim(x9b,x00,x0200,x00) Wait(00006) AlterParameter(x00,x23) UnitAnim(x9B,x00,x0201,x00) Wait(00003) AlterParameter(x00,x23) UnitAnim(x9b,x00,x0202,x00) JumpBack(x17) ForwardTarget(x2C) SoundEffect(x0005) AlterParameter(x00,x23) ColorUnit(x90,x00,x00,+060,-060,-060,002) Wait(00010) AlterParameter(x00,x23) ColorUnit(x90,x00,x04,+000,+000,+000,002) Wait(00010) Break() //Checks failed Default() Break() EndSwitch() Wait(00001) JumpBack(x20) //================================= //END BUTTON PRESSES //================================= //==================================== //DETERMINING LOOT SUBSET (x30s,xA0s) //==================================== //Player is opening a chest. ForwardTarget(x2A) //Set Number Of Items to a default of 01. SET(x0029,x0001) ChangeDialog(x01,xFFFF,x00,x00) ChangeDialog(x02,xFFFF,x00,x00) //Subtract 1 from Chests Left. SUB(x0054,x0001) //Zero var x82. Then generate a random number and check if we'll proc a rare. ZERO(x0082) Random(x00,00100) SETVar(x0001,x002A) LT() If() SET(x0082,x0001) EndIf() //Also, check if this is a rare chest. SET(x0000,x0004) SETVar(x0001,x0034) LT() If() //It is. Set x0082 to 1. SET(x0082,x0001) EndIf() SETVar(x0000,x0082) If() //We got a rare. Change the color by setting the value to a base of Silver color, adding +1 if this is a Gold wheel, applying it to the Current Chest. Then play the rare item sound, and load the unit's ORIGINAL MA. SET(x0001,x0006) ADDVar(x0001,x0080) AlterParameter(x00,x23) AlterParameter(x03,x01) EVTCHRPalette(xFF,x00,x00,xFF) SoundEffect(x00A7) LoadAddress(x18,x0031,x7F,001) Else() //Loot is common loot. Play regular opening sound. SoundEffect(x004C) LoadAddress(x18,x0037,x7F,001) EndIf() //Zero x0001 to make sure that we can do more dynamic loot sets. ZERO(x0001) AlterParameter(x00,x18) GoTo(xFF) //The ForwardTarget for jumping out of the RNG result for the loot. ForwardTarget(xF0) ADDVar(x0037,x0036) ADDVar(x0035,x0036) WaitForInstruction(x01,x00) SetTextVar(x00,x35) SetTextVar(x01,x29) //SaveAddress(x35,x0000,x2B,004) //SaveAddress(x29,x0004,x2B,004) //LoadAddress(x01,x0000,x37,001) //ADDVar(x0001,x0029) AlterParameter(x01,x36) Inventory(x2A,x00,x29) AlterParameter(x01,x36) Inventory(x28,x00,x01) //SET(x0000,x003C) //LTE() //JumpForwardIfZero(x2B) //SET(x0001,x003B) //ForwardTarget(x2B) //SaveAddress(x01,x0000,x37,001) SetTextVar(x02,x01) //SaveAddress(x01,x0008,x2B,004) CallSub(x01) DefineSub(x01) DisplayMessage(x10,x63,x000b,x90,x00,x00,+00000,+00000,+00000,x03) EndSub() //Check which chest this is and set the animations accordingly. Also, set its type to Empty. SETVar(x0001,x0023) AlterParameter(x00,x01) UnitAnim(x90,x00,x0203,x00) Wait(00003) AlterParameter(x00,x01) UnitAnim(x90,x00,x0204,x00) Wait(00003) AlterParameter(x00,x01) UnitAnim(x90,x00,x0205,x00) Wait(00003) AlterParameter(x00,x01) UnitAnim(x90,x00,x0206,x00) Wait(00003) AlterParameter(x00,x01) UnitAnim(x90,x00,x0207,x00) Wait(00001) //Save Chests Left to text and display the message. SetTextVar(x00,x54) //SaveAddress(x54,x0000,x2B,004) DisplayMessage(x10,x81,x0006,x90,x00,x00,-00000,-00022,+00000,x00) ZERO(x0034) SaveAddress(x34,x0036,x7F,001) SUBVar(x0037,x0036) SUBVar(x0035,x0036) SaveAddress(x36,x002A,x7F,002) SETVar(x0000,x0054) JumpForwardIfZero(xFF) //Display looted item name at the bottom. LoadAddress(x01,x002A,x7F,002) ADD(x0001,x3800) WaitForInstruction(x01,x00) SET(x0000,x0007) SaveAddress(x00,x0000,x2B,004) SaveAddress(x01,x0004,x2B,004) DisplayMessage(x10,x82,x000A,x90,x00,x00,-00000,+00092,+00000,x00) WaitForInstruction(x01,x00) JumpBack(x20) //Chest was empty, play a sound and bow out. ForwardTarget(x28) SoundEffect(x0005) AlterParameter(x00,x23) ColorUnit(x90,x00,x00,+127,-127,-127,002) AlterParameter(x00,x23) UnitAnim(x90,x00,x0206,x00) Wait(00002) AlterParameter(x00,x23) UnitAnim(x90,x00,x0205,x00) Wait(00002) AlterParameter(x00,x23) ColorUnit(x90,x00,x04,+000,+000,+000,002) AlterParameter(x00,x23) UnitAnim(x90,x00,x0206,x00) Wait(00002) AlterParameter(x00,x23) UnitAnim(x90,x00,x0207,x00) Wait(00020) JumpBack(x20) //============================ //START BONUS JP //============================= ForwardTarget(xFE) //Setting Variable x0070 to point at the first unit in the Formation. LUI(x0070,x8005) ADD(x0070,x7F74) //Setting Variable x0072 to point at the last guest slot in the Formation. LUI(x0072,x8005) ADD(x0072,x9274) //The BackTarget used for every jump back after one unit's JP has been altered. BackTarget(x90) //Checking if the unit is a Monster, and skipping them if so. LoadAddress(x00,x0004,x70,001) //The Monster bit in the Gender Byte is x20. We'll do an AND check. If it succeeds, the result will be a value of 20. If it fails - the unit is not a monster - the result will be 0. AND(x0000,x0020) //Does the final result have a value? If so, it's a monster. Apply EXP instead of JP. If() LoadAddress(x01,x0015,x70,001) ADDVar(x0001,x0018) //Check if the value for EXP is now greater than 99. If so, cap it. SET(x0000,x0064) LTE() If() SET(x0001,x0063) EndIf() SaveAddress(x01,x0015,x70,001) JumpForward(x9A) EndIf() //This LoadAddress checks the unit's Job ID to determine which job the JP would go to. LoadAddress(x01,x0002,x70,001) //We're going to default to aim JP at the Base Job. This is Squire for a generic unit, but for a special unit, this is their special job. However, the Job ID does NOT just share the Squire ID the same way the JP does. Which means the simplest thing to do is to rule out whether or not the unit has a non-generic, non-base job, using the base job if they do, and doing a little extra if they don't. //Anyway, here's the base job current JP location in World Stats: SET(x0071,x006E) //First, let's just see if there even IS a job. I'm not mucking about with that data if there's no unit there. So for comparison, I'll zero out x0000 and see if x0001 does NOT equal it. If it doesn't not equal it - meaning, if it equals it - meaning, if its value is zero - we'll jump this whole thing. ZERO(x0000) NEQ() JumpForwardIfZero(x9A) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //DK Hack Jobs (slots 37 & 38) //~~~~~~~~~~~~~~~~~~~~~~~~~~~ //With the DK hack in TLW, jobs 37 and 38 are used for the Female and Male Dark Knights, respectively. We'll check for them specifically by setting x0000 to a value of 37/38, jumping to the next check if they are not equal. If they are equal, we'll set x0071 to a value of 90 or 92, respectively (Bard/Dancer job JP), then jump over the rest of the checks. SET(x0000,x0037) EQ() If() //This is a female DK. Set x0071 to point at Bard JP. SET(x0071,x0090) JumpForward(x91) EndIf() //This was not a female DK. Is it a male DK? SET(x0000,x0038) EQ() If() //This is a male DK. Set x0071 to point at Dancer JP. SET(x0071,x0092) JumpForward(x91) EndIf() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //This was neither DK. Continue on with the rest. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Check to see if the job is in the range for a non-Squire generic job. This starts with Chemist at 4B and goes to Mime at 5D. //So x0000 will be set to 4A, then we'll check if x0000 is Less Than x0001's value. If it isn't, that means the unit's current job is something between 00-4A - so this will be for Base Job JP, and we'll jump forward to that target. SET(x0000,x004A) LT() JumpForwardIfZero(x91) //x0000's value was less than x0001's. Now we need to check if the unit has a job AFTER the generic jobs. Mime was 5D, so we'll use 5E, and see if it's Greater Than. SET(x0000,x005E) GT() JumpForwardIfZero(x91) //x0000's new value was higher than x0001's. This means the unit is in a non-base job. However, each individual job's JP takes TWO bytes, meaning that instead of something like x70 Chemist and x71 Knight, it's x70 Chemist and x72 Knight. So we need to double the numbers to aim it correctly at the proper job's JP. But in order to do that, we need to first set Chemist as the base 0, then double the value. //So. If Chemist is to be zero, and Chemist is 4B - then subtract 4B. SUB(x0001,x004B) //Now we have a range of 00 Chemist, 01 Knight, 02 Archer, 03 Monk, etc. We need that to be doubled. MULT(x0001,x0002) //00 Chemist, 02 Knight, 04 Archer, 06 Monk, etc. //Now, these non-base jobs' Current JP starts at x70. So add x70. ADD(x0001,x0070) //That will do it. Now we set x0071's value to x0001's. SETVar(x0071,x0001) //And if it was a base job, this is the jump point that would have skipped all that process and just gone with the default Base Job JP location. ForwardTarget(x91) BackTarget(x91) //Now we need to load the value of this JP. AlterParameter will be used to make sure we get the correct job's JP. AlterParameter(x41,x71) LoadAddress(x01,x0000,x70,002) //Adding JP according to the value stored in Variable x0018. ADDVar(x0001,x0018) AlterParameter(x41,x71) SaveAddress(x01,x0000,x70,002) //And that's current JP. Now for total JP. Base job total JP is at x96, and base job current JP was at x6E. That's a hex value of 28. So add 28. ADD(x0071,x0028) //But, if we already did this, let's get out now. Mime Total JP is at BC, so check if this value is now BD or higher. SET(x0000,x00BD) SETVar(x0001,x0071) GT() If() JumpBack(x91) EndIf() ForwardTarget(x9A) //So now we check which unit we were on. If the current unit and final unit variables don't not match (i.e., they do match), we're done here. If they DO not match, we add 100 to the value and jump back. SETVar(x0000,x0070) SETVar(x0001,x0072) NEQ() If() ADD(x0070,x0100) JumpBack(x90) EndIf() //==================================== //END BONUS JP //==================================== //END OF EVENT ForwardTarget(xFF) WaitForInstruction(x01,x00) ChangeDialog(x01,xFFFF,x00,x00) ChangeDialog(x02,xFFFF,x00,x00) WaitForInstruction(x01,x00) Camera(+00590,-00600,+00350,+00100,+00000,+00000,+02048,+00100) FadeSound(x00,180) ColorScreen(x02,000,000,000,255,255,255,+00110) WaitForInstruction(x04,x00) //Was this the Ch. 1 skip? If so, do a custom PostEvent. SETVar(x0000,x008F) If() PostEvent(x81,x001B) Else() PostEvent(x80,x0000) EndIf() PlayTrack(x00) EventEnd() //INSTRUCTION SECTION END - TEXT START //01 Loot Set:{br} {FB}1{br} 2{br} 3{br} 4{br} 5{br} 6{br} 7{br} {font:08}8{br} 9{br} 10{br} {font:04}11{FC}{close} //02 Weapon{end} //03 Armor{end} //04 Accessory{end} //05 Consumables{end} //06 {delay:00}{E4} left.{br} Start: Cash In{end} //07 Rare {end} //08, blank message {end} //09 {EB}Chapter 4 Feature:{br} Press {D9C7} to pay gil to{br} attempt to turn the current{br} chest into a Gold Chest.{br} Requires {E4} gil.{end} //x0A {delay:00}{EB}{EB}{end} //x0b Received '{EB}' x{E4}!{br} Total: {E4}.{end} //x0C Gold Chest odds: {E4}%{br} Gil: {E4}{br} Pay {E4} gil to double{br} odds and try again?{br} {FB}No{br} Yes{FC}{close} //x0D Cash in remaining chests?{br} {FB}No{br} For Gil{EB}{FC}{close} //0E Collect {E4} {EB}?{br} {FB}No{br} Yes{FC}{close} //0F Gil{end} //10 JP{end} //11 All units earned{br} {E4} {EB}!{end} //12 Collected {E4} {EB}!{br} Total: {E4}.{end} //13 {br}For JP{end} //14 Postgame Feature:{br} Cash in for JP!{br}{end}