[FE8] Gas Trap and Change AI macros

For some reason there’s no GAST/Gas Trap programmed in Event Assembler for FE8 that I’m aware of.
You can add them with FEBuilder, but if someone just wants to script events with Event Assembler without using FEBuilder, here’s the macro:

#define GasTrap(XX,YY,direction) "BYTE 0x05; BYTE XX; BYTE YY; BYTE direction; BYTE 0x01; BYTE 0x01"
XX: Position X
YY: Position Y
direction: direction of the gas
0 = From right to left
1 = From left to right
2 = From top to bottom
3 = From bottom to top

And here are som macros for changing AI
#define ChangeAI(AI1,AI2,chara) "SVAL 0x01 ((AI1*100)+AI2);CHAI chara"
#define ChangeAIXY(AI1,AI2,posX,posY) "SVAL 0x01 ((AI1*100)+AI2);CHAI [posX,posY]"

#define SetAI(unitid,ai1,ai2)"SVAL 0x1 ai1|(ai2<<8); CHAI unitid"
#define SetAI(x,y,ai1,ai2) "SVAL 0x1 ai1|(ai2<<8); CHAI [x,y]"

ai1: AI Byte 1
ai2: AI Byte 2
unitid: Character
x: Position X of the unit
y: Position Y of the unit

Apparently you can only change the first 2 bytes of the AI in FE8, I don’t know if you can change bytes 3 and 4.

And another thing I found out is that the lower amount of gold you can give with a chest is 256, anything below that is treated as an item.


I know someone made ASM that allows bytes 3 and 4 to be changed, but I forget where it was or who made it. Search isn’t helping very much

1 Like

This is handled by an event, if you want to change said event it’s located as so (credit stan):

ORG $591FA8
    // s3 is item id or gold amt


    SVAL 0x7 0xFF // <----

    BGT 0 0x3 0x7


    GOTO 1



By changing the 0xFF pointed to by the commented arrow, you can do lower gold amounts like so

Tequila did from what I can tell, though it does not appear to be on the forums (nor can I find the source for it, just an installer)

can also just make the raw also function in fe8

##Gas trap
GAST, 0, 6, -language:FE7:FE8 -unsafe -priority:ballista -indexMode:8 -offsetMod:1
	5, 0, 1, -fixed 
##Position of the trap
	Position, 1, 2, -coordinates:2 -preferredBase:10
##Direction of the trap
	Direction, 3, 1
##Size of the trap
	Size, 4, 2, -coordinates:2 -preferredBase:10

These macros likely will not work; one of the AI parameters needs bitshifted 8 bits to the left, which is not the same as multiplying by 100 (1*100 is 100, 1 shifted 8 bits left is 256). Additionally, your positioning of AI1 and AI2 bytes within the parameter are swapped (at least according to my notes). Macros should look something more like this:

#define SetAI(unitid,ai1,ai2)"SVAL 0x1 ai1|(ai2<<8); CHAI unitid"
#define SetAI(x,y,ai1,ai2) "SVAL 0x1 ai1|(ai2<<8); CHAI [x,y]"

I tried that, but I was unable to make it work.

They worked as intended when I used them, maybe it was luck (?)
Yours is better formatted, I’ll use that from now on.

For reference: