User File #47905649263676431

Upload All User Files

#47905649263676431 - Updated Lua comments FF9 any%

comment.lua
1008 downloads
Uploaded 6/19/2018 10:15 AM by Lil_Gecko (see all 3)
Changed :
Line 504 Line 797
Added :
Line 1019
function Dec2Hex(nValue)
	if type(nValue) == "string" then
		nValue = String.ToNumber(nValue);
	end;
	nHexVal = string.format("%X", nValue);
	sHexVal = nHexVal.."";
	return sHexVal;
end;

function comments(debut,fin,line1,line2,line3,line4,line5,line6,line7,line8,PRNG)
	if emu.framecount()>debut and emu.framecount()<fin
		then gui.drawText(700,140,line1,"White","",18,"Times New Roman");
			 gui.drawText(700,165,line2,"White","",18,"Times New Roman");
			 gui.drawText(700,190,line3,"White","",18,"Times New Roman");
			 gui.drawText(700,215,line4,"White","",18,"Times New Roman");
			 gui.drawText(700,240,line5,"White","",18,"Times New Roman");
			 gui.drawText(700,265,line6,"White","",18,"Times New Roman");
			 gui.drawText(700,290,line7,"White","",18,"Times New Roman");
			 gui.drawText(700,315,line8,"White","",18,"Times New Roman");
			 gui.drawText(700,390,PRNG,"White","",18,"Times New Roman");
	end;
	return
end;

function battle(debut2,fin2,name,despawn,hpmax,speed,pos)

local hp;
local hp2;
local hp3;

if despawn then hp = memory.read_u16_le(0x109264+(pos-1)*208)-10000
	if memory.read_u16_le(0x109264+(pos-1)*208)<10000 then hp=0;
	end;
else
hp=memory.read_u16_le(0x109264+(pos-1)*208)
end;


 if emu.framecount()>debut2 and emu.framecount()<fin2 then
 gui.drawText(700+(pos-1)*200,380,name,"White","",18,"Times New Roman");
 gui.drawText(700+(pos-1)*200,405,"HP = "..hp.."/"..hpmax,"White","",18,"Times New Roman");
 gui.drawRectangle(700+(pos-1)*200,430,102,25,"White");
 gui.drawRectangle(701+(pos-1)*200,431,((memory.read_u16_le(0x109268+(pos-1)*208))/speed)*100,23,"Green","Green");
 end;

end;

function DrawRNG()

local RNG;
local heightbar;
local Color;

for i=-20,20 do

RNG= memory.read_u32_le(0x7b720)-0x80000000+i;




if RNG < 0x7b724 then
heightbar = 0;
end;

if RNG > 0x7b92d then
heightbar = 0;
end;

if (RNG>=0x7b724) and (RNG<=0x7b92d) then
heightbar = memory.readbyte(RNG)+2;
end;




if emu.framecount()>1205 then
gui.drawRectangle(1005,487,5,128,"Green","Green");
end;

if heightbar-2 <16 then Color="Yellow"
else if heightbar-2==79 then Color="Pink";
elseif  heightbar-2==165 or heightbar-2==172 or heightbar-2==179 or heightbar-2==186  then Color="Brown";
elseif heightbar-2==86 or heightbar-2==93 or heightbar-2==100 or  heightbar-2==193 or heightbar-2==200 then Color="Blue";
else Color="Purple";
end;
end;

if emu.framecount()> 1340329 and emu.framecount()< 1341000 then

if (heightbar-2)%100==0 or ((((heightbar-2)%100)%7==2) and (((heightbar-2))%100>35)) then Color="Red"
end;
end;

if emu.framecount()> 1429700 and emu.framecount()< 1431300 then

if (heightbar-2)%100==0 or ((((heightbar-2)%100)%7==2) and (((heightbar-2))%100>35)) then Color="Red"
end;
end;

 gui.drawRectangle((i+20)*15+700,(615-heightbar/2),15,heightbar/2,"White",Color);

end;
end;


 a=0;
 b=1;
 c=0;
 d=0;
 temps=0;
 Danger = 0;
 EncounterCheck=0;

while true do


 client.SetGameExtraPadding(-60,0,612,152);
gui.drawImage('a.png',680,0);

if emu.framecount()<13000 then
DrawRNG();
else
if memory.readbyte(0x7AED2)==7 then
DrawRNG();
else
gui.drawText(700,500,"Current Random Number Pointer Position => 0x0"..Dec2Hex(memory.read_u32_le(0x7b720)-0x80000000).."  Value = "..memory.readbyte(memory.read_u32_le(0x7b720)-0x80000000),"White","",18,"Times New Roman");



for i=0,521 do

local curpos = memory.read_u32_le(0x7b720)-0x8007B724;
local curcolor="White";

if i == curpos then curcolor="White" else curcolor="Green" end;

if i<80 then
gui.drawText(700+7*i,525,memory.readbyte(0x7B724+i),curcolor,"",6)
elseif i<160 then
gui.drawText(700+7*(i-80),540,memory.readbyte(0x7B724+i),curcolor,"",6)
elseif i<240 then
gui.drawText(700+7*(i-160),555,memory.readbyte(0x7B724+i),curcolor,"",6)
elseif i<320 then
gui.drawText(700+7*(i-240),570,memory.readbyte(0x7B724+i),curcolor,"",6)
elseif i<400 then
gui.drawText(700+7*(i-320),585,memory.readbyte(0x7B724+i),curcolor,"",6)
elseif i<480 then
gui.drawText(700+7*(i-400),600,memory.readbyte(0x7B724+i),curcolor,"",6)
else
gui.drawText(700+7*(i-480),615,memory.readbyte(0x7B724+i),curcolor,"",6)
end;
end;

end;
end;
 --TEXT INFOS
 
 if emu.framecount() < 1400 then

 gui.drawImage('a.png',680,0);
gui.drawText(900,185,"This is a Tool Assisted Speedrun","White","",16,"AR Julian");
gui.drawText(855,210,"For more details, visit http://tasvideos.org","White","",16,"AR Julian");
gui.drawText(839,235,"Final Hit on Necron (In-Game Time) : 7:48:29.67","White","",16,"AR Julian");
gui.drawText(928,260,"Rerecords : 240 541","White","",16,"AR Julian");


else


if memory.read_u16_le(0x7ae50)>Danger then
EncounterCheck=EncounterCheck+1;
Danger=memory.read_u16_le(0x7ae50);
end;

if memory.read_u16_le(0x7ae50)==0 then
EncounterCheck=0;
Danger=0;
end;

EncounterOdds=memory.read_u16_le(0x7ae50);

gui.drawText(700,10,"Random Encounters :     Encounter Checks : "..EncounterCheck,"White","",16,"AR Julian");
gui.drawText(895,35,"Danger Value of the screen : "..memory.readbyte(0x7954F),"White","",16,"AR Julian");
gui.drawText(895,60,"Current Danger : "..memory.read_u16_le(0x7AE50),"White","",16,"AR Julian");
gui.drawRectangle(1100,60,200,25,"White");
gui.drawRectangle(1101,61,memory.read_u16_le(0x7AE50)/1800*200,23,"","Green");

gui.drawText(700,15,"__________________","White","",16,"AR Julian");
gui.drawText(700,105,"In-battle infos and commentaries : ","White","",16,"AR Julian");
gui.drawText(700,110,"_______________________________","White","",16,"AR Julian");

RNG=Dec2Hex(memory.read_u32_le(0x7b720)-0x80000000);

RN1=memory.readbyte(memory.read_u32_le(0x7b720)-0x80000000);
RN2=memory.readbyte(memory.read_u32_le(0x7b720)-0x80000000+0x1);
RN3=memory.readbyte(memory.read_u32_le(0x7b720)-0x80000000+0x2);
RN4=memory.readbyte(memory.read_u32_le(0x7b720)-0x80000000+0x3);
RN5=memory.readbyte(memory.read_u32_le(0x7b720)-0x80000000+0x4);
RN6=memory.readbyte(memory.read_u32_le(0x7b720)-0x80000000+0x5);




end;


--Timer
 
 gui.drawRectangle(0,510,669,104,"Red","White");
gui.drawRectangle(393,511,276,103,"Red","Black");
gui.drawText(170,545,"Tool Assisted Speedrun","Black","",16,"Comic Sans MS");
gui.drawText(230,565,"Any%","Black","",16,"Comic Sans MS");

gui.drawText(480,515,"In-Game Timer :","White","",16,"Comic Sans MS");

gui.drawImage('../Bizhawk 1.11.9/FF92.png',1,515);

if  emu.framecount() < 2006 then
temps=0;
 elseif emu.framecount() > 1689317 then
 temps= 1686580;
else


temps= memory.read_u32_le(0x8b02c);
c=c+1;

if memory.read_u32_le(0x8b02c) == a then
temps = temps + b ;
if not emu.islagged() then
b=b+1;
end;
end;




if temps== memory.read_u32_le(0x8b02c) then
b=1;
end;


if c%2==0 then
a = memory.read_u32_le(0x8b02c);
end;

end;


heure= math.floor (temps/216000);
minute= math.floor ((temps - heure*216000)/3600);
seconde= math.floor ((temps - heure*216000 - minute*3600)/60);
frame= math.ceil((temps - heure*216000 - minute*3600 - seconde*60)/60*100);

if frame < 10 then
	if seconde < 10 then
		if minute < 10 then
		gui.drawText(420,540,heure..":0"..minute..":0"..seconde..".0"..frame,"Magenta"," ",42,"Comic Sans MS");
		else
		gui.drawText(420,540,heure..":"..minute..":0"..seconde..".0"..frame,"Magenta"," ",42,"Comic Sans MS");
		end;
	else
		if minute < 10 then
		gui.drawText(420,540,heure..":0"..minute..":"..seconde..".0"..frame,"Magenta"," ",42,"Comic Sans MS");
		else
		gui.drawText(420,540,heure..":"..minute..":"..seconde..".0"..frame,"Magenta"," ",42,"Comic Sans MS");
		end;
	end;
else
	if seconde < 10 then
		if minute < 10 then
		gui.drawText(420,540,heure..":0"..minute..":0"..seconde.."."..frame,"Magenta"," ",42,"Comic Sans MS");
		else

	if emu.framecount() > 1691460 then
		gui.drawText(420,540,heure..":"..minute..":0"..seconde.."."..frame,"Green"," ",42,"Comic Sans MS");
	else	
		gui.drawText(420,540,heure..":"..minute..":0"..seconde.."."..frame,"Magenta"," ",42,"Comic Sans MS");
		end;
		end;
	else
		if minute < 10 then
		gui.drawText(420,540,heure..":0"..minute..":"..seconde.."."..frame,"Magenta"," ",42,"Comic Sans MS");
		else
	if emu.framecount() > 1689317 then
		gui.drawText(420,540,heure..":"..minute..":"..seconde.."."..frame,"Green"," ",42,"Comic Sans MS");
		else
		gui.drawText(420,540,heure..":"..minute..":"..seconde.."."..frame,"Magenta"," ",42,"Comic Sans MS");
		end;
	end;	
end;
end;
	
d=emu.lagcount();
 
 -- COMMENTS
 comments(1680,2900,"FF9 is full of randomness. But how does it work ?","There is a list of numbers and a pointer going through this list, represented by the","graphic underneath. Everytime randomness is involved, the game picks the number","the pointer is on. This has a lot of use, like starting ATB, attack the enemy uses,","Critical hits, item steal,...");
 comments(2900,3900,"The starting list is decided by the framecount at the moment it loads and by the","combination of keys pressed at that time.","For this TAS, the list is manipulated to give us good ATB and opportunity to steal a","rare item in the first fight.");
 comments(4000,6000,"Quick explaination on how ATB works during the cutscene.","For the game to decide the length of the ATB, it does (60-Speed)*160.","For example, Zidane has a speed of 23, so his ATB will go from 0 to 5920.","","Then, at the beginning of the fight, the game use the Random Number, the pointer is","on, that we will call RN and use this formula : (RN*257)modulo(ATB length).","Let's use 100 as RN as an example. The ATB would be at 25700%5920 = 2020.","So Zidane would start at 2020/5920")
 comments(6001,7000,"It increases every frame by 10 on Default Speed, 14 at Fastest.","While it barely matters when the ATB is close to full, it makes a huge difference when","it comes to refill the ATB from 0.","","For Example, Zidane would need 592 frames on Default, but just 423 frames on","Fastest.")
 comments(8500,9500,"In the published TAS, I went into the menu to set everything on fastest.","However, since the dialog boxes all take the same amount of time to load and we","can manipulate ATB to the fullest, it is useless to do it now. It's better to wait that","we actually have to go to the menu for something else, to do it.")
 comments(10250,10750,"Zidane will have to face the door on the right after lighting the candle.","It's a couple of frames faster to light it from the left, so he won't have to turn.")
 comments(11000,12100,"As previously said, dialog boxes load and close at the same speed, no matter how many","letters are in it, so characters' names shouldn't matter. However sometimes a","character's name may appear in unskippable text that load letters one by one, so","renaming them to one letter may saves a few frames. It's the case for Zidane, Dagger","and Eiko.");
 comments(12150,13200,"Here is our first battle.","There is two ways to end the fight. Either get the enemy's HP down to 0 or have all of","our characters died. The latter is the fastest.","","We also have to steal a rare item to make the next battles faster. It can be done when","the bar on the graphic below is yellow.")
 battle(12948,13700,"Masked Man",true,188,6560,1)
 comments(13205,13900,"Cinna is the only one that can get one-hit KO by the enemy, so he has to be the one","stealing. There is a chance though that he survives the attack. We can change that by","running away and show our back to the enemy so damage would be multiplied by 1.5")
 comments(22700,23600,"Here, we're going to perform the Puck skip.","By talking to a NPC on the same frame you get hit, you can keep control of Vivi and","exit the screen instead of being paralyzed.")
 comments(24600,25200,"When starting a New Game from Power On, the Random Number used for Cards is","always the same. So unless you go pick up a Card before, you will always get the same","3 Cards from the Ticket Booth (Arrow combinations, Attack, Defense).")
 comments(40340,41300,"When a character is speaking and moving at the same time, most of the time, he","will have to finish his move before starting the next text box.","So in order to delay whatever comes next, we have to let the previous box open until","he finishes moving. Because it stays open, it looks like the manipulation takes","forever, when it actually just delays 2,4,... frames.");
 comments(45000,45800,"To end this fight, only King Leo's HP have to be down to 0.","Not much to say, except starting with close to full ATB and avoid the use of magic by","the enemies, which takes way more time than physical attacks.")
 battle(45130,46535,"Zenero",false,32,6560,1)
 battle(45130,46535,"King Leo",true,186,6560,2)
 battle(45130,46535,"Benero",false,28,6560,3)
 comments(49250,50200,"In the sword fight, there is a delay of 62 frames between button presses. Except with","Left and Right where the delay is 60 frames only.","So we want the maximum of it. However the timesave is so small, that manipulating it","would cost more time than it would save.")
 comments(50300,50800,"Making a flawless sword fight, will net us 10 000 Gil well needed later on.")
 comments(54900,55750,"Now that we will regain control over Zidane, we can go in the menu to equip him with","the Mage Masher we stole in the first fight. And we can go to the config to set","everything on fastest speed. I choose to remove the 'You're here' icon at the cost of a","few frames, but it looks way better in my opinion.")
 comments(55850,56400,"The Mage Masher will double the damages dealt by Zidane, which is a huge advantage","at this point.")
 comments(64750,65300,"Since we got the perfect swordfight, Steiner can go back to the Queen to get a","Moonstone. However it's completely useless in this run.")
 comments(81020,82800,"Before the next fight starts, we need to understand Cinna's damage formula.","The game uses 3 consecutives Random Numbers. One to see if he misses. One for his","range damage and one for the actual damage.","Cinna has 15 ranges possible, but only one including the max damage of 32 HP.","And in this range, there is 3 outcomes possible : 28, 30 and 32. So you basically have","a 1/45 chance to make the maximum damage with Cinna. This is important","to remember.")
 comments(82850,83500,"Steiner will always start the fight with his ATB one frame away from full. It is","technically possible to beat him to it, if your character is also one frame to full,","but having our 3 characters acting first would be a miracle...")
 comments(83501,84200,"Steiner has 169 HP. If our characters all do maximum damage, the total will equal to","170, and end the fight in one round. Zidane and Blank use a simple modulo 3, so it's","easy to succesfully get it, but, remember Cinna ?","Luckily this setup turns out to not require too much luck manipulation.")
 battle(83058,83827,"Steiner",true,169,6560,1)
 comments(96400,97200,"In this fight again, killing all of your characters but Garnet would end it and be much","faster than defeating the opponents.","It is worth noting that since Garnet will still be alive she could possibly kill the others","as well, but suicide is a few frames faster than Garnet's kill.")
 battle(97287,97763,"Haagen",true,33,6560,1)
 battle(97287,97763,"Steiner",true,167,6560,2)
 battle(97287,97763,"Weimar",true,38,6560,3)
 comments(101500,103000,"Enemies are subjects to a framerule on when they are going to launch their attack. It is","usually a 100-120 frames rule. If they miss the window, either because it happened","just before their ATB is full or because you put ATB on Wait after it was full, they","won't launch their attack for one more framerule.","In the upcoming fight, Steiner is once again one frame away to full ATB. However,","when does the framerule starts depends on RNG, so we can still make him attack more","or less quickly by changing the RNG at the start.")
 comments(104500,105150,"If all our characters but Garnet are dead, it skips a lot of dialogs and saves some time.","But we have to let the Bomb grow first before suiciding, or time would be wasted.")
 battle(104634,106785,"Bomb",true,38,1600,1)
 battle(104634,106785,"Steiner",true,162,6400,2)
 comments(117600,120400,"We are about to enter the Evil Forest and with that, our first screen with a danger value.","When you enter a screen, you can walk for 41 steps before there is an encounter check.","Then it's every 17 steps. Every check, the game performs a comparison between your","current danger and a Random Number to decide if you trigger an encounter.","There are several ways to avoid an encounter, but basically you have to make the check","happen while the pointer is on a different number. It can be done by stopping for a few","frames while the pointer still move, walking for a few frames (every walk is half a step).","Running towards boundaries to not take full steps...")
 comments(120401,121200,"Finally and it's the most useful technique in a TAS, you can stutter-step."," If you do (run)(walk)(walk)(run), you've run 3 steps. But if you","do (walk)(run)(walk)(run), you make the same numbers of steps, but the pointer is","one number further for some reason.")
 battle(122248,126404,"Prison Cage",true,513,1760,1)
 battle(122248,126404,"Garnet",true,68,6560,2)
 comments(123900,124400,"Nothing really important in this fight.","Doing Dyne, then attack would have been slightly faster but would gave us worse","RNG for the next fight.")
 comments(128700,129600,"Two things need to happen here.","First we have to steal the Leather Wrist. For that the Random Number must be under","the Yellow line.","","Second, we need to start filling Zidane's Trance gauge. Everytime he's hit, either","physically or with magic, it increases by a Random Number between 0 and his spirit,","until it reaches 255.")
 
 if emu.framecount()>128900 and emu.framecount()<132674 then
 gui.drawText(700,315,"Zidane's Trance level = "..memory.readbyte(0x108F74).."/255","White","",18,"Times New Roman")
end; 
 
 if emu.framecount()>128700 and emu.framecount()<131600 then
 gui.drawRectangle (700,581,615,2,"Yellow","Yellow")
 end;
 
 battle(129086,132674,"Prison Cage",true,533,4960,1)
 battle(129086,132674,"Vivi",true,67,6560,2)
 
 comments(129900,130400,"We're putting Vivi's ATB on wait so they switch turn with Prison Cage on the next","move. It doesn't cost time and manipulate the RNG.")
 comments(131900,132600,"The reason why Leather Wrist is important is because it gives to the one wearing it","an additional point of Spirit. And it's crucial for Critical Hits. More on that later.")
 comments(142400,144000,"About Critical Hits. The game uses this formula : RN mod (Spirit/4) > RN mod 100.","Where Spirit/4 is rounded down. So with 16 to 19 it will be 4 and with 20 to 23,","it becomes 5. Because the same RN is used in both part of the formula, RN mod 4","or RN mod 5 will never be superior to RN mod 100 and no Critical could happen.","","At this point Zidane has 23. BUT thanks to the Leather Wrist, it will go up to 24.","Which, in turn, would make Critical possible for 6 different Random Numbers.","Those are the Pink and Blue bars on the graphic below.")
 battle(146125,146950,"Baku",true,202,6560,1)

 if emu.framecount()>146125 and emu.framecount()<146950 then
 gui.drawText(700,315,"Zidane's Trance level = "..memory.readbyte(0x108F74).."/255","White","",18,"Times New Roman")
end;  
 
 comments(146500,146950,"When you select an attack, the character moves slowly to be in attacking stance.","But, by pressing L1 and R1 at the same time, you can skip this animation and be ready","right away.")
 comments(153730,154300,"It is possible to slightly influence the RNG at zero cost on the end of each screen.","By standing still on the last frame, you usually end up one number before the one","you would normally have and by walking on the last frame, one number after.")
 comments(160300,161000,"This battle is in two phases. First one end up when Plant Brain has lost 458 HP or","when Zidane is dead. The latter being faster by far.")
 battle(161172,161440,"Plant Brain",true,916,6400,1)
 battle(161441,163108,"Plant Brain",false,458,6400,1)
 comments(161050,161850,"We will use Vivi twice on the second phase. Once for Steiner's Fire Sword and once","for his Black Magic. It's important to make Blank attack inbetween as Vivi is slow","to get ready just after being used already.")
 comments(161900,162400,"Unfortunately, no one but Zidane can Critical, so we have to deal regular damages.")
 comments(165400,166150,"In prevision of the next battle, we resurrect Zidane and give him the Silk Shirt, that","we take from Blank. We also put him in back row. Thanks to those two, every damage","he takes will be halved.")
 comments(166740,167400,"Since this fight is mandatory with multiple enemies, we can use it to fill Zidane's","Trance gauge, so he is exactly three hits away from full. This slow down considerably","this battle but will speed up even more the next one.")
 comments(167670,168850,"Enemies' targets are decided by the Random Number at the moment their ATB is full.","We can simply change their target by putting ATB on wait. But it's not enough. Once","they targeted Zidane, the filling of his Trance gauge must also be high.","We can still put ATB on wait to make them miss their framerule, but that costs about","two seconds each time, or attacking someone to bump the pointer.","Killing Vivi serves two purposes so. Make one less target and bump the pointer.")
 
 if emu.framecount()>167681 and emu.framecount()<171698 then
 gui.drawText(700,315,"Zidane's Trance level = "..memory.readbyte(0x109044).."/255","White","",18,"Times New Roman")
 end;   
 
 battle(167681,171698,"Plant Spider",false,33,6560,1)
 battle(167681,171698,"Plant Spider",false,33,6560,2)
 battle(167681,171698,"Plant Spider",false,33,6560,3)
 
 comments(168900,169500,"I actually TAS up to the Sealion fight before optimizing this one, to see how full the","Trance bar needed to be. Turns out I could get 59 from later so I aimed for at least","196 here.")
 comments(178200,179200,"Another big improvment of this run is the 'Dialog RNG'. Really often throughout the","game, characters move while speaking. And the next dialog box won't pop up until","they finish their move. However, this is often controlled by RNG. So by manipulating","the Random Number at the start of the scene, we can make the dialog go quicker.")
 comments(187000,187900,"There won't be any Encounter Check on the World Map as long as the name of the","continent is displayed, so we can dash through. However Dialog RNG plays a part at","the entrance of the Ice Cavern. I won't mention it everytime, because there are too","many but I'll point the most important.")
 comments(191800,192500,"There is Mist going on and off all along the Ice Cavern. If you touch it, it triggers a","battle. However, by being very careful with your position, it is possible to take the","right path and not touch it.")
 comments(198250,199050,"The building of the Trance bar was done for this fight. Since Zidane is alone against","two enemies with high damage possibilities, it would take way longer with healing and","regular attacks.")
 comments(200400,201100,"In order to have an optimal fight, Zidane must Trance in 3 hits and steal the Mythril","Dagger. Sealion must only use Wings and Black Waltz 1, Fire.")
 
 battle(201086,205030,"Sealion",false,472,6560,1)
 battle(201086,205030,"Black Waltz 1",false,229,6560,2)
 
 if emu.framecount()>201086 and emu.framecount()<205030 then
 gui.drawText(700,315,"Zidane's Trance level = "..memory.readbyte(0x108F74).."/255","White","",18,"Times New Roman")
end;  

 comments(202750,203500,"If Sealion's HP goes under 157, he will counter with Tsunami. And we need it to do","the lowest damage roll. However, since it's a counter, it is not subject to the","framerule. So we can easily manipulate it by delaying the moment we attack.")
 comments(204100,204700,"Also since Zidane has 24 spirit, his Trance bar won't reach 0 in two turns and we will","skip the DeTrance animation.")
 comments(214080,214900,"Garnet also has her name mentionned in unskippable text, so it saves a bit of time to","rename her. But more important, her name is mentionned in Burmecia, where the RNG","pointer moves really really fast. So it also manipulates RNG to shortened her name.")
 comments(216250,217250,"Entering the World Map, first Encounter Check happens after 22 steps. Then it's","every 9 steps. The only way to manipulate encounter here is to Stop and Go. However,","you have to take two consecutive steps for them to count. If you take a step, stop,","retake a step, it won't increase your step counter. It's called Stutter-Step and is used","by RTA runners to avoid encounters.")
 comments(226900,227700,"In order for the game to proceed and make Dagger appear in the shop, you have to","visit three different places first. But, due to a programming error, you can visit the pub","twice and count as two different one.")
 comments(231400,231800,"Important Dialog RNG with the way Dagger moves her head in the shop.")
 comments(232700,233100,"Choosing first option then second is the fastest.")
 comments(250700,251150,"This is another example of face a direction before loosing control.","By pressing up before the trigger zone, you saved about 20 frames.")
 comments(251300,252300,"We equip Zidane with the newly stolen Mythril Dagger to increase his damage. We","can't press optimize here, since it would equip the Feather Hat that we will need later","and put him back to front row.","","Also, we can avoid the slide at the top of this screen by stopping on the last frame","possible. Combining it with the face left trick, it saves 80 frames.")
 comments(255200,256500,"Here we will need the RNG pointer to go very far to set up the next battle.","Two techniques are used here.","First, the stutter-step. It increases the distance travel by the pointer at the expense","of the distance travel by Steiner. But since, we need Morrid to go down the stairs","before entering the house, it doesn't matter.","Second one, the pointer will slow down every time you open a chest on screen. So","since we don't need what's inside, it's best to left them untouched.")
 comments(256501,257000,"Had we enter the house one frame sooner, Morrid would not appear right away and we","would lose a lot of seconds.")
 comments(257800,258400,"The Killer abilities are very important. They multiply the damage done by 1,5 on","enemies of that type. So in addition of equipping Steiner with better gears, we activate","the Bird Killer ability. So every flying enemy will get more damage (like in the next","fight).")
 comments(260850,261100,"Observing the barrel is way faster than poking it.")
 
 battle(264570,266722,"Black Waltz 2",true,1030,6400,1)
 
 comments(264550,265550,"In this fight, different steps are to be followed to be the fastest possible.","Black Waltz first target must be Vivi. Because when he gets below 50% of his max HP,","he will counter with Fira unless his current target is dead.","Since we killed Vivi, the counter is skipped. Then Zidane must Critical twice.","Zidane succesful Criticals are represented in blue below.")
 comments(265551,266500,"Then we need a Steepled Hat. We can either steal one here, on the next fight or buy","one in Lindblum. Stealing there is the fastest option. However it will cost one turn for","Zidane, which if you don't do anything, will allow Black Waltz to take one more turn.","However, we can put the enemy ATB on Wait, while Zidane acts, and unfreeze it after.","Since Zidane speed is higher, it allows him to take turn twice in a row.")
 comments(266501,267000,"Steepled Hat is the common item, so no manipulation needed here.","","Finally, we put Black Waltz ATB on Wait again, so it never gets full and don't call a","new Random Number. This gives us, access to slightly earlier RNG, which will be","important later.")
 
 if emu.framecount()>265385 and emu.framecount()<265550 then
 gui.drawText(830,430,"<-- ATB is not full, Vivi is still the target","White","",18,"Times New Roman");
 end;
 
 comments(267900,268450,"There is a bug in this scene, which can be very annoying for RTA runners.","If you select 'Depart now' too quickly, the game will softlock !")
 comments(274000,274900,"When we will enter inside the airship, will be the most important Dialog RNG of the","run. The time spent by Vivi trying to talk to a Black Mage can vary up to 10 seconds.","This is why we put ATB on Wait at the end of the previous fight.")
 comments(277670,278100,"We move slightly toward the bottom of the screen, so Steiner pushes us down and","not up.")
 comments(290200,291200,"One more time, a few things need to happen here. First, there is a possibility that Black","Waltz first move is 'nothing' and his ATB just resets. We want that so Vivi and Steiner","can act before him. Then we must put ATB on wait so our characters' ATB start filling","around the same time Black Waltz's one does.")
 comments(291201,291800,"Vivi's Trance allows him to cast Black Magic twice per turn. However he would","detrance after the fourth casting. Ideally, the enemy should die after his third one.")
 comments(292600,293400,"Attacking Black Waltz physically, makes him lift off. However we don't want to do","that immediately, because once he reaches the sky, his previous entered command goes","to the bottom of the queue. So every attack we have input in-between takes priority.")
 comments(293401,293750,"Finally, Steiner acts before Vivi so Black Waltz dies after the first Fire spell.")
 
 battle(290601,294568,"Black Waltz 3",true,1128,6400,1)
 
 comments(315400,316000,"Nothing really important to explain here. Lots of little dialog RNG manipulations, to","save couple of frames here and there.")
 comments(326500,326900,"No need to rename Freya, her name is never mentionned in unskippable texts.")
 comments(335900,336900,"Time to do some synthesis. By giving up two of your items for a price, you can get a","new item. Thanks to the Steepled Hat we stole, we can get a Yellow Scarf, which will","teach Zidane, Bird Killer. It's very important to take it on Disc 1, you'll see later, why.")
 comments(362000,362600,"You must look at the six different places for the game to proceed.","It's 20ish frames faster to start by the right side.")
 comments(373300,374600,"The Festival of the Hunt is about to begin. There is three possible winners : Zidane,","Freya or Vivi. Each one is rewarded by gils, Coral Ring and a Card respectively.","However for Zidane or Vivi to win, we would have to fight a Zaghnol, which only","appears after 7:30 have passed, when Freya just need Zidane to get KOed, regardless","of time. You can take a wild guess at who's gonna win ^^")
 comments(378600,379400,"If you guessed Freya as the winner and Zidane to get KOed, congratulations, you win!","We just have to fight the first enemy and suicide to end this.","The Coral Ring, Freya will win, has the Man Eater ability which is also a big plus.")
 comments(379401,379900,"We could run towards the Mu to start the battle earlier, but it would give us bad ATB.","So we have to stand still and wait for it.")
 
 battle(380170,380439,"Mu",false,201,6400,1)
 
 comments(381700,382100,"And we receive the Coral Ring.")
 comments(383100,383500,"Important Dialog RNG scene with the banquet after this part.")
 comments(391200,392600,"Major route change at this point. I TASed up to Lani, both with Quina's Limit Glove","and without it but with Critical Hits to be certain of which one is faster.","As it turns out, if you can pull off enough Criticals, going without Quina is 40ish","seconds ahead, depending on luck. While being not reliable real-time, it's definitely the","way to go in a Tool Assisted Speedrun. So... We go right away to Gizamaluke's Grotto.")
 comments(396000,396600,"Thanks to the Coral Ring, we can put Man Eater on Zidane, which will allow him to","one-hit KO the next set of enemies.")
 
 battle(399408,400412,"Type A",false,398,6400,1)
 battle(399408,400412,"Type A",false,398,6400,2)
 
 comments(399450,400500,"Freya has a Spirit of 23 at this point, so she can't Critical and Vivi's Magic is","too weak. So Zidane has to kill both, while the first surviving Black Mage use the","Strike attack to not waste time.","Also, while Zidane is attacking, the other characters choose Defend so we won't have","to switch back to Zidane when his ATB will be full again.")
 comments(401500,402350,"There is two ways to get the next bell we need. We can either fight the wandering","Mage up the screen, or go back to the Soldier in the previous one.","If you know you won't trigger Random Encounters, it's better to go see the soldier.")
 comments(406550,407800,"The next boss, Gizamaluke, is Bird Type. That's why we lost a lot of time stealing","the Steepled Hat, to synthesize the Yellow Scarf, to get Bird Killer.","Since we don't have the almighty Limit Glove, we have to rely on physical attacks","and without Bird Killer, it's more than 30 seconds that are lost.")
 
 if emu.framecount()>410353 and emu.framecount()<413943 then
 gui.drawText(700,380,"Gizamaluke","White","",18,"Times New Roman");
 
 if memory.read_u16_le(0x109264)-62360<0 then
 bla=0;
 else
 bla=memory.read_u16_le(0x109264)-62360;
 end;
 gui.drawText(700,405,"HP = "..bla.."/"..3175,"White","",18,"Times New Roman");
 gui.drawRectangle(700,430,102,25,"White");
 gui.drawRectangle(701,431,(memory.read_u16_le(0x109268)/6080)*100,23,"Green","Green");
 end;
 
 comments(410353,412000,"Couple of things here. First, the use of a Tent. Since this is gonna take a few rounds,","we inflict Silence to Gizamaluke so when he'll select a Magic attack, he ends up doing","nothing and his ATB resets, which saves time overall. Second, we use Jump from","Freya instead of a regular attack, but only because when under Jump, the RNG pointer","moves slower, which sets Zidane perfectly for a Critical Hit and makes Gizamaluke","use Magic again.","","You can see Zidane's Critical possibilities on Blue and Pink below.")
 comments(413050,413400,"ATB on Wait trick again, so Zidane acts twice in a row.")
 comments(419750,420800,"There is a Multina Racket in the chest for Dagger that will save a turn in a battle","coming next, making it worthwile to pick up now.","","When talking to the worker, choosing 'Don't kill' is faster.","","Also the position of the 'Chief Engineer' on the bottom right is RNG based. We","manipulate him to be on the far left so we have less distance to travel.")
 comments(421000,421450,"Talking to the lady from the right will avoid being pushed away when she moves and","saves a couple of frames.")
 comments(424200,424700,"Important Dialog RNG with Dagger getting out of the bag. You can loose seconds","with bad RNG.")
 comments(431850,433000,"We don't need Bird Killer anymore for now, but we do need Man Eater, so we switch","the Yellow Scarf for the Coral Ring.","","As you will see, the rain around and in Burmecia makes the RNG pointer move like","crazy. It's a good thing because it only takes a dozen frames to completely change the","Random Number table, which allow us to quickly manipulate favorable battles","in Burmecia and a good boss battle after it.")
 
 battle(436540,437491,"Type A",false,398,6400,1)
 battle(436540,437491,"Type A",false,398,6400,2)
 
 comments(436540,437700,"There was a way to slightly speed up this battle. If we equip Freya with Coral Ring,","her Spirit would go over 24 and she could Critical and One-Hit KO a Black Mage.","However, this would remove Man Eater from Zidane, whom would have to Critical","too. But the extra menuing makes it that it loses time overall.")
 comments(450600,451000,"It's 20ish frames faster to go on the right side here.")

 battle(459897,462677,"Beatrix",true,3630,3040,1)
 
 if emu.framecount()>462676 and emu.framecount()<463297 then
 gui.drawText(700,380,"Beatrix","White","",18,"Times New Roman");
 gui.drawText(700,405,"HP = 0/3630","White","",18,"Times New Roman");
 gui.drawRectangle(700,430,102,25,"White");
 gui.drawRectangle(701,431,(memory.read_u16_le(0x109268)/3040)*100,23,"Green","Green");
 end;
 
 comments(459897,461000,"In this fight, every attack perform by Vivi are just a mean to bump the RNG pointer.","Since Zidane absorbs Thunder attacks, he has to take the first hit. After that, due to","the fact that there is no EXP or AP, it doesn't matter how many of us survive.","","As usual, Zidane Critical bars are in blue below.")
 comments(464700,465350,"Still thanks to the rain, we can delay the moment we close the dialog boxes, to change","the Random Number table to our liking for the first Boss battle of Disc 2.")

 comments(469376,469600,"Disc 1 in 2h09m46s89")
 
-- End of Disc 1

 comments(474300,475000,"It's better to leave this room by the bottom exit for better positionning of the NPCs.","Plus we have to do some shopping, so we need to go on the bottom side anyway.")
 comments(475550,475950,"Steiner has a Spirit of 22. Luckily, there is a Barbut for sell here that gives a bonus","of 2, which will allow him to Critical.")
 comments(479300,479950,"The Multina Racket we picked up for Dagger has its damage increase by 150% if she","wears an equipment which boost Wind attack. Which is the case of the Feather Hat.","However, her Spirit is too low and Marcus' is 21, so neither can Critical.")
 
 battle(483124,485100,"Black Waltz 3",false,1292,6400,1)
 
 comments(483050,483650,"We don't attack with Marcus right away, so it slightly changes the position of the","pointer for Black Waltz' attack.","","Steiner Critical possibilities are in blue below.")
 comments(484050,484950,"There is 11 numbers out of the 256, that made Black Waltz miss. This is important","because he would kill Marcus in one hit and had he targeted and hit Steiner, we would","have to heal him later and waste time.")
 comments(492200,493300,"Arriving in Treno, you can watch an ATE, that will allow you to pick up a Power","Belt. It's a powerful item because it has MP Attack and Counter as abilities.","Counter is self-explanatory and MP Attack increase your damage by 150%.","Watching the ATE and picking it up costs a lot of time though. In the end it still saves","a little bit of time, but not very much.")
 comments(493400,493750,"If you don't care about losing an extra 500 gil, it's 40ish frames faster to let Dagger","get robbed by the pickpocket, without noticing.")
 comments(495200,495400,"Here is where we get the Power Belt.")
 comments(499600,500700,"Little bit more shopping. Most of it is more powerful weapons, to which we add","Glass Armlets and Chain Mails to synthesize more Power Belts, a Bandana because it","allows Spirit and Speed modification, a Bone Wrist for the Add Status ability and","a Chain Plate for Devil Killer. Both are very important abilities in late game.")
 comments(502150,503000,"There, is another example of facing direction before losing control. Press X to grab the","ladder, then immediately go on the opposite direction. That way, Dagger will be in the","correct position and saves a couple of frames.")
 comments(506450,507100,"This is an example of unskippable text. In this one Zidane's name is mentionned, so","having him being named Z, saves a few frames.")
 comments(520000,520650,"Steiner must take a hit in the next fight. But because Black Waltz 3 missed, we don't","have to heal anyone, so we save time in menuing.")
 comments(520950,521350,"I accidentally talk to Doctor Tot twice here. It didn't cost me any time though,","because we have to move the pointer further anyway.")
 
 battle(526843,528325,"Ralvurahva",true,2296,6240,1)

 if emu.framecount()>528324 and emu.framecount()<528803 then
 gui.drawText(700,380,"Ralvurahva","White","",18,"Times New Roman");
 gui.drawText(700,405,"HP = 0/2296","White","",18,"Times New Roman");
 gui.drawRectangle(700,430,102,25,"White");
 gui.drawRectangle(701,431,(memory.read_u16_le(0x109268)/6240)*100,23,"Green","Green");
 end;
 
 
 
 comments(526900,527550,"ATB on Wait for a couple of frames, so Steiner will be the one targeted.","Marcus steals to put the pointer on the correct position, so that when the enemy","attacks Steiner, he will counter.","","Still the blue bars for Steiner's Critical.")
 comments(527581,527900,"Counter has a 36/256 chance to happen.")
 comments(535600,536350,"Another example of name being in unskippable text, with Dagger here.","","Because the pointer moves so fast here, the shortened name gives us acces to way","earlier Random Numbers.")
 comments(541250,541900,"The Magician Shoes in this chest will enhance Vivi's Magic. It will save time right","away in the next Boss' fight.")
 comments(544850,545500,"The direction you will spin is decided by the Random Number at the entrance of the","screen. We want it to be counter-clockwise to reach the exit.")
 comments(545850,546500,"We now equip Vivi with the Magus Hat, Magicien Shoes and Ice Staff.","It teaches him Blizzara and boosts it.")
 comments(547650,548050,"Decline the guided tour of Cleyra, which is just a huge waste of time.")
 comments(548650,549300,"We need to buy a Partisan for Freya. It sets her damage range just where it needs","to be for the fights against the Alexandrian Soldiers.")
 comments(549750,550150,"We don't need to pick up the Yellow Scarf anymore here, since we already","synthesized it.")
 
 battle(554663,558375,"Antlion",true,3938,6080,1)
 
 comments(554700,555150,"Like against Gizamaluke, it's faster to use a Tent to prevent Antlion from using Magic.")
 comments(555700,556700,"Because Antlion counters physical attack with a very high pourcentage, we can't","blindly attack with Zidane or Freya.","But one attack from Zidane well timed and three enhanced Blizzara with a high","damage roll will do the trick.")
 comments(556701,557500,"We had to delay the second Blizzara, for Antlion's ATB to be full before it got hit.","This way, its next move will be Trouble Mucus and not Sandstorm, which is way","longer.")
 comments(575900,576200,"Choosing not to believe Brahne is 26 frames faster.")
 comments(584550,585550,"Change of strategy for the fights against Alexandrian Soldiers. We're gonna make them","escape, instead of killing them. It's 2-3 seconds faster, since you don't have to watch","the post-fight screen. However you miss Experience, which makes you lose time","afterward. It's still faster overall but not by much.")
 
 battle(586054,586646,"Alexandrian Soldier",false,523,6240,1)
 battle(586054,586646,"Alexandrian Soldier",false,523,6240,2)
 
 comments(586050,586500,"If the Soldier's HP is between 1 and 52, he will escape. At this point, Zidane has 60%","chance and Freya 50% chance of making them escape.")

 battle(588587,589214,"Alexandrian Soldier",false,523,6240,1)
 battle(588587,589214,"Alexandrian Soldier",false,523,6240,2)
 
 battle(591185,591785,"Alexandrian Soldier",false,523,6240,1)
 battle(591185,591785,"Alexandrian Soldier",false,523,6240,2)

 battle(598304,598592,"Type B",false,526,6240,1) 
 
 comments(598305,598650,"Black Mages, however, won't escape, so they need to be killed.")

 battle(600498,601414,"Alexandrian Soldier",false,523,6240,1)
 battle(600498,601414,"Alexandrian Soldier",false,523,6240,2)
 battle(600498,601414,"Alexandrian Soldier",false,523,6240,3) 
 
 comments(600498,601529,"Against 3 Soldiers, however, it's faster to kill them by about 1,5 second. And we get","Experience and AP. It is also faster to let the Soldier attack and finish with Zidane than","using Vivi's Blizzara.","Vivi's attack bumps the pointer for the next fight, without losing time.")

 battle(603247,603778,"Type B",false,526,6240,1) 
 battle(603247,603778,"Type B",false,526,6240,2) 
 
 comments(605000,605250,"Going on the right avoids a fight.")
 comments(606300,606700,"Going right gives you one less enemy, but takes so much longer to start that it's not","worth it.")
 
 battle(607594,608526,"Alexandrian Soldier",false,523,6240,1)
 battle(607594,608526,"Type B",false,526,6240,2) 
 battle(607594,608526,"Alexandrian Soldier",false,523,6240,3)
 
 comments(607595,608000,"Because of the Black Mage, we will have to see the post-fight screen anyway, so","killing the Soldiers is faster.")
 comments(609600,610100,"Choosing left takes longer to start the fight, but this time, by having less enemies,","it saves time overall.")
 
 battle(611070,611742,"Alexandrian Soldier",false,523,6240,1)
 battle(611070,611742,"Alexandrian Soldier",false,523,6240,2) 
 
 comments(611070,611400,"Just 2 Soldiers, so... Escaping again...")
 comments(611401,611750,"ATB on Wait so it doesn't reach full before escaping. This prevents a Pointer bump.")
 comments(623400,624000,"Beatrix movements before the fight starts can vary wildly in length depending on RNG.","This was the best combination of fast movement and decent fight.")
 
 battle(625528,628708,"Beatrix",true,4736,2880,1)

 if emu.framecount()>628707 and emu.framecount()<629388 then
 gui.drawText(700,380,"Beatrix","White","",18,"Times New Roman");
 gui.drawText(700,405,"HP = 0/4736","White","",18,"Times New Roman");
 gui.drawRectangle(700,430,102,25,"White");
 gui.drawRectangle(701,431,(memory.read_u16_le(0x109268)/2880)*100,23,"Green","Green");
 end;


 
 comments(625528,626250,"We need to steal an Ice Brand from Beatrix. We can pick it up in Alexandria, but it is","way slower than stealing it, even if it wastes one turn from Zidane.","","The opportunities are the Yellow Bars below.")
 comments(626500,626850,"Like in the first fight against her, Zidane absorbs Thunder, so he is the first target.")
 comments(627050,627650,"We put ATB on Wait so Zidane is targeted again.","Now that his HP has replenished, he can survive the next hit.")
 comments(627700,628500,"We abuse the framerule of attacks, by pausing and unpausing the ATB, so Zidane can","slowly fill his one with Beatrix not attacking.","If we hadn't done that, Beatrix would get two turns before Zidane.")
 comments(628550,629150,"There were unfortunately no opportunity of Critical during this fight except at the","beginning, but it would have cost too much time to manipulate.")
 comments(632900,633200,"Since we still don't have Quina, the game proceeds faster.")


 if emu.framecount()>649750 and emu.framecount()<652085 then 
 
gui.drawLine(800,250,1270,250)
gui.drawLine(800,230,800,270)
gui.drawLine(1270,230,1270,270)

local cagex=0;

if memory.readbyte(0x77E84)==255 then
cagex=memory.readbyte(0x77E83)-256 else
cagex=memory.readbyte(0x77E83)
end;

 

gui.drawRectangle(1055+cagex,230,3,40,"Blue","Blue")

end;

 comments(649765,650000,"The pushes are optimized to travel the most distance each time.")
 comments(651500,651900,"On the last trip left, I go less far so I can reach the right side sooner.","It saves around 15 frames.")
 comments(652450,652800,"This pattern is close to the fastest dodge possible.","If you touch a guard, a fight begins.")
 comments(652900,653500,"Little programming error here. Steiner will turn his back to the ladder before climbing.","Thus pressing Up+X instead of Down+X makes him catch the ladder faster.")
 comments(661150,662300,"Since we have to wait for the rotating platform, we can run in circle to make the pointer","of RNG move faster without wasting time. It's used to set it up for the next fight.","","There is an Ice Brand in one of the chest. The waiting period to get it and come back,","makes the steal from Beatrix much faster.")
 comments(663500,663900,"We equip the Ice Brand and remove the Chain Mail from Freya to synthesize Power","Belt later.")
 comments(665400,665800,"In this fight, only one of them needs to be dealt with to end it.","So we target the one with lowest HP.")
 
 if emu.framecount()>665618 and emu.framecount()<666030 then
 
 if memory.read_u16_le(0x109264)>63000 then
 vie=2985
 else
 vie=0;
 end;
 
 gui.drawText(700,380,"Thorn","White","",18,"Times New Roman");
 gui.drawText(700,405,"HP = "..vie.."/2985","White","",18,"Times New Roman");
 gui.drawRectangle(700,430,102,25,"White");
 gui.drawRectangle(701,431,(memory.read_u16_le(0x109268)/1600)*100,23,"Green","Green");
 
 gui.drawText(900,380,"Zorn","White","",18,"Times New Roman");
 gui.drawText(900,405,"HP = 4897/4897","White","",18,"Times New Roman");
 gui.drawRectangle(900,430,102,25,"White");
 gui.drawRectangle(901,431,(memory.read_u16_le(0x109338)/1600)*100,23,"Green","Green");
 end; 

 comments(665801,666030,"Critical represented with Blue Bars below.")
 comments(672200,672550,"Like on the way down, we run in circle to set up the pointer for the next fight, at no","cost.")
 
 battle(678396,679380,"Beatrix",true,5709,1920,1)

 if emu.framecount()>679379 and emu.framecount()<680084 then
 gui.drawText(700,380,"Beatrix","White","",18,"Times New Roman");
 gui.drawText(700,405,"HP = 0/5709","White","",18,"Times New Roman");
 gui.drawRectangle(700,430,102,25,"White");
 gui.drawRectangle(701,431,(memory.read_u16_le(0x109268)/1920)*100,23,"Green","Green");
 end;
 
 comments(678396,679100,"Two requirements in this fight. Steiner must act first, then Zidane or Freya before","Beatrix, which is not that easy considering Beatrix's 48 Speed. Then, Steiner must","Critical.","","Bars for Critical in blue below.")
 comments(679300,679650,"Freya doesn't attack immediately for pointer's manipulation of the post-fight sequence.")

 if emu.framecount()>687665 and emu.framecount()<688300 then
 gui.drawRectangle (700,563,615,2,"Yellow","Yellow")
 end;

 battle(687670,688143,"Bandersnatch",false,899,6240,1)
 
 comments(687670,688900,"Beatrix is a special case when it comes to Critical at this point. Her spirit is between 32","and 35, so in the graphic below, she can use Pink Bars and Blue Bars under the Yellow","line. None of it was possible unfortunately. As for Freya, even if she could, she","wouldn't do enough damage. So, it was either one hit from each one or Climhazzard","from Beatrix. The former is about one second faster.")

 battle(691800,692788,"Type C",false,623,6240,1)
 battle(691800,692788,"Type C",false,623,6240,2)
 battle(691800,692788,"Type C",false,623,6240,3)
 
 comments(691800,692650,"It is faster to trigger a Counter from a Black Mage's physical attack than using Vivi's","Blizzara. Zidane can also one-shot the enemy with a Critical.","","Critical for Zidane are represented by Blue Bars below.")
 
 battle(695161,695733,"Bandersnatch",false,899,6240,1)
 battle(695161,695733,"Bandersnatch",false,899,6240,2) 
 
 comments(695161,695700,"Steiner can kill a Bandersnatch in one hit, but Zidane needs to Critical. Vivi can also","kill one in one turn, but Zidane's Critical is faster even with manipulation's delay.","","As always, Blue bars for Critical.")
 
 battle(699378,699794,"Bandersnatch",false,899,6240,1) 
 
 comments(699378,699700,"Blue and Brown Bars for Zidane's Critical")
 
 battle(702622,703146,"Bandersnatch",false,899,6240,1)
 battle(702622,703146,"Bandersnatch",false,899,6240,2) 
  
 comments(702622,703150,"Like before, even with Critical, Freya can't one-shot the enemy. So Climhazzard is the","fastest you can get here.")

 battle(705827,706415,"Bandersnatch",false,899,6240,1)
 battle(705827,706415,"Bandersnatch",false,899,6240,2) 
 
 comments(705827,706100,"Pink bars for Beatrix Critical")
 
 battle(714939,717087,"Ralvuimago",false,3352,6080,1)
 
 comments(714940,717000,"It takes 2 Blizzaras and one attack from Zidane to defeat it, in that order.","Zidane must attack last or Ralvuimago becomes compact and increase all its defense,","both physical and magical to the max.","It would have been slightly faster to have it cast Ultra Sound Wave or Stab, instead of","Thundara but the manipulation to have it as well as good Vivi's ATB would have cost","more unfortunately.")
 comments(731600,732200,"We make the acquaintance of Ramuh. We can go all around Pinnacle Rock pick up","parts of his story to make him join the party, but in an Any% it's completely useless.")
 comments(745100,745600,"We have to go on the far left here. Going to close to the middle would trigger a long","dialog scene around the Black Mage's body.")
 comments(747400,748000,"Following a long sequence of dialogs. This is completely fixed, no dialog RNG. All","we can do is skip texts and wait for it to end.")
 comments(751000,751600,"Before leaving Lindblum, we make a quick stop to synthesize a few things.","An Exploda, that will teach Zidane Lucky Seven and 2 additional Power Belt.")
 comments(761200,761550,"And now, we are going to get Quina, since s/he is mandatory.")
 comments(763500,764100,"The moment, that the frog is going to jump towards you is based on RNG at the","entrance of the screen. This is the fastest.")
 comments(770800,772000,"We equip the Exploda. The way Lucky Seven works is this : If your HP end with a 7,","the game performs a modulo on the Random Number.","If RN mod 4 = 0, deals 7, = 1, deals 77, = 2, deals 777, = 3, deals 7777, so all odds","are equal. If your HP ends with something else, you deal 1...")
 comments(772001,772300,"Dealing 7777 damage is obviously very powerful at this point of the game.")
 comments(777600,778500,"Running towards the last axe, then back towards the entrance, triggers the enemy's","spinning earlier than waiting for it. Which makes us jump sooner and saves frames.","In addition, since we don't care about distance, we can stutter-step, to boost the pointer","further.")
 comments(779000,780100,"In the upcoming fight, here the first downside of making Alexandrian Soldiers escape.","Had we fought them all, Zidane's HP would naturally end with a 7. Here we will have","to manipulate an attack to make things work. However it costs less time than the","escaping of the soldiers saves.")
 
 battle(781924,782976,"Lani",true,5709,1600,1)
 
 comments(781924,782750,"Lani will always attack first, so our starting ATB don't matter that much.","A quick attack from Quina makes Zidane's HP end with a 7, so Lucky Seven will","work and end the fight very fast.")
 comments(785500,786500,"Not much to say during this whole section. Picking up flowers and raising them on","specific points makes us ride the Gargants. Then we have to strategically push or pull","switches to make them go where we want. After that it's a simple rush to the exit.")
 comments(787500,788200,"There is a NPC on a screen with encounters here. By starting a Card Game against","him, you can reset the Danger value and Encounter Checks. Not useful in a TAS of","course, but worth noting.")
 comments(799800,800500,"We have to take the long detour to reach the switch right above us. If we take any","other route, a waterfall would push us down the lake.")
 comments(800600,800850,"Just like that...")
 comments(803300,804000,"Like when exiting the Evil Forest, your step count doesn't start until the name of the","continent disappear from screen, so you can just run without question.")
 comments(804300,805150,"Entering or exiting a forest on the World Map, also change the moment the","encounter check happen. So you can manipulate a fight away without losing time, by","slightly changing your trajectory.")
 comments(813700,814700,"To reach the Black Mage Village, you need to go right or left, several times.","But the Danger Value never resets in-between, making it very hard to go through","without encounter.")
 comments(814701,815500,"At this point you can either go left again, and reappear at the bottom or go down then","right. The former is better in RTA since it makes less encounter checks, but the latter","is faster.")
 comments(819400,819800,"Manually triggering the ATE is about 50 frames faster than waiting for it overall.")
 comments(823600,824300,"It may seem that renaming characters could have save time in here, but after testing,","it is not the case unfortunately. So Vivi's name doesn't matter.")
 comments(836200,836900,"You can trigger an extra scene of Vivi and Quina getting married here. Obviously,","for the sake of speed, we don't do that.")
 comments(838600,839300,"Once you reach the bottom of this screen, all the Stat Boosts Marcus recieved are","transfered to Eiko. Once again, useless in a TAS but worth noting.")
 comments(841000,841500,"Eiko's name will be mentionned a couple of times in unskippable texts in Mount Gulug.","Shortening her name saves a few frames.")
 
 battle(846979,848435,"Hilgigars",false,8106,2560,1)
 
 comments(846980,847700,"Once again we have to manipulate Zidane's HP and lose a little bit more of the time","we save by making Soldiers escape. Still worth it though.")
 comments(861500,861900,"It is 2 frames faster to select Chimono, Momatose, Moccha than the default order.")
 comments(863300,864000,"Normally, you're supposed to go to the Eidolon Wall, then get Dagger. But you can","make a sequence break and get Dagger right away.")
 comments(871500,872300,"The Moogle is standing just on the edge of the trigger zone. You can talk to him","by pressing X and avoid him going inside the house. This saves around 100 frames.")
 comments(885600,886300,"This is the screen where the Danger is gonna get the highest. If someone gets it","encounter-free without tools, please go buy a lottery ticket ^^")
 comments(892000,893100,"There is no Dialog RNG here in the sense that dialogs' timing won't change, however,","based on the random number at the entrance of the screen, the pointer movement is","going to vary widely. So we can manipulate the next fight without too much time cost.")
 comments(894300,895300,"We are going to face Undead enemies. Here is how to deal with them, in order from","fastest to slowest :","","- One-hit KO physical attack (~120 frames)","- Phoenix Down (~280 frames) but only 10% chance to kill","- Life (~300 frames) but can only be done by White Mage","- Elixir (~350 frames)") 
 comments(895301,896150,"Since the next fight is gonna act like a regular encounter, we can manipulate it to be","a Preemptive Strike. Which means that damages done by Zidane will be doubled.","So he will one-hit KO without the need of a Critical.")
 
 battle(896635,897475,"Zombie",false,973,5920,2)
 battle(896635,897475,"Zombie",false,973,5920,3) 
 
 comments(896900,897200,"In order to kill with a Phoenix Down, RN modulo 10 must be 0.")
 
 battle(900453,901085,"Dracozombie",false,2179,4960,1)
 
 comments(908800,909200,"Here comes Soulcage. Hardest boss in the game. Phoenix Down and pouf...")
 
 battle(909118,909810,"Soulcage",false,9765,5760,1)
 
 comments(932700,933000,"Slight delay in closing textbox for pointer manipulation.")
 comments(934700,935600,"In this fight, Scarlet Hair can move all over the screen. It needs to be avoided to not","lose time. Which means that he needs to be dealt with in one turn.","Normally, this is impossible with our current stats, however, if we can trigger a","counter...")
 comments(935601,936000,"His attack makes us counter and left our HP to end in 7 so we can finish him with a","Lucky Seven.")
 
 battle(934929,936057,"Scarlet Hair",true,8985,1600,1)
 
 comments(936100,936700,"If he was elsewhere on the screen, we would have to wait for him to go back in the","center and lose couple hundred frames.")
 comments(964900,965400,"Amarant joins the party. He is a lot weaker when fighting with you than against you,","surprisingly, like Beatrix was.") 
 comments(969000,969800,"Important Dialog RNG, at the entrance of the Iifa Tree. We delay a little bit the","moment to press X, so Dagger will have perfect movements.")
 
 battle(985612,986464,"Mistodon",false,1473,5920,1)
 battle(985612,986464,"Mistodon",false,1473,5920,2)

comments(985612,986100,"Undead enemies, so same method as before. Critical from Zidane is the fastest. Then","Phoenix Down.","","Zidane's Critical in Blue bars.") 

 battle(991088,991500,"Mistodon",false,1473,5920,1)

comments(991088,991500,"Still Blue Bars for Zidane's Critical.")
comments(992500,993500,"We are about to go down the Iifa Tree's roots. Normally there will be Mistodons","chasing you. The game checks every frame, the value of the current Random Number","and decides if a Mistodon will chase you. But because we can't stutter-step, we have","to find another way to jump over the wrong addresses.")
comments(993501,995500,"It can be done in two ways. Sometimes the pointer will naturally jump over an address,","but not necessarly the one we want. We can stop running for a few frames, to change","the position of the jump. It rarely works though. So there is a second method that","always will but is longer.","Calling for randomness by using Cure from Eiko. This will use the Random Number","to heal instead of calling a Mistodon. Both methods are displayed here.")
comments(1001900,1002300,"Delaying Amarant's textbox closing for Dialog RNG manipulation.")

comments(1017028,1017250,"Disc 2 in 4h41m52s54")

--End of Disc 2

comments(1018000,1018300,"Brace yourself, a long period of 'Nothing's going on' is coming...")
comments(1030100,1030400,"Absolutely no Dialog RNG in the whole sequence. Just mashing texts.")
comments(1054000,1054700,"We have to wait for the boat to arrive, so like in Alexandria Castle, we can move","around and pick up treasures to manipulate the RNG without wasting time.")
comments(1079000,1080600,"The Tetra Master uses a different RNG than most of the rest of the game.","It chooses the position of the rocks on board, cards and attacks of the opponents,...","There is various ways to make it change outside of a game, like entering or exiting a","town, or receiving a card after a battle. Some aspect of the background may use it too.","But once a game as started, it changes every frame, making manipulation way easier.")
comments(1079000,1085500,"","","","","","","","","TETRA MASTER RNG : "..Dec2Hex(memory.read_u32_le(0x9010)))
comments(1080601,1081100,"The board is chosen by the RNG at the start of the game. It's easily manipulated","by delaying the moment we confirm the card at the end of the previous one.")
comments(1081300,1082000,"A fight against two cards is very time-consuming. Fliping a card is a little bit too, but","we have to in order to win.","So we avoid all fights and flip just one.","The deck the opponent will use is determined when you confirm yours.")
comments(1082900,1083800,"If you lose or make a draw on the first two games, you have to replay it. However,","win or lose the third one, the game will still proceed. But winning rewards you with","a Rebirth Ring much needed later on.")
comments(1092250,1093250,"Assigning the right knights to the right tasks nets us with Angel Earrings, that will","also be very valuable for Freya.","","Gather Information => Blutzen & Kohel","Protect people => Weimar & Haagen","Contact Lindblum => Breireicht & Laudo","Prepare the cannons => Dojebon & Mullenkedheim")
comments(1095150,1095550,"Going to close to the Mistodon triggers a fight. It's easily avoidable by going on","the left side.")
comments(1095551,1096350,"There is supposed to be a mandatory fight here, but by walking half a step and standing","still on the very last frame possible, we reach both the exit and trigger zone at the same","time and the exit has priority.")
comments(1096351,1096900,"We remove all of Beatrix's equipment and optimize Steiner. This allows him to get","the Undead Killer ability which then, makes him able to one-shot Mistodons.")

battle(1097883,1098591,"Mistodon",false,1473,5920,1)
battle(1097883,1098591,"Mistodon",false,1473,5920,2)

comments(1098000,1098350,"A counter from Steiner is slightly faster than healing items or magic from Beatrix")
 
battle(1101245,1101505,"Mistodon",false,1473,5920,1) 
 
battle(1103199,1103507,"Mistodon",false,1473,5920,1) 
 
battle(1105459,1105719,"Mistodon",false,1473,5920,1) 

battle(1107407,1108779,"Mistodon",false,1473,5920,1)
battle(1107407,1108779,"Mistodon",false,1473,5920,2)

comments(1107407,1108300,"While the second Mistodon will attack right away, the first one has its ATB reset.","So Beatrix will attack before it. Thanks to freezing and unfreezing ATB, we can set","things up so she Critical.","","Critical for Beatrix with Blue Bars below")
comments(1133600,1134900,"At this point, we can go fight Tantarian, an optional boss that would reward us with","Running Shoes. However, I TASed with and without this fight, and under TAS","condition, it's about 55-60 seconds slower to go for it.","","Also worth noting, Tantarian can be fought in Disc 2 but without Lucky Seven, it is","extremely slower.")
comments(1152100,1152700,"I made a mistake here. Choosing 'How did I get there?' makes you not have to talk","to the guard downstairs, however, the text is so much longer that it is overall slower.")
comments(1176000,1176300,"Important Dialog RNG here.")
comments(1184500,1184900,"We have to go look for 3 potions around Lindblum. The order in which we take them","is irrelevant for the first one.")
comments(1187400,1188000,"We make a quick stop to buy the Coral Sword for Steiner. It will teach him Charge!","which will be very useful in the endgame.") 
comments(1195200,1195800,"Due to Zidane's position after this scene, it is slightly faster to take the potion on the","left before the one on the right.")
comments(1199000,1199400,"You have to talk to the artist, before being able to pick up the potion on the floor.")
comments(1214900,1215900,"We can reach the Black Mage Village by either going North or South. While it is faster","to reach it by the North, we have to take the same ship to reach the Desert Palace after.","And when we add the two trips, it is overall faster to go South by a couple seconds.")
comments(1230400,1231000,"Kuja's hideout is the pit that doesn't spit sand. All the other trigger a fight.","Also big Dialog RNG after getting into it.")
comments(1236200,1236900,"We need all the biggest damage dealers but Freya to come with us to Oeilvert. The","fourth companion will be Eiko, simply because she has the shortest selection scene.")
comments(1241500,1241900,"The Danger doesn't rise very fast here, but this is a very long screen, so there are","many encounter checks.")
comments(1251500,1252500,"We have a very long trip on foot to reach Oeilvert. It would have been faster to go","call a Chocobo and ride it, but that would mean we have to activate the possibility of","a ride in Disc 1, which would take more time than it saves here.")
comments(1255700,1256400,"We buy some Mantra Band, Green Beret and Cross Helm for their abilities. The Gold","Helm is to be able to change our magic defense against the final boss.")
comments(1257800,1258150,"Up+Right reaches the entrance faster than Up.")
comments(1261700,1262300,"The exit on top of the screen leads us directly to the one we want to reach. No need","to take a grand detour by the bottom.")
comments(1272700,1273500,"We equip Zidane with a Green Beret to teach him Clear-Headed which will prevent","Confusion for the next fight. The rest of the equipping is just to earn AP towards","important abilities.")

battle(1275037,1278998,"Ark",false,20002,5280,1)

comments(1275037,1276100,"Ark owns a Holy Lance. In addition to an accessory that raise Holy attack, it becomes","the most powerful weapon for Freya. So Zidane needs to steal it, while Eiko set him","up for Lucky Seven, and Amarant use Throw as it does way more damage than a","regular attack at this point (About 2000 more.)","","The Holy Lance succesful steals are in Yellow Bars below.")
comments(1277900,1278350,"If Zidane weren't immune to Confusion, it would force a regular attack instead of","Lucky Seven, which is why we had to put Clear-Headed on him.")
comments(1283100,1283800,"For the next minigame, the movement of the monster are based on RNG. I tried many","different combinations to come up with this one. It is the closest to perfect I could get.")
comments(1283801,1284300,"You can't move while it's watching you. Unfortunately, it stares a little longer here at","the beginning, but the rest is very fluid.")
comments(1284700,1285000,"The correct way to do this part is to put weights B,C and D and then climb.")
comments(1289100,1290300,"We have to light every candlesticks in the Desert Palace to activate the exit. As a side","effect, lighting some candlestick, makes a Bloodstone active. And for every","Bloodstone active, there is an enhancement of the next Boss stats.","","We have to deactivate two Bloodstones in order to have the fastest fight, the others are","pointless.")
comments(1294300,1295400,"This Bloodstone, for exemple, makes the Defense of the boss so high that physical","attacks barely scratch him, so it needs to be deactivated.","The first one disabled Elemental Attacks, so by deactivating those two, we have the","highest damage we can do with the Holy Lance.")
comments(1301155,1302350,"We equip Freya with the Holy Lance, Angel Earrings, Cross Helm and Bronze Armor.","Since we enabled Elemental Attacks, Angel Earrings add 50% damage to the Holy","Lance, Bronze Armor activate the Bird Killer ability for another extra 50% and Cross","Helm teaches MP Attack for yet another 50% !!!")

battle(1305102,1306058,"Valia Pira",true,12120,5440,1)

comments(1305102,1305400,"Blue Bars for Freya's Critical.")
comments(1305700,1306100,"We have to delay Freya's attack a little bit, since we need a high damage roll to end","the fight.")
comments(1310000,1310900,"When we have to use a teleport like this one, it's important to put Zidane on the right","spot, facing the right direction before pressing X. Otherwise, he'll move by himself","but way slower. So we need to overshoot and turn back.")
comments(1319000,1319750,"You will be forced to have Vivi in your team for the next part, so to avoid the","appearance of the select menu an additional time and save frames, it's better to select","him right away.")
comments(1334900,1335900,"Quick detour to do some shopping. We need to buy a Flame Saber, Diamond Gloves","and a Judo Uniform.","Flame Saber can inflict Heat. When under Heat, if the enemy initiates a move, whether","it was queued before or after, he will instantly die. Many are immune to it though.")
comments(1338800,1339800,"Steiner takes the Flame Saber for Heat, and Freya equips the Rebirth Ring. It also","has the Holy Element, but it makes her Spirit go over 27 which will give us an extra","opportunity to Critical she wouldn't have with Angel Earrings.")

battle(1340766,1341422,"Red Dragon",false,8000,5440,1)
battle(1340766,1341422,"Red Dragon",false,8000,5440,2)

comments(1340766,1341200,"Steiner has a 24/256 chance to inflict Heat.","","Steiner inflicts Heat with Red Bars","Freya's Critical in Brown and Blue Bars below (thanks to the Rebirth Ring)")
comments(1342350,1343150,"Steiner takes back the Coral Sword and Diamond Gloves to learn Charge! while Freya","has to reequip the Angel Earrings, because her Spirit won't matter next, but the extra","points of Strength will.")
comments(1350200,1350500,"Eiko's name mentionned in unskippable texts.")
comments(1352500,1352800,"This fight has a fixed length. RNG doesn't matter.")

battle(1362408,1364128,"Meltigemini",false,24348,3680,1)

comments(1362408,1363400,"There are lots of opportunities for a Critical in the first round, but they are badly placed.","Manipulating the faster of them would end up 200 frames slower than making one in","the second round. Manipulating 2 in a row, would save an attack but still be a couple","frames slower","","Still Blue Bars for Criticals.")
comments(1380400,1380850,"There are a couple of Dialog RNG in the whole sequences of dialogs from now that are","manipulated but they're very small.")
comments(1413900,1414700,"We need to slightly delay the moment we're asked to choose our team so the pointer is","on an even address and not odd. It's important for Dialog RNG in Ipsen's Castle.","Note that it's true for this TAS in particular not as a general rule.")
comments(1417800,1418000,"Here is the important Dialog RNG part.")
comments(1418800,1419400,"Also, when you're prompt to choose whether letting Amarant go or not, choosing not is","about one second faster.")
comments(1420300,1420700,"Only Zidane and Steiner are important for the boss fight. Quina is chosen because he is","the one with less dialogs on the way back.")
comments(1427050,1427350,"We equip the Flame Saber back to inflict Heat.")
comments(1428600,1429200,"The RNG plays a part in how fast Taharka jumps on us to start the fight.","We need a combination of fast start and good fight.")

battle(1430583,1431035,"Taharka",false,29186,5120,1)

comments(1430583,1431300,"We need to inflict Heat and steal the Orichalcon before Taharka takes its turn.","It is extremely more powerful for Zidane than what he can currently have.","","Red Bars to inflict Heat and Yellow Bars for the steal.")
comments(1435400,1435750,"This is the part where we need Quina. Other characters take longer in this sequence.")
comments(1439400,1440550,"We can reach the floor below by either using a trap or the pole. While it makes very","little difference in term of time spent moving, the loading transition is about one second","faster with the pole, making it the way to go on this version.","Note that it may be faster to use the trap on a PS2 or other emulators.")
comments(1447700,1448200,"We could reach the first destination 3 frames sooner, but this position of the pointer","is needed to manipulate its one later.")
comments(1452300,1453100,"Because of the delay on the first destination, the pointer movement will slow down","faster there, giving us access to earlier Random Numbers. It's gonna be important for","a good Earth Guardian fight.")
comments(1460500,1460900,"The Orichalcon will boost Zidane's damages tremendously. We also equip Distract so","enemies miss more frequently.")
comments(1462700,1463700,"Like Taharka, the Earth Guardian will initiate the fight more or less quickly based on","RNG. The difference can be measured in seconds, so we need once again, a good","combination of quick start and good fight.")

battle(1464625,1466177,"Earth Guardian",false,20756,4800,1)

comments(1464625,1466177,"Quina has the ability to Eat some enemies if their HP is lower than 25% of their max.","Against Earth Guardian, it is very powerful because, once he has less than 5190 HP,","Eat will immediately kill him. The fastest way to get him this low is a regular attack","and a Critical from Zidane. Quina attacks him/herself then to trigger a miss from the","enemy.","","Critical in Blue Bars below.")
comments(1469500,1469800,"Answering 'I don't know' to Amarant is the fastest option.")
comments(1483400,1484200,"We remove the Yellow Scarf from Dagger to reduce her damage output, and equip","Zidane with HP+20%. Both of them are going to be needed in the Pandemonium","fights.")
comments(1497800,1498400,"We have to visit the screen all the way to the right before being allowed to progress.","It's around 100 frames faster to do it by the south.")

if emu.framecount()>1517511 and emu.framecount()<1519187 then
 gui.drawText(700,380,"Amdusias","White","",18,"Times New Roman");
 gui.drawText(700,405,"HP = Invincible","White","",18,"Times New Roman");
 gui.drawRectangle(700,430,102,25,"White");
 gui.drawRectangle(701,431,((memory.read_u16_le(0x109268))/4800)*100,23,"Green","Green");
end;

battle(1519186,1519364,"Amdusias",true,10926,4800,1)
battle(1519363,1520151,"Amdusias",false,5463,4800,1)

comments(1517511,1518000,"This is a 3 phases battle. In Phase 1, we just have to survive Bio and wait for Amdusias","to take off the ground. HP+20% saved the day.")
comments(1519186,1519500,"In Phase 2, we need to get it under 5463 HP. Done with a simple hit from Zidane.")
comments(1519501,1519800,"Finally the final blow for Phase 3.")

if emu.framecount()>1522794 and emu.framecount()<1525174 then
 gui.drawText(700,380,"Abadon","White","",18,"Times New Roman");
 gui.drawText(700,405,"HP = Invincible","White","",18,"Times New Roman");
 gui.drawRectangle(700,430,102,25,"White");
 gui.drawRectangle(701,431,((memory.read_u16_le(0x109268))/4800)*100,23,"Green","Green");
end;

battle(1525173,1525722,"Abadon",false,10926,4800,1)


comments(1522794,1523500,"This one is a 2 phases battle. Phase 1 ends when Abadon has its ATB full for the third","time. We can attack as we want to put the pointer at a better location without time loss.")
comments(1524000,1524700,"We can skip a few seconds sequence between phases by having Steiner die, but since","we need him to deal damage on Phase 2, it's not worth it.")
comments(1525173,1525450,"Steiner and Zidane's Critical in Brown and Blue Bars below.")

if emu.framecount()>1528659 and emu.framecount()<1530239 then
 gui.drawText(700,380,"Shell Dragon","White","",18,"Times New Roman");
 gui.drawText(700,405,"HP = Invincible","White","",18,"Times New Roman");
 gui.drawRectangle(700,430,102,25,"White");
 gui.drawRectangle(701,431,((memory.read_u16_le(0x109268))/4800)*100,23,"Green","Green");
end;

battle(1530238,1532099,"Shell Dragon",false,10921,4800,1)

comments(1528659,1530000,"2 phases battle again. First one end as soon as Zidane is in Critical HP (Yellow).","There are several ways to achieve that. The easiest is to have Auto-Life and suicide.","However, this would mean that Shell Dragon acts first in Phase 2 which we don't","want. But we can let it attack us with Charge and run away at the same time to multiply","its damage by 1.5.","That way we are in Critical with full ATB.")
comments(1530238,1530500,"Final Phase and Zidane's Critical in Blue Bars below.")
comments(1530501,1531100,"This is the reason why we unequipped the Yellow Scarf from Dagger. So she can deal","exactly 45 damage to Zidane and set him up for Lucky Seven.")
comments(1535600,1536000,"We buy a Defender and an Avenger to boost Steiner and Amarant's attack. Also two","Coronets to be immune to Wind attack.")
comments(1536800,1537700,"We have to press the button to make a bridge appear on the next screen. But it also","brings some blue lights to life.","Under normal circonstance, going near a blue light triggers a fight, but by carefully","positionning ourselves we can avoid the trigger zones.")
comments(1537800,1538100,"Height 4 is the one you need to progress.")
comments(1541750,1542750,"Steiner get his new weapon, Amarant does too in addition of the Chain Plate to learn","Devil Killer. Zidane doesn't need HP+20% anymore, so he retakes Distract.","Freya was automatically put in back row, so don't forget to change that.")

battle(1544649,1545753,"Silver Dragon",true,24055,1600,1)

comments(1544649,1545500,"We have to let the enemy take the first turn, so we can Critical and stop the fight in","four attacks. Because of its speed, Silver Dragon would get two turns before Amarant","can reattack otherwise.","","Critical with the Brown and Blue Bars below, except for Amarant. He cannot Critical.")

battle(1548763,1551267,"Garland",true,40728,1600,1)

comments(1548763,1549600,"We could have had Steiner or Freya learn Locomotion in order to prevent Stop, but","since having Amarant attack doesn't save a turn, it would have been a waste of time","menuing. So instead, he takes the hit and let the others attack.","","Critical in Brown and Blue bars.")
comments(1550700,1551200,"Natural miss here. No help from Distract.")

battle(1556464,1559196,"Kuja",true,42382,1600,1)

comments(1556464,1556900,"Once again, we let the enemy attack first so we can Critical.","","Critical in Brown and Blue bars.")
comments(1557400,1557800,"Zidane steals a Carabini Mail, so we can manipulate the Speed stat of Steiner.")
comments(1565000,1565300,"Important Dialog RNG.")

comments(1585847,1586100,"Disc 3 in 7h19m45s17")

--End of Disc 3

comments(1591800,1592800,"We have optimized our equipments at the end of Disc 3 for the last 3 fights AND this","one coming. It's better to have a slightly longer fight than going back to the menu.","It would require to go On Deck -> Menu -> On Deck -> Flight which would cost","more than 20 seconds.")

battle(1601551,1604811,"Nova Dragon",true,54940,1600,1)

comments(1601551,1601850,"Critical in Brown and Blue Bars except for Amarant who cannot.")
comments(1602000,1602400,"Thanks to the Coronets, everybody survive the first attack.")
comments(1603100,1603800,"Freya does a Critical and gets targeted. Every character but one needs to die in this","fight to set up Charge! on the next one.")
comments(1604000,1604700,"Nova Dragon can counter our attacks. We abuse that to kill Zidane, then suicide","Amarant. Since he cannot Critical, Steiner must deal the finishing blow.")
comments(1613400,1614400,"We pick up Zidane's final weapon, The Tower. However, we won't use it right away,","as it would change Zidane's Speed. But the time spent collecting Zidane, Amarant","and Steiner's final weapons will be compensated by the time they will save against","Deathguise alone.")
comments(1614401,1614900,"Steiner equips the Rebirth Ring. It will boost his future weapon of Holy-element, like,","Excalibur II, for example. It also has Auto-Life, which can be useful, maybe.")

battle(1616315,1620627,"Maliris",false,59497,1760,1)

comments(1616400,1617400,"Charge! is an ability from Steiner that automatically makes our characters in critical","HP attack, without the risk of triggering a counter. But it takes a little bit of time to","launch, so it needs to save a round to be useful.","","As always, Critical in Brown and Blue Bars except for Amarant who cannot.")
comments(1620230,1620480,"Oops, we're dead....")
comments(1620481,1620750,"Ah ! Told you Auto-Life might be useful.")
comments(1624600,1625000,"In this screen, the pointer doesn't move but the Random Number table is changed","every frame.")
comments(1627200,1628300,"We equip our characters with Speed boosting equipment so they all act first in the next","fight. Freya also gets Dragon Killer.","We stayed a little bit longer than necessary on this screen to manipulate the Random","Numbers table to our liking. This also explain why we do the menuing on this screen","and not the next one.")
comments(1629200,1629450,"Picking up Amarant's final weapon, Rune Claws.")

battle(1630577,1633901,"Tiamat",false,59494,1760,1)

comments(1630577,1631050,"Freya is the one dealing the most damages. So we let her do the Critical hits with","Brown and Blue Bars below.")
comments(1640200,1640600,"There is an optional Boss, Hades, behind the rocks on the right. Obviously pointless in","an any%")

battle(1643406,1649182,"Kraken",true,55535,3360,1)

 if emu.framecount()>1643406 and emu.framecount()<1649182 then

if memory.read_u16_le(0x109404)<55535 then hp=0
else
hp=memory.read_u16_le(0x109404)-55535
end;

 gui.drawText(900,380,"Left Tentacle","White","",18,"Times New Roman");
 gui.drawText(900,405,"HP = "..hp.."/10000","White","",18,"Times New Roman");
 end;

 if emu.framecount()>1643406 and emu.framecount()<1649182 then

if memory.read_u16_le(0x109334)<55535 then hp=0
else
hp=memory.read_u16_le(0x109334)-55535
end;

 gui.drawText(1100,380,"Right Tentacle","White","",18,"Times New Roman");
 gui.drawText(1100,405,"HP = "..hp.."/10000","White","",18,"Times New Roman");
 end;

comments(1643406,1644150,"To start the battle, we need to get rid of the Tentacles. They can be injured by Charge!","but not killed. So we need at least one of our own to hit one with Charge! and have","the others finish them.")
comments(1644900,1645250,"Since each Tentacle has 10000 HP, a Critical against them is pointless.")
comments(1647500,1647900,"This Critical Blue Bar, would have take way too much time to manipulate to be worth","it.")
comments(1648300,1648700,"And this one triggers a 8 seconds counter that makes it useless as well.")

battle(1654255,1657023,"Lich",false,58554,1760,1)

comments(1654255,1654650,"We unfortunately cannot get this first Critical, since it would be a Miss.")
comments(1657800,1658500,"Because we are under the 12 hours mark, we can take Excalbur II, Steiner's final","weapon. And now everybody has the equipment to do the maximum damage.")
comments(1663050,1663600,"We give everyone their final weapons and equipment that will change their Speed stat","to where we want them.")

battle(1667677,1669705,"Deathguise",true,55535,1760,1)

comments(1667677,1668550,"This is where the final weapons are going to pay off. Thanks to the extra points of","attack, if Freya Critical twice, we can kill Deathguise before he has the chance to cast","Meteor. Which is a huge timesave.","","Brown and Blue Bars for Freya to Critical.")

battle(1673294,1675626,"Trance Kuja",true,55535,1600,1)

comments(1673294,1674300,"Trance Kuja is a simple formality. The only requirement is to have Steiner act first.","He will counter with Flare Star when his HP are down under 50%, unless, it reaches","this point through Charge!","So, the strategy is to get him just above 50%, then Charge! and finishing blow.")
comments(1680250,1680500,"Important Dialog RNG coming up.")
comments(1683750,1684350,"Equipments are adjusted so everybody survives Necron's first attack, while at least","three of us go to Critical HP.")

battle(1686804,1690000,"Necron",true,54100,5920,1)

if emu.framecount()>1686804 and emu.framecount()<1690000 then

for i=2,4 do
 gui.drawRectangle(700+(i-1)*150,430,102,25,"White");
 gui.drawRectangle(701+(i-1)*150,431,((memory.read_u16_le(0x109268+(i-1)*208))/9440)*100,23,"Green","Green");
 end;

end;

comments(1686804,1687500,"Necron has the particularity to have 4 ATB. Each one can trigger a move based on","certain requirements. Here we use the first one to cast Firaga on us and leave 3","characters in Critical HP.")
comments(1688500,1690000,"ATB 1 tries to cast Blue Shockwave on Zidane, fails and reset.","We put ATB on Wait while Zidane attack so he can act again before ATB 1. This is","important because ATB 1 next move is Grand Cross and a guaranteed Game Over.","","ATB 4 was ready to cast Protect, but because at least 3 characters are in Critical or","dead, it also fails and resets.")
comments(1690000,1690500,"There are still little Dialog RNG left, but I'll let you enjoy the ending...")


comments(1659600,1660250,"While the Danger Value is 0, it is possible to get an encounter here. It's because the","check is performed on the Distance travelled and not RNG on this screen.")

 emu.frameadvance();
 end;