Portrait Selection
Remember when I had this in the OP?
Conditionally Loading Portraits
As in, load this portrait if event ID X is triggered. Load this one if not.
Okay. I can’t provide a download for this one. I wrote this for Legends of Avenir (shameless self-promotion lol), but the ASM would be so dependent on your needs (event IDs to check, number of event IDs to check, text control code, etc. ) that any source I post would be useless except as documentation. If you’re interested, find me on Discord and I’ll help you out.
That’s pretty dumb, so I made a version that is not hardcoded and is hopefully easy to use.
How to: Teach your characters to consider event IDs before showing their ugly faces.
Simply include “PortraitSelectionASM.event” found in the Dropbox folder.
If you’re using the Skill System, uncomment then installer in _MasterHackInstaller.event
.
You’ll see the following when you enter the installer file in the container ASM folder:
PortraitSelectionTable:
SHORT 0x0 0x0 0x0 0x0 0x0 0x0
Now you need to fill out the Portrait Selection Table. All this does is it relates a control code, mugs to potentially show, and a list of event IDs to check. Use the macro, PortraitSelectionEntry
, to fill this out. For example…
PortraitSelectionTable:
PortraitSelectionEntry(GoodFaceID,BadFaceID,Face1List,0xE0E0)
SHORT 0x0 0x0 0x0 0x0 0x0 0x0
Face1List:
BYTE 0x6E True 0x11 True 0x00 0x00
How will this be interpreted by my function? Any time that 0xE0E0
as the control code is detected, it will load GoodFaceID
if both event IDs 0x6E
and 0x11
return true. Otherwise, BadFaceID
will be loaded.
Each unique event ID list that you make can be as long as you like. Each one to check should have the event ID followed by whether you want it to be true or false. This list must also terminate with 0x00 0x00
.
PortraitSelectionTable:
PortraitSelectionEntry(GoodFaceID,0x00,Face1List,0xE0E0)
PortraitSelectionEntry(NeutralFaceID,BadFaceID,Face2List,0xE0E0)
PortraitSelectionEntry(SomeOtherPortrait,SomeOtherOtherPortrait,Face3List,0xF0F0)
... // Other control codes and stuff idk
SHORT 0x0 0x0 0x0 0x0 0x0 0x0
Face1List:
BYTE 0x6E True 0x11 True 0x00 0x00
Face2List:
BYTE 0x6E False 0x11 True 0x00 0x00
Face3List:
BYTE 0x72 True 0x21 True 0x14 False 0x00 0x00
You can have as many entries and different control codes in the Portrait Selection Table as you like, and control codes CAN repeat. If you put 0x00
in the FalsePortraitID
slot, then upon returning false, my function will continue checking the list for valid portraits to load instead of trying to load a false one.
This previous example will check Face1List
upon hitting 0xE0E0
. If Both 0x6E
and 0x11
are true, then it will load GoodFaceID
. Otherwise, it will proceed down the list because the false (or else, if you prefer) entry was 0x00
. It tries the next entry, and if it finds 0x6E
to be false and 0x11
to be true, then it loads NeutralFaceID
. Otherwise, it loads BadFaceID
.
It may be more intuitive to think of this as…
PortraitSelectionEntry(IfTruePortrait,ElsePortrait...)
In case you’re wondering about the control codes themselves, they’re arbitrary shorts. You don’t need to do anything extra to use them except use them in the Portrait Selection Table. To my knowledge, you should not use 0xFFFF
(since that’s for loading the current character’s), and you should not use 0x01XX
or 0x02XX
(since that’s used to normally loading portraits). Just go ahead and [LoadFace][0xE0][0xE0]
(in my case, at least) away.
As always, I’d be happy to clarify something, and let me know if you encounter any issues!