[FE8] [Solved] Conditions issue

Hey there!

I’m trying to learn how to use conditions in FE8, and i’m having difficulty using IFET and IFEQ together. Ideally, I would like to have something occur the turn after another event is triggered.

[spoiler=“Event Data”]

TurnBasedEvents:
TURN 0x10 testing [2,0] 0x0
END_MAIN

MiscBasedEvents:
AREA 0x7 SpawnBaddies [0,5] [14,14]
END_MAIN

testing:
IFET 0x7
IFEQUAL 0xA0 0xC 0x1
LOAD1 0x1 testload
ENIF 0xA0
ENDA

SpawnBaddies:
CAM1 [7,10]
LOAD1 0x1 Swarm
STAL 70
ENUT 0x7
ENDA

testload:
UNIT Ephraim General 0x0 Level(5,Ally,True) [14,1] 0b 0x0 0x0 0x0 [IronLance, Vulnerary,0x0,0x0] [0x0,0x0,0x0,0x0]
UNIT

Swarm:
UNIT 0xAA 0x52 0x0 0xD [14,11] 0b 0x0 0x1 Zmove1 [0xAD,0x0,0x0,0x0] [0x0,0xA,0x2,0x0]
UNIT 0xAA 0x52 0x0 0xD [14,14] 0b 0x0 0x0 0x0 [0xAD,0x0,0x0,0x0] [0x0,0xA,0x2,0x0]
UNIT 0xAA 0x52 0x0 0xD [10,14] 0b 0x0 0x0 0x0 [0xAD,0x0,0x0,0x0] [0x0,0xA,0x2,0x0]
UNIT 0xAA 0x52 0x0 0xD [12,14] 0b 0x0 0x0 0x0 [0xAD,0x0,0x0,0x0] [0x0,0xA,0x2,0x0]
UNIT 0xAA 0x52 0x0 0xD [14,13] 0b 0x0 0x1 Zmove2 [0xAD,0x0,0x0,0x0] [0x0,0xA,0x2,0x0]
UNIT

[/spoiler]

I know there are probably other ways that I can do this, what with the AFEV code, but I would really like to learn to use conditions so that I can better design chapters.

As far as I understand, the IFET command puts a value (either 0 or 1) in the Memory slot 0xC, at least according to the Language Raws in my EA folder. I can’t seem to get the unit in “testing” to load, despite the SpawnBaddies event going off and spawning units.

Does anyone have an idea of what I might be doing wrong?

IFEQUAL 0xA0 0xC 0x1 will compare Slot 0xC with Slot 0x1, not the number 0x1.

You should instead use IFNE 0xA0 0xC 0x0, since the contents of Slot 0 will always be 0x0.

Oh, I forgot that I had made a minor change to that code as I was trying to troubleshoot. Originally, instead of

IFEQUAL 0xA0 0xC 0x1

I had

IFEQUAL 0xA0 0xC #0x1

And it assembled, didn’t give me any errors. Would that work at all, or should I avoid that?

Try it out, but I’m quite certain it won’t work.

IFEQUAL 0xA0 0xC 0x1 will compare Slot 0xC with Slot 0x1, not the number 0x1.

You should instead use IFNE 0xA0 0xC 0x0, since the contents of Slot 0 will always be 0x0.

This worked! I was making it harder on myself to figure out because I had changed it to check to see if the conditions had been met each turn, but didn’t set the event ID 0x10 back to being untriggered. I fixed that, they now look like this:

TurnBasedEvents:
TURN 0x0 label22 [2,0] 0x4
TURN 0x0 label23 [2,0] 0x0
TURN 0x8 label24 [1,255] 0x0
TURN 0x10 testing [1,255] 0x0
END_MAIN

MiscBasedEvents:
AFEV 0x3 EndingScene 0x6
AREA 0x7 label27 [0,5] [14,14]
AFEV 0x0 label28 0x65
END_MAIN

testing:
IFET 0x7
IFNE 0xA0 0xC 0x0
LOAD1 0x1 testunit
ENUT 0x10
ELSE 0xA1
ENIF 0xA0
ENUF 0x10
ENIF 0xA1
ENDA

testunit:
UNIT Ephraim Myrmidon 0x0 Level(11,Ally,True) [14,1] 0b 0x0 0x0 0x0 [Lancereaver,Vulnerary,Hammerne,0x0] [0x0,0x0,0x0,0x0]
UNIT

It now functions as intended.

Thank you for your help, circles! :grin:

By the way, I did some disassembling and found that the game uses a different method, which takes advantage of the fact that TURN already includes a conditional:

TURN 0xB Reinforcements [1,255] 0x0 - This event occurs every turn, but only calls the associated event if Event ID 0xB has not been triggered.

Near the end of the opening scene, the line ENUT 0xB triggers the event ID and prevents the turn event from activating.

Later, there is an AREA event that includes the line ENUF 0xB. This untriggers the event ID, which means the turn event will activate the turn after the AREA event.

Pretty clever.

2 Likes

FYI @TytoCorvus there’s a little checkbox you can click on that marks the topic as solved, so you can use that instead of putting SOLVED in the topic title :smiley:

Oh, all right!

Thank you! :grin: