Okay, so now I am stuck again with two related issues:
(1) I need to get the "owner" of a summoned actor. Some examples of how I would want to use this are:
A spell that may be cast on a summoned actor to damages an actor value of its owner.
When a summoned actor dies, it restores an actor value of its owner.
While a particular summoned actor is alive, its owner gets an actor value fortified.
Etc.
Maybe there's no function to actually do this, so I thought the easiest way would be to assign the owner manually with "setactorowner" when it's cast (this does work on other actors), and then just check it later. I'm having a really difficult time actually doing that though. My first idea was to make a small scripted area effect on target location that was part of the same spell as the summoned spell, which assigns ownership of any targets to the caster, but this does not work unless it's fired at an existing actor, because no matter what I do, I can't get the effect to apply to the summoned actor of the same spell.
My next idea, I think, is much worse. It's to force every actor to cast a silent/invisible spell right after they cast a summoning spell, and have that spell set the ownership. While I think it would work for the player, it just seems like (a) a really bad solution that's prone to failure, and (

something that may not even work for NPCs, since I would need to know the target for them already, and if I knew the target at this point, I would already have access to both the NPC and summoned actor and could just set the ownership without casting the spell.
I realize that I can check whether the actor is the player's ally or not, but this doesn't help me for actors summoned by NPCs, and unlike Skyrim, I want my mod's mechanics to work the same for the player and NPCs.
---
(2) I need to apply an effect to self after casting a "target location" spell, if certain conditions are met.
Example of how I would use this:
A spell that summons an actor at the target location, and if
of the caster is below , then the caster takes 10 damage to .
More defined example:
If an actor casts a spell that works on target location with less than 50 magicka, he takes 10 health damage as well. These values should be specific to each spell.
I was thinking of something similar to above, which is to add second, scripted, effect to the spell with the conditions I want, and in "oneffectstart" I can just get the caster and do whatever I want there. This sometimes works fine, but the problem is the effect only starts when other actors are already around. So if you cast something in a completely empty area, the effect can never start because there are no targets for it.
Again, I could do some really unreliable and terrible things ot make this work, such as making an invisible permanent follower to receive the effects, or forcing the actor to cast another spell on itself with the "onspellcast" event. But these are both awful ideas of course, and I would rather just forego my planned mechanics than use them.
Hopefully someone has some better ideas.