Pim_gd said:
You'll want to proxy g.inGameMenu.characterMenu.select ... which can't be proxied.
Here's a partial solution - it works for
custom characters, but it completely fails to fire when a vanilla character is loaded.
var loadData = (lProxy as Class).createProxy(g.inGameMenu, "loadData");
loadData.addPre(YOUR_METHOD_HERE, true);
Depending on your modding goals, you
might be able to work around the limitation by creating a custom "clone" of each vanilla character. If you're looking for something which works with
all characters then go ask ModGuy to beef up the lProxy stuff.
Churchill said:
I wasn't certain a proxy would be the course fearing it would replace the source function instead of just hooking it.
By default, it will hook without replacing. The lProxy technique is very useful and reliable -- once you get accustomed to it.
Perhaps there is a variable that could be evaluated to see if it changes?
I used that approach for my first mod ("check value on every frame; react if needed"). Terrible performance penalty, poor compatibility with other mods, and often inconsistent (or disruptive) to gameplay. Use proxies if possible.
One simple approach would be to proxy the hair-loading methods. A character may change her costume during a scene, but a new hairstyle
usually means that the on-screen character has been replaced. If you keep track of the character
name then you can easily reject/discard any special cases where the user switches between two hairstyle variants for the same character (or cases where the incoming character possesses a multi-part hairstyle, which could trigger your "reaction" code to execute several times).
- customElementLoader.addDynamicHairMod
- customElementLoader.hairLoaderComplete