Nintenlord Posted April 18, 2012 Share Posted April 18, 2012 (edited) I'm pretty confident I've uncovered how FE7 (and possibly FE6 and FE8 assuming they use same system) decides which tile change to use with villages and doors and such. The algorithm is simple, the game goes through all the tile changes in the chapter and the last tile change that contains the the location event coordinate is the tile change to be activated. This has few important consequences: With villages, the gate closing is always contained in the village ruining. Therefore, the gate closing change will ALWAYS have to be after the village ruining change, otherwise the game will always pick the ruining tile change. This also explains why the destruction event is always one tile above the gate, otherwise the game would pick the wrong tile change. If you are having trouble activating the correct tile change, make sure you have the correct coordinates and sizes with the changes. In general, keep more mundane tile changes in the end of the list while more unique changes should be near the top of the list. Be extra careful with overlapping tile changes and experiment with different orders if the game is activating the wrong changes. Here's the routine that decides which tilechange to use when it is automatic, used on both player and enemy phase: 0802BD0C push {r4-r6,lr} add r5, r0, #0x0 @r0 = x-coordinate of event add r4, r1, #0x0 @r1 = y-coordinate of event mov r6, #0x1 neg r6, r6 ldr r0, =$202bbf8 ldrb r0, [r0, #0xe] @loads current chapter ID lsl r0, r0, #0x18 asr r0, r0, #0x18 bl $315a0 @gets pointer to map changes of current chapter add r1, r0, #0x0 cmp r1, #0x0 beq end @skip if there is none b label1 loop1: ldrb r0, [r1, #0x1] @X-coord cmp r5, r0 blt label2 ldrb r2, [r1, #0x2] @Y-coord cmp r4, r2 blt label2 ldrb r3, [r1, #0x3] @width add r0, r3, r0 sub r0, #0x1 cmp r0, r5 blt label2 ldrb r3, [r1, #0x4] @height add r0, r3, r2 sub r0, #0x1 cmp r0, r4 blt label2 mov r6, #0x0 ldrh r6, [r1, r6] @load current tile change ID label2: add r1, #0xc @go to next tile change label1: mov r0, #0x0 ldrh r0, [r1, r0] @is actually load signed byte cmp r0, #0x0 bge loop1 end: add r0, r6, #0x0 pop {r4-r6,pc} @return -1 if no right map changes exist for chapter, @else returns last tile change ID to be right This routine is used before the event is actually executed. Also, this routine limits the amount of map changes to 128 due to treating the ID as signed byte. Edited April 18, 2012 by Vergil Quote Link to comment Share on other sites More sharing options...
C7K Posted April 20, 2012 Share Posted April 20, 2012 (edited) Something that I've always wondered how to do is the tile change for broken walls. Do you just do what you said here? Have a tile change ready for the coordinate/s affected? If that's how you should do it for broken walls I'm happy. But what you said sounds good, it lets you use less space for your tile changes, I think you were trying to say that you won't need separate events. For example you won't need 0x07 for the village gate closing and 0x08 for destroying the village, you could use both in 0x07, right? How come you've never made a long hack even though you're one of (if not the) best hackers on the english part of the internet? Edited April 20, 2012 by C7K Quote Link to comment Share on other sites More sharing options...
Nintenlord Posted April 21, 2012 Author Share Posted April 21, 2012 Something that I've always wondered how to do is the tile change for broken walls. Do you just do what you said here? Have a tile change ready for the coordinate/s affected? If that's how you should do it for broken walls I'm happy. Broken walls are automatic as in they don't have any events associated with them as far as I know. It probably uses this same method to pick right tile change for wall breaking too. But what you said sounds good, it lets you use less space for your tile changes, I think you were trying to say that you won't need separate events. For example you won't need 0x07 for the village gate closing and 0x08 for destroying the village, you could use both in 0x07, right? You do need to use separate events for both village saving and destroying, but you also need to give them both the same event ID. That is how the game does it. If you use my Event Assembler, Village macro will do both events properly. How come you've never made a long hack even though you're one of (if not the) best hackers on the english part of the internet? I don't just want to make hack for the sake of making it, I want to make something good. And I haven't gotten any idea for a long hack worth making. Quote Link to comment Share on other sites More sharing options...
C7K Posted April 21, 2012 Share Posted April 21, 2012 (edited) Broken walls are automatic as in they don't have any events associated with them as far as I know. It probably uses this same method to pick right tile change for wall breaking too. But the tile changes will be triggered if you have a tile change for that coordinate, am I right? I don't just want to make hack for the sake of making it, I want to make something good. And I haven't gotten any idea for a long hack worth making. I think Nintenlord Saga is good, it had humour. I also tried Athos mode, and it was also good (even though there was only one chapter). So, I think that what you've made is really good. But if you still have to find a good story, then that's okay, don't try to make something you don't think is good. Edited April 21, 2012 by C7K Quote Link to comment Share on other sites More sharing options...
Nintenlord Posted April 21, 2012 Author Share Posted April 21, 2012 But the tile changes will be triggered if you have a tile change for that coordinate, am I right? The tile change will be triggered if it is the last tile change to contain the position of the event. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.