[FE8] Check if unit is being rescued

Hello!
I was in need of a code that allowed me to check whether a unit is being rescued or not.
It should be formatted to work with SETVAL conditions, as you can see in this topic:


So, working with memory slots 1 and C, like it was already done in the past for other checks.

_SETVAL 0x1 0x1 // writes 0x1 at memory slot 0x1
ASMC offset // the ASM should do the check and write to slot 0xC
_SETCONDITION 0x1 0xC 0x0 // compares the value stored in 0x1 and 0xC
(insert events that play if the comparison results in a "true")
ELSE 0x1
ENIF 0x0
(insert events that play if the comparison results in a "false")
ENIF 0x1

So the ASM does the check and returns 0 or 1 to memory slot 0xC depending on the result, and then the events compare what is in slot 0x1 and in 0xC.

Can anybody do this please? :>

That would be very easy, I’ll have something today or tomorrow.

Here it is:

30 B5 0A 4C 62 68 00 2A 1A DD 09 4D 01 23 98 00 28 58 00 28 05 D0 01 68 00 29 02 D0 09 79 91 42 08 D0 01 33 55 2B 0B D2 F1 E7 00 00 B8 04 00 03 D0 A5 59 08 C1 68 20 23 0B 40 01 20 00 2B 00 D1 00 20 0C 21 89 00 60 50 30 BC 01 BC 00 47

Paste this somewhere word-aligned and call it with an ASMC. It will search all Player and NPC units for a character of the given ID, and check if that character is being rescued. To use it:

SETVAL 0x1 CharID // Character ID to check is being rescued
ASMC offset
IFNOTEQUAL 0x0 0xC 0x0 // Compares the value stored in 0x0 and 0xC
(Events that occur if the unit is being rescued)
ELSE 0x1
ENIF 0x0
(Events that occur if the comparison results in a False)
ENIF 0x1

Since slot 0x0 is always zero, we can just compare with that instead of setting some other slot to a value.

2 Likes

Thanks Venno. You rock! :smiley:
This will be very useful for my new chapter.

Oh btw, make sure the offset you paste the code to is divisible by 4. Otherwise it won’t work at all.

2 Likes

Hmmmmh… is there a way to check if it’s being rescued by the active unit?

@Crazycolorz5 made an FE7 version of that a while back - perhaps we can dissect that to make something for you.

1 Like

Thanks man!

yeah:

30 B5 16 4C 62 68 00 2A 14 DD 15 4D 01 23 98 00 28 58 00 28 05 D0 01 68 00 29 02 D0 09 79 91 42 03 D0 01 33 55 2B 05 D2 F1 E7 C1 68 20 23 0B 40 00 2B 01 D1 00 20 0A E0 00 68 00 79 09 4D 2D 68 29 68 00 29 F6 D0 E9 7E 81 42 F3 D1 01 20 0C 21 89 00 60 50 30 BC 01 BC 00 47 C0 46 B8 04 00 03 D0 A5 59 08 50 4E 00 03

this will additionally check if the active unit is rescuing the unit specified.

1 Like

You’re the best, Venno!

Oops sorry I hadn’t done this. I’ve been inactive for a bit.

Also, hi @AlfredKamon.

Hey there @Crazycolorz5! :smiley:

I’ve been testing this, @Venno.

recruit:
_SETVAL 0x1 0x6F
ASMC 0x103F131
_SETCONDITION 0x0 0xC 0x0
//insert text
_LOAD1 0x1 skypirate
ENUN
ELSE 0x1
ENIF 0x0
//insert text
_0x0221 0x10
ENIF 0x1
_0x0228 0x7
ENDA 

This should work like this: if unit 0x6F is being rescued by the active unit, it loads the “skypirate” to the map. If not, it refreshes event ID 0x10.

However the hack doesn’t recognize whether the active unit is the one carrying 0x6F or not. I used the last code you provided in the topic, but it works like the first one…

Oh, it looks like I was mistaken on what byte +$1B in unit struct was for; I thought it was your rescuee, but it seems to be your rescuer’s ID. Try using this ASMC:

30 B5 16 4C 62 68 00 2A 14 DD 15 4D 01 23 98 00 28 58 00 28 05 D0 01 68 00 29 02 D0 09 79 91 42 03 D0 01 33 55 2B 05 D2 F1 E7 C1 68 20 23 0B 40 00 2B 01 D1 00 20 0A E0 C0 7E 0A 4D 2D 68 29 68 00 29 F7 D0 29 68 09 79 81 42 F3 D1 01 20 0C 21 89 00 60 50 30 BC 01 BC 00 47 C0 46 B8 04 00 03 D0 A5 59 08 50 4E 00 03
1 Like