• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
October 29, 2020, 11:58:26 am

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed. Find out how you can help in the Recruitment section.


A Quick BlockLoop Tutorial

Started by Jumza, July 14, 2020, 12:22:05 am

Jumza

July 14, 2020, 12:22:05 am Last Edit: July 14, 2020, 12:54:12 am by Jumza
Hey guys, I've created a quick event that shows how easy it is to use BlockLoop! As well as a companion video that you can view on youtube to follow along with while looking over the event instructions and comments I've written.

Wiki Links:
BlockLoop: https://ffhacktics.com/wiki/Event_Instruction_2A
BlockStart (Has valid block instruction list): https://ffhacktics.com/wiki/Event_Instruction_2F


The event itself is a little poorly planned lol, but hopefully you can see whats going on and get the idea! Please let me know if you have any questions, I'd be happy to explain any part of the event more.

Offset(x00002000)

SET(x007F,x0001)
//7F will control our loop that runs indefinitely until we tell it to stop (by setting it to 0000)
SET(x007E,x0005)
//7E will run 6 times since we set it to 5 and will set LoopAmount to 001 (# of loops = variable # + 1 with this setting)
SET(x007D,x0000)
//7D we don't care much about, BlockLoop is going to set it for us, same with 7C which I won't bother setting

UnitAnim(x04,x01,x0002,x00)

{63}(r79)
Camera(+00996,-00122,+00350,+00302,+00584,+00000,+04096,+00001)
Reveal(060)

//Ninja

BlockStart()
WalkTo(x54,x00,006,002,x00,x00,+012,x01)
WaitWalk(x54,x00)
UnitAnim(x54,x00,x0002,x00)
WalkTo(x54,x00,006,004,x00,x00,+012,x01)
WaitWalk(x54,x00)
UnitAnim(x54,x00,x0002,x00)
WalkTo(x54,x00,008,004,x00,x00,+012,x01)
WaitWalk(x54,x00)
UnitAnim(x54,x00,x0002,x00)
WalkTo(x54,x00,008,002,x00,x00,+012,x01)
WaitWalk(x54,x00)
UnitAnim(x54,x00,x0002,x00)
BlockLoop(000,x7F,x0000)
//By setting Loop Amount to 000, we have control over when the loop stops by setting 7F to 0000
BlockEnd()

//Bard

BlockStart()
Wait(00030)
WalkTo(x55,x00,010,000,x00,x00,+008,x01)
WaitWalk(x55,x00)
UnitAnim(x55,x00,x0002,x00)
WalkTo(x55,x00,010,005,x00,x00,+008,x01)
WaitWalk(x55,x00)
UnitAnim(x55,x00,x0002,x00)
BlockLoop(001,x7E,x0000)
//By setting Loop Amount to 001, variable 7E will not change initially, but be decreased by 1 each time the loop runs until it hits 0 and stops
BlockEnd()

//Dancer

BlockStart()
Wait(00030)
WalkTo(x56,x00,009,003,x00,x00,+010,x01)
WaitWalk(x56,x00)
UnitAnim(x56,x00,x0002,x00)
WalkTo(x56,x00,009,007,x00,x00,+010,x01)
WaitWalk(x56,x00)
UnitAnim(x56,x00,x0002,x00)
BlockLoop(003,x7D,x0000)
//By setting Loop Amount to 003, variable 7D will be set to 3, but be decreased by 1 each time the loop runs until it hits 0 and stops
Wait(00030)
UnitAnim(x56,x00,x0029,x00)
BlockLoop(003,x7C,x0000)
//By setting Loop Amount to 003, variable 7C will be set to 3, but be decreased by 1 each time the loop runs until it hits 0 and stops
//These nested BlockLoops actually cause this Block to loop 9 times, you can see that the extra Wait and UnitAnim that cause the dancer to start dancing occur every 3rd time because the first blockloop resets for each time the second one activates
BlockEnd()

Wait(00060)

DisplayMessage(x10,x11,x0001,x01,x00,x00,+00000,+00000,+00000,x02)
WaitForInstruction(x01,x00)

DisplayMessage(x10,x11,x0002,x01,x00,x00,+00000,+00000,+00000,x02)
WaitForInstruction(x01,x00)

DisplayMessage(x10,x11,x0003,x01,x00,x00,+00000,+00000,+00000,x02)
WaitForInstruction(x01,x00)

DisplayMessage(x10,x11,x0004,x01,x00,x00,+00000,+00000,+00000,x02)
WaitForInstruction(x01,x00)

DisplayMessage(x10,x53,x0005,x01,x00,x00,+00000,+00000,+00000,x02)
WaitForInstruction(x01,x00)

SET(x007F,x0000) //Stop the Ninja's BlockLoop, it will run to the end of the block before stopping
//The event will wait for the blocks to end before ending itself when EventEnd() is called
EventEnd()

//INSTRUCTION SECTION END -  TEXT START
//Message x01
{font:08}Jumza{br}
{font:00}Hey FFHacktics!{br}
I'm here to show you how to use BlockLoop!{end}

//Message x02
{font:08}Jumza{br}
{font:00}BlockLoop is used to turn regular{br}
Blocks into loops.{br}
These loops will run{br}
independently from the rest{br}
of your event.{br}
BlockLoop requires Xifanie's{br}
Event Instruction Hack ASM.{end}

//Message x03
{font:08}Jumza{br}
{font:00}Rather than explaining all the details,{br}
I'm just going to run quick demo's{br}
for the 3 different "kinds"{br}
of loops you can create based on{br}
the first parameter, Loop Amount.{br}
All the nitty gritty is{br}
posted on the wiki under{br}
Event Instructions (2F),{br}
and you can see all the{br}
instructions laid out{br}
on the FFHacktics forum.{br}
(Link's in the{br}
video description!){end}

//Message x04
{font:08}Jumza{br}
{font:00}Important notes to remember!{end}

//Message x05
{font:00}1. You can't end an event while a{br}
block is running.{br}
2. You can have multiple BlockLoops{br}
in a single block.{br}
3. You can still only use instructions{br}
that can be used in regular Block's.{br}
4. Jumping by number of bytes rather{br}
than to last BlockStart is possible!{end}

Jumping back by # of bytes is not covered in this tutorial
  • Modding version: PSX
Check out my project ~ FFT: A Stone's Ripple : http://ffhacktics.com/smf/index.php?topic=10857.0
The demo was just released! Come check it out!
Nyzer: Alma teleports out of her own possessed body.