The weapon I'm hoping to write the script(s) for already has an old script I -with the help of some other friendly forum members- wrote awhile back. It seems to detect the "killed actor" part reliably as much as I've been able to determine so I just need to add the faction rank modifier to the end of it. It's the other conditions I'm not sure how to optimally handle.
I don't know how exactly Skyrim handles scripts, but I suspect it fires one off on a thread which runs it to completion. The issue then with having all conditions in one file is that the results of these conditions need to take several seconds of in-game time to complete for how I want the weapon to behave.
To explain in more detail I'll just outline what I'd like to do:
On Actor Kill: Faction rank (which should have started out at some default initial state, I'll call it absolute zero) is increased by a static amount.
With this new faction rank, a trait (eg Max Stamina, Carry Weight, scale etc...) is increased in steps to some new max determined by the new faction rank. This new maximum should be reached in steps and not all in one go.
On Wielder Take Damage: If wielder health is below 50%, decrease the faction rank by a static amount unless this carries it below absolute zero. If it would otherwise carry it below absolute zero, set the faction rank to absolute zero.
Decrease the wielders trait to the new maximum dictated by the faction rank. This new maximum should be attained in steps again, not all in one go. The wielder should also be healed by a value according to faction rank lost. Let me explain this better. When the wielder takes damage and is below 50% health from that damage, if it has faction standing, it should start healing slowly until its health reaches 50%, say 3% health for every 4 standing points and the trait should slowly decrease.
On Weapon Unequip: Set the faction rank to absolute zero. Decrease the wielders trait to the new maximum as dictated by the new faction rank. This new maximum should correspond to it's value before the wielder ever equipped the weapon in the first place. It should be reached in steps and not all at once.
Basically the faction standing is used as the background initial value holder for the trait which is the in-game manifestation of this rank. It would also be nice to have different spell effects for the various conditions.
Now where I can see problems arising is each condition will take a long time (1-2 seconds maybe or more depending on how much the faction rank is increased or decreased in a time. to complete and many conditions can be fired off and be true while one is still terminating. The wielder could kill something as its taking damage and of course, it would be still in the middle of the taking damage condition as it takes more damage.
Since the faction rank is the base line used for the incremental parts that should make things a bit simpler. As the loops performing the incrementing iterate, they should be able to check the value of the faction rank and act accordingly. Since the loops themselves don't modify the faction rank there shouldn't be any problems with race conditions (concurrency). Because of this I'm thinking there might need to be a script for each condition so that multiple conditions can occur "simultaneously". Yes it's fine if this trait is being both incremented and decremented at the same time. That just means its value shouldn't be changing.
There's probably a smart way of writing the script(s) so that overlapping trait modification is smart and doesn't cause a jittering of the value. Probably something like if the rank falls above/below the point where the corresponding trait value is above/below the required value, stop incrementing/decrementing.
Eg. If current faction rank value is 10 and the trait value the wielder currently has requires rank 12 then stop incrementing.
Also thanks for helping me on this.