Ok, I’ll show you how to do this for animal companions for now (next time I’ll show you for summon creature spells, ecc…)
First of all, the “event” script you want to run, I assumed it’s named custom_associate_script and that it’s the one called for all associates when they spawn, I don’t know what’s supposed to happen with it, but that’s besides the point right now.
Second, the script that is called when the animal companion is summoned is called nw_s2_animalcom and this is how it should be modified to achieve what you’re asking for:
void StartupAssociateEvent(object oPC)
object oANIMAL = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oPC);
object oPC = OBJECT_SELF;
Something similar is done with the summon familiar, the script called in that case is nw_s2_familiar, there are some minimal differences in the functions and the argument of the GetAssociate you must use (famiiar instead of animal companion), but the rest is pretty much the same.
As for a quick way to retrieve the compiled script to put in the override folder, you can do the following:
While the editor is open and the module where the custom script was saved is open, you can go to the following folder:
there you will find the compiled scripts (both nss and ncs files) ready to be copied in your override folder.
Don’t close the editor or the module or else the temp folder will disappear, obviously.