More findings.
I've been looking what each block of the .pm2 files does. The most interesting ones are in the section called PMD_DATATYPE_FRAME in the template. The blocks that begin with 01 (called PMD_OBJTYPE_UNIT) control characters' movements and the like. There are several types.
I'm going to use event 104_001.pm2 (Yu arriving at the station at the beginning) as example.
This one is to move characters around the map.
-The first 01 indicates that it's an OBTYPE_UNIT block.
-3C 00 (60) is the frame time. This serves to set the order of actions. For example, a block with time 54 would come before, and one with time 61 would come immediately after.
-01 0C is the character code. Looking this hex number in the corresponding area's .fbn, shows that it belongs to model 12 (Yu with the travelling bag). So this Yu will perform whatever action scripted by this block.
-The next 01 sets the type of action performed by the block (01 is for movement).
-04: This sets the speed of walking.
-The rest of the numbers seem to be coordinates of some sort, to set the path the character will follow. Unfortunately, I couldn't make sense of them, and I didn't get reliable results when changing these numbers around.
This is for animations.
-02: type of action (02 for animations)
-01: the animation performed. Upon looking the model in Noesis, the animations play in order. The first one is the character standing (00) and the next one is walking (01), which is the animation performed here. If it was changed to 02, for example, Yu would move around while shaking hands, instead of walking.
This is for rotation.
-04: type of action (04 for rotation)
-2E 4E (46 67): amount and direction of rotation? I haven't investigated this much, really.
This is for the special effects that sometimes appear over the character's head.
-05: type of action (05 for effects)
-02: effect ID (02 is the interrogation sign)
The following is a (non-exhaustive) list of the effects' IDs (in decimal):
-0: exclamation
-1: double exclamation
-2: interrogation
-3: exclamation + interrogation
-4: red angry sign (like the one Nanako shows when hitting Dojima at the station scene)
-5: flowers
-6: musical note
-7: a star (angry? surprise?)
-8: grey cloud showing annoyance
-9: blushing
-10: speaking signs
-11: rays
-12: pink heart
-13: Zzzzzz (sleeping)
-14: cellphone beep
-15: sweatdrop
-16: sweatdrops (surprise)
-17: star
-18 and 19: musical notes when you increase affinity
Similar to rotation, but only rotates the head.
-06: type of action (06 for head rotation)
-16 43 (22 67): amount and direction of rotation. Changing 67 to 66 made Yu rotate the head in the opposite direction.
This is a different type of block. It begins with 04 (PMD_OBJTYPE_MESSAGE in the template). These come after the UNIT blocks, and basically set the order in which the messages from the .pm1 file show. Again, this order is dictated by the frame time at the beginning.
-05: Message number, as seen in the .pm1 file. I've noticed that for MC's selections, there's a 10 (in hex) right after the message number.
-The 01 before message number indicates that this message is conditioned. That is, it will only show if MC makes a specific choice. The 02 before this, means the message is related to the third choice (00 for first choice, 01 for second, and so on.) Conditioned actions like movements or animations show the same pattern. The numbers in these case would come before the type of action, instead of message number.
By knowing all these things, it's possible to edit events considerably. I still have to figure out how to control movement (I'm not good with numbers, so those coordinates baffle me, really). It's also possible to extend conversations and scenes by copy-pasting blocks in a hex editor and adjusting the frame times. In this case, it's enough to extend the LastFrame and TotalFrame as neccesary at the beginning of the template, as well as adjusting the ItemCount to reflect the new frames.