1 2
11 12 13 14
Editor, Player (54)
Joined: 12/25/2004
Posts: 634
Location: Aguascalientes, Mexico
I was just thinking on PM you asking for this, thanks :D. I want to do something similar for FFV & this is what I currently have (most tables are NOT used at the moment, but I'm thinking on making the script as complete as possible, eventually...): FFV lua script, by samurai goroh I still have to find a sure way to determine how to hide or display the information while in battle & other small tweaks, but that can easily be added :) BTW, could you tell me which emulator version should I stick while making the script? I tried on the version I made my run (snes9x 1_43 v17), but tried on some newer versions & some functions don't work (like the transparency)...
I'm the best in the Universe! Remember that!
Former player
Joined: 5/4/2005
Posts: 502
Location: Onett, Eagleland
I was using 1.51. Transparency works for me. You just use the alpha channel to specify it. I.E. gui.text(100,100,"Mytext",0xFFFFFF00) 0xFFFFFF00 = Alpha channel 00 = transparent FF = opaque.
I think.....therefore I am not Barry Burton
caitsith2
He/Him
Player (47)
Joined: 3/26/2004
Posts: 194
Made a massive tweak to the findenemy function, so that the search does NOT slow the emulator down significantly.
local function enemygroupexists(num)

	local area = memory.readbyte(0x7E1700)
	local group = 0
	local x = 0
	local x2 = 0
	local val1 = 0
	local val2 = 0
	local val3 = 0
	local rollover = false
	local rollover2 = false
	local i = 0
	local j = 0
	
	if area == 0 then
	-- Earth world map
		
		
			val1 = bit.band(bit.rshift(memory.readbyte(0x7E1707),2), 0xF8)
			x = (bit.rshift(memory.readbyte(0x7E1706),5) + val1)  % 0x100
			val2 = bit.lshift(memory.readbyte(0x0ec542+x),3)
			

			for j = val2, val2+7 do
				if num == memory.readbyte(0xEC796+j) then
					group = 1
				end
				if memory.readbyte(0x7E1701)  > 0 then
					if num == (memory.readbyte(0xEC796+j)+0x100) then
						group = 1
					end
				end
			end

	
	elseif area == 1 then
		-- Underground world map
		
		
		
			val1 = bit.band(bit.rshift(memory.readbyte(0x7E1707),3),0xFC)
			x = bit.rshift(memory.readbyte(0x7E1706),5)
			x = (x + val1)  % 0x100
			val2 = bit.lshift(memory.readbyte(0x0ec582+x),3)
			
			
			for j = val2, val2+7 do
				if num == memory.readbyte(0xEC796+j) then
					group = 1
				end
				if memory.readbyte(0x7E1701)  > 0 then
					if num == (memory.readbyte(0xEC796+j)+0x100) then
						group = 1
					end
				end
			end
			
		
		
	elseif area == 2 then
	--Moon world map
		
		
			if memory.readbyte(0x7E1707) > 0x20 then
				x = 2
			end
			
			if memory.readbyte(0x7E1706) > 0x20 then
				x = x + 1
			end 
			
			val2 = memory.readbyte(0x0EC592 + x)
			val2 = bit.lshift(val2,3)
			
			for j = val2, val2+7 do
				if num == memory.readbyte(0xEC796+j) then
					group = 1
				end
				if memory.readbyte(0x7E1701)  > 0 then
					if num == (memory.readbyte(0xEC796+j)+0x100) then
						group = 1
					end
				end
			end		
			
		
		
	elseif area > 2 then
	
		
		--Dungeon
			val1 = memory.readbyte(0x7E1702)
			
			if memory.readbyte(0x7E1701) > 0 then
				val1 = val1 + 0x100
			end
			
			val2 = bit.lshift(memory.readbyte(0x0EC596+val1),3)	
			
			for j = val2, val2+7 do
				if num == memory.readbyte(0xEC816+j) then
					group = 1
				end
				if memory.readbyte(0x7E1701)  > 0 then
					if num == (memory.readbyte(0xEC796+j)+0x100) then
						group = 1
					end
				end
			end
			
		
		
	end
	
	return group
	
end

local function findenemy(e,x)
 
	local c = 0
	local i = 0
	local result  = ": "

	if enemygroupexists(e) == 0 then
		result = "(Enemy not present in area)"
		return result
	end
	
	while c ~= x  do
		
		if enemygroup(i) == e then
			c = c +1
		
			if c ~= x then
				result = result .. i .. ","
			else
				result = result .. i
			end
			
		end
		
		i = i + 1
		
		if i >= 500 and c == 0 then
			result = "(Enemy not present in next 500 battles)"
			c = x
		end
	end
  
	result = retrievegroup(e) .. " (" .. string.format("%X",e) .. ")" .. result
	return result
	
 end
It now checks to see if the group is present in one of the 8 possible battle groups, before actually searching at least the next 500 battles for that group. (with slowdown only possibly present for rare groups, when it does exist in current area.)
Editor, Player (54)
Joined: 12/25/2004
Posts: 634
Location: Aguascalientes, Mexico
Pasky13 wrote:
Here is the Lua script I made that shows the ATB for players/monsters, random encounter steps, and next encounter groups. Like I said, it isn't the prettiest or well optimized code, but it did what I wanted. http://pastebin.com/sbfm9yfK http://www.multiupload.com/A4EQBBCV5R
Since you mentioned that you won't likely change the code & that caitsith2 made some change, I incorporated it in this new version of your code: FFIV LUA script Basically the changes I did were 2, moving the enemy group information into a table, that should speed that part greatly. The other change was to reduce code, for readability & simplicity.
I'm the best in the Universe! Remember that!
caitsith2
He/Him
Player (47)
Joined: 3/26/2004
Posts: 194
samurai goroh wrote:
Pasky13 wrote:
Here is the Lua script I made that shows the ATB for players/monsters, random encounter steps, and next encounter groups. Like I said, it isn't the prettiest or well optimized code, but it did what I wanted. http://pastebin.com/sbfm9yfK http://www.multiupload.com/A4EQBBCV5R
Since you mentioned that you won't likely change the code & that caitsith2 made some change, I incorporated it in this new version of your code: FFIV LUA script Basically the changes I did were 2, moving the enemy group information into a table, that should speed that part greatly. The other change was to reduce code, for readability & simplicity.
Did you make sure to fill in the gaps in his table transcription? That last entry of your table, ends at 0x176 instead of the expected 0x1DF, because pasky skipped ALL enemy formations that are NOT in random encounters. Even if they are not used, they still need to be in the table, in order for 0x1DF to line up with the very last entry. EDIT: Created a new paste version, filling in skipped entries with "Unknown", and removing duplicate entries. (There were a few duplicate entries, with duplicate group number, which is no problem for if then else, but is a big problem with a look-up table.) FFIV LUA script
Editor, Player (54)
Joined: 12/25/2004
Posts: 634
Location: Aguascalientes, Mexico
Nope, I assumed that the list was complete, so I only removed the lines in between the if then else statements. No wonder why yesterday I was watching the TAS & noticed that at some point of the run, the group wasn't accurate as in the beginning... Thanks for the catch caitsith2
I'm the best in the Universe! Remember that!
Former player
Joined: 5/4/2005
Posts: 502
Location: Onett, Eagleland
Nice on improving that script. I didn't think to make a table, I bet that speeds it up tremendously since it doesn't check if it isn't a value but just straight goes to the value. I'm not that experienced with lua but glad people are improving it :).
I think.....therefore I am not Barry Burton
Former player
Joined: 5/4/2005
Posts: 502
Location: Onett, Eagleland
New glitch: Link to video
I think.....therefore I am not Barry Burton
Sir_VG
He/Him
Player (40)
Joined: 10/9/2004
Posts: 1913
Location: Floating Tower
I think my brain just exploded there. That was...totally bizarre. I wonder if it works in the US version?
Taking over the world, one game at a time. Currently TASing: Nothing
Former player
Joined: 5/4/2005
Posts: 502
Location: Onett, Eagleland
I'm curious if there is a similar counter in FFV and if it can be exploited as well.
I think.....therefore I am not Barry Burton
Joined: 7/2/2007
Posts: 3960
Okay, so here's my best guess as to what's going on there: * The spell Warp has to remember the sequence of rooms you passed through so it can take you to the previous one. Therefore there's an array of 64 "room histories". Normally not a problem since most regions are heirarchical (i.e. you couldn't overflow the array unless there was a chain of rooms of length 64), but the Dwarf Castle rooms all loop, so instead of backing you out a room when you backtrack, the old room is appended onto the end of the array. * Overflowing the array index causes it to go negative and read from your message speed and window color settings, which in turn allows you to teleport to various points in the game. * Somehow it also lets you muck up FuSoYa's spell list, so he ends up with Explode as a spell. This lets you instantly end the Zeromus fight. * Cid is terrible at casting Meteo.
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Sir_VG
He/Him
Player (40)
Joined: 10/9/2004
Posts: 1913
Location: Floating Tower
Derakon wrote:
Okay, so here's my best guess as to what's going on there: * The spell Warp has to remember the sequence of rooms you passed through so it can take you to the previous one. Therefore there's an array of 64 "room histories". Normally not a problem since most regions are heirarchical (i.e. you couldn't overflow the array unless there was a chain of rooms of length 64), but the Dwarf Castle rooms all loop, so instead of backing you out a room when you backtrack, the old room is appended onto the end of the array. * Overflowing the array index causes it to go negative and read from your message speed and window color settings, which in turn allows you to teleport to various points in the game. * Somehow it also lets you muck up FuSoYa's spell list, so he ends up with Explode as a spell. This lets you instantly end the Zeromus fight. * Cid is terrible at casting Meteo.
The entire text was translated and a link in the YouTube video's comments. Here's the link which discusses the bug: http://matotree.com/2012/08/final-fantasy-iv-the-legendary-64-room-levels-bug/ There's also another bug discussed on that site, which talks about a position skip (they refer to it as the Sliding Glitch), allowing you to do things like skip past Mist. http://matotree.com/localization/final-fantasy-iv/mist/ (The video and info about it as down near the bottom of the page.)
Taking over the world, one game at a time. Currently TASing: Nothing
Joined: 11/22/2004
Posts: 1468
Location: Rotterdam, The Netherlands
Just for the record, here is the original ニコニコ link for that glitch video: Link to video
Sir_VG
He/Him
Player (40)
Joined: 10/9/2004
Posts: 1913
Location: Floating Tower
While fooling around with the sliding glitch, here's what I've been able to do so far. 1. Obviously, skip Mist Village stuff. This keeps Kain in the party. 2. The scenes at Kaipo still happen and Rydia will automatically be put into the party. This does NOT remove Kain. 3. Tellah didn't appear at his blockade spot at the cavern. The campfire scene still occurs (he isn't put into the party, nor is Kain removed). Tellah's lines at the spots of the cave still occur. I'm trying to figure out how to skip the bombing scene, but I haven't been able to yet. I also assume that you do NOT need to visit Kaipo, since Tellah isn't where he would be. I assume his placement there is added during/after the scene at Mist Village. I'm gonna continue anyways to see how much can be skipped. Ultimately the goal would be to get to the underground castle ASAP so you can skip to the end of the game. If you can't proceed w/o saving Rosa, then there may be an issue with too many members in the party once you get to Yang, since normally at that point you'd have 4 (and Yang is the 5th). It'll be very interesting to see how this all plays out. Edit 1: If Tellah is not in the party when you get to the scene where Edward would appear at Damcyan Castle, the game crashes when the battle would start. Unfortunately, this causes an issue, since you can't proceed w/o the hovercraft. The gaps in the water/mountains seem to be too wide, plus the glitch isn't working for me now suddenly. But without the hovercraft, you can't go over to Mt. Hobs, so this is a real issue, since as mentioned earlier, no Tellah = crash. So this may be a problem and not as good of a glitch as I was hoping it would be. Edit 2: Even if you enter the scene from the wrong side, Kain will vanish from the party if some later sequence isn't triggered. I know Kaipo works, but I'm not sure on other things. It will be fun to try out. Edit 3: Tellah, as expected, does not appear even if you skip Kaipo. The campfire sequence happens the same, with Tellah and Rydia magically appearing on scene. No party changes after the scene occur.
Taking over the world, one game at a time. Currently TASing: Nothing
Joined: 7/2/2007
Posts: 3960
Sir VG wrote:
I'm trying to figure out how to skip the bombing scene, but I haven't been able to yet. I also assume that you do NOT need to visit Kaipo, since Tellah isn't where he would be. I assume his placement there is added during/after the scene at Mist Village.
Another possibility is that his presence is governed by the number of people in the party. Since you had 3 (Cecil/Kain/Rydia) the game assumed you already had Tellah.
Edit 1: If Tellah is not in the party when you get to the scene where Edward would appear at Damcyan Castle, the game crashes when the battle would start.
Hypothesis: Tellah's character information needs to be initialized for him to appear in battle. Fortunately, the only other characters who show up in automated fights (Yang, Edge, arguably Cecil) show up in those fights during their introduction. Well, and Tellah shows up again when he Meteos Golbez. As for having a sixth character in the party, I imagine it'd cause Bad Things to happen. Possibly exploitable bad things!
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Sir_VG
He/Him
Player (40)
Joined: 10/9/2004
Posts: 1913
Location: Floating Tower
Derakon wrote:
Sir VG wrote:
I'm trying to figure out how to skip the bombing scene, but I haven't been able to yet. I also assume that you do NOT need to visit Kaipo, since Tellah isn't where he would be. I assume his placement there is added during/after the scene at Mist Village.
Another possibility is that his presence is governed by the number of people in the party. Since you had 3 (Cecil/Kain/Rydia) the game assumed you already had Tellah.
After further testing, it is not party count based, but position based. Cecil/Kain only party will still trigger it. Which the crash will still occur then at Damcyan, much like a Cecil/Kain/Rydia party. So unless Tellah is put into the party or a way to get past that trigger point is found, well... Also, Kain is pretty worthless for the Octomamm fight. He does like 1/2 the damage Cecil does while jumping and about 1/4 the damage while fighting. He also takes a boatload more damage. Edit 1: Entering and immediately exiting Kaipo will not prevent a removal of Kain from the party if you reenter Mist for the Package trigger. Edit 2: Kain is removed from the party but Rydia is not if you go though the Inn sequence at Kaipo then head back to Mist. Visiting Rosa doesn't change the matter either. So unless there's someway to skip the bombing sequence, skipping Mist will be pointless. :( Edit 3: The author I linked above says on the mist page "If you’ve never done this before, you can use this same trick to skip some other stuff, like the bombing of Damcyan. You can also have weird party arrangements this way." So it should be possible to skip the bombing...just need to figure out how. Edit 4: I figured out how to skip the bombing sequence. However, Damcyan castle is still destroyed and the spoony bard sequence (and subsequent game crash) still happens). In order to skip the bombing sequence though, you need to move 1 space below the trigger square, press Up then menu, save, and reset the game. You'll start anew on the trigger square but as long as you don't move onto it, the trigger won't happen. Still leaves the issue of skipping over to Mt. Hobs though. The water gap is 2 wide at the narrowest spot and right now I can only slide over 1 space. Edit 5: I put on a "save anywhere" code just to see what happens if you skip over the tile that triggers the Tellah/Edward battle. Edward is nowhere to be seen. The game also crashes if you "talk" to Anna (but everybody else is ok, but most everybody has nothing to say). So I think as amusing as the glitch seems to be, it's not going to be helpful for a TAS or speedrun, unlike the 64 floor stack glitch. I had high hopes, only to be crushed. :( Edit 6: The 64 Room Layers Bug works on the US version, though map directions for negative rooms is a bit different, plus you can't warp back to the developers room. But it works!
Taking over the world, one game at a time. Currently TASing: Nothing
Joined: 8/24/2012
Posts: 9
Hmmm... this 64 floors glitch has me thinking... would it be possible to get the same results of the Niconico video earlier in the game? Looking at one of the pages linked in the video translation (http://www.ric.hi-ho.ne.jp/cheap_restaurant/GAME/FF4/kaisoubug.html) it seems like there wouldn't be much hope for manipulating warps to other places because of how reliant floors like -7~-10 are on the Hovercraft/Black Chocobo positioning, but the Niconico video returns the Black Chocobo to the Chocobo Forest anyway, so is it possible it could be done as early as Antlion's Den since you have the Hovercraft? If not, maybe it would be possible to simply warp to somewhere closer in the game that would still skip a section of the run instead of all the way to the Falcon, where you could then wait until the Dwarf Castle to skip everything... Meh, it's simply a thought, and given the research that probably went into the video in the first place, if there was a faster way to skip everything they would have shown that instead. The link above gives a lot more information on the glitch, but seeing as I barely understood the table of what affects the negative floors there is no way I'm understanding the whole thing. Side note, but I find it amusing that all it takes is one big glitch in a game to come out to finally suck me into joining the forums... oh well :P
Sir_VG
He/Him
Player (40)
Joined: 10/9/2004
Posts: 1913
Location: Floating Tower
I tried playing around with that stuff earlier. I tried Baron Town, but all it did was put me in the NW corner of Baron Town with no way of escape. I didn't try it at any later location though. I'm guessing by "small room" they're referring to in the Antlion's lair is the room with the charm harp.
Taking over the world, one game at a time. Currently TASing: Nothing
Player (118)
Joined: 5/13/2009
Posts: 700
Location: suffern, ny
I know much later in the game you can warp to baron, this is where you find Yang again and subsequently fight him. Would there be a way to use the warp glitch get in there and skip most of the game? Also, nice with all the glitches, I played around with this and I did not think It could be broken, good job Sir VG and to whom ever discovered the glitch. I love hearing and reading about all of this Project!
[19:16] <scrimpy> silly portuguese [19:16] <scrimpy> it's like spanish, only less cool
Joined: 8/24/2012
Posts: 9
Sir VG wrote:
I tried Baron Town, but all it did was put me in the NW corner of Baron Town with no way of escape.
Mmm, same with Kaipo. It was only on floor -2 too, so since that floor's all triggers from the Ship, that means anything that might be possible is pushed all the way back to Mysidia. That is, of course, assuming floor -2 does the same thing for everything up until then. It might not because of differences in the map, etc., etc., but I have my doubts... Edit: Ah, just realized it wouldn't even matter because where you warp isn't at all affected by where the glitch is performed, so it looks like Mysidia is the first place anything interesting might happen...
Sir_VG
He/Him
Player (40)
Joined: 10/9/2004
Posts: 1913
Location: Floating Tower
I've been trying to better understand the 64 room layer glitch, but right now I've been getting hung up on what should be map -3, which I'm winding up stuck in the upper left corner of Town of Baron. I think I'm gonna have to figure out how to look at the SRAM of the game in an emulator to better figure out what needs to be manipulated to figure out how we can do the glitch earlier. I've tried it as late as post-Kainazzo with no luck so far.
Taking over the world, one game at a time. Currently TASing: Nothing
Active player (435)
Joined: 9/27/2004
Posts: 650
Location: Canada
Sir VG wrote:
But without the hovercraft, you can't go over to Mt. Hobs
Can you use multiple tents to shift the collision detection multiple tiles?
Sir_VG
He/Him
Player (40)
Joined: 10/9/2004
Posts: 1913
Location: Floating Tower
Inzult wrote:
Sir VG wrote:
But without the hovercraft, you can't go over to Mt. Hobs
Can you use multiple tents to shift the collision detection multiple tiles?
Nope, it seems you can only do one square of shift, and I'd need 3. Plus the game remembers your position. The only good that the shift tiles glitch does is allow you to step on trigger squares w/o triggering the trigger. That's why you can skip Village of Mist. Normally you'd enter the town by stepping from a non-town square to a town square. However, by shifting the tiles, you trick the game into thinking you're on the tile for the life tile of town. When you reload, you're standing on the tile, but since you didn't MOVE onto the tile post-reload, the command to enter town doesn't happen. And the game allows you to move from a town tile square to another town tile square w/o re-entering the town. This is why you can skip Village of Mist, though it proves to be completely worthless, since the sequence in Village of Mist triggers Tellah to appear at the waterway. The only use for the glitch I've found so far is for skipping the bombing of Damcyan. As a funny side note, if you have the hovercraft on the map when the bombing occurs (you can restep on that tile later and trigger the sequence), the palette for the hovercraft gets messed up until you enter/exit an area. In other news, I spent a bunch of time trying to figure out an earlier spot to break the game, but so far have had no luck. I seem to get stuck on Floor -3 in the upper left corner of Baron. Why I'm getting stuck here I don't know, since according to the info on this page the Map ID and X/Y coordinates should be based upon the Big Whale (as far as I can tell from the translation). Since this info should not change based until I go to the Tower of Wishes to call it, this should not be stopping me at any early point in the game. So I'm not sure what's causing things to go wrong. I know a few X/Y coordinates on later maps will change because values are different between the US and Japanese version, but this shouldn't be one of them. I'm not going to be able to do more on a console. At this point to better research and understand the glitch, SRAM watching is going to HAVE to be used. I'll try to figure things out based upon a Engrish translated version of the SRAM Values List (Original Japanese version) SRAM watching is something new to me. I'm familiar with the concept...I just need to learn how to do it myself.
Taking over the world, one game at a time. Currently TASing: Nothing
Joined: 8/24/2012
Posts: 9
Floor -3? On the Japanese version, I'm getting stuck on Floor -2, not -3. Maybe there really is a difference on things you can do between the two?
Sir_VG
He/Him
Player (40)
Joined: 10/9/2004
Posts: 1913
Location: Floating Tower
In early spots I get stuck at what should be -2, while I believe it was post Fabul it appeared to be -3. I'm basing this assumption on # of screen transitions.
Taking over the world, one game at a time. Currently TASing: Nothing
1 2
11 12 13 14