Originally Posted by stevosaurus
Thanks for making your source available. I've been playing around with scripting and it has been super helpful.

No problem. I learn faster with a source available, so I enjoy passing it on. smile

Originally Posted by stevosaurus
Having to override Player.charScript to inject our own scripts seems like a wonky workaround. Is this really the intended solution for running player-centric scripts? I couldn't get my test .charScript to work until I found your code because it seems so counter intuitive.

Yeah, it's a little strange. You can override any of the base scripts that way: Base.charScript for including scripts to include in all charScripts, DefaultCharacter.charScript for characters, and of course Player.charScript for player-only code. The only other way to include scripts on things you want, that I know if, is to attach it to a root template.

Personally I wish we had a way to dynamically attach scripts to things through other scripts (or story editor scripts), in a way that supports mod compatibility. Something like, "OnLoad -> If players don't have MyScript.charScript attached -> Attach it.".

Currently, if you override Player.charScript, and a second mod's does as well, I believe it will go with the mod lower in the load order. So you would need a "compatibility patch" that has a merged script that includes the scripts from both mods. It's a bit of a headache.