Check if actor is player's summoned minion

Post » Sun Nov 18, 2012 1:32 pm

I've had success using GetPlayerTeammate to detect if an actor is a follower (the kind that sneak when you sneak, etc.) However, I would like to know if there is also a way to determine whether an actor is a summoned minion of the player.
User avatar
phil walsh
 
Posts: 3317
Joined: Wed May 16, 2007 8:46 pm

Post » Sun Nov 18, 2012 2:57 pm

Well, a combination of IsCommandedActor == 1 and IsHostilToActor (player) == 0 seems to work. However there is still the problem of this picking up companions' summons (like Serana's raise dead).

So, I need a way to check if the commanded actor was originally summoned by the player
User avatar
Khamaji Taylor
 
Posts: 3437
Joined: Sun Jul 29, 2007 6:15 am

Post » Sun Nov 18, 2012 12:47 pm

I haven't worked with summoned creatures yet so there might very well be better techniques (have you checked factions?), but you could use SKSE to check if the first part of the summoned creature's name corresponds to the player's name. IIRC all summons have the summoner's name as a prefix right?
User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am

Post » Sun Nov 18, 2012 8:41 am

have separate summon spells for the player that summon creatures with different keywords than those used by NPCs

you could also try checking Faction Relations http://www.creationkit.com/GetFactionRelation
I would think a companion's summon should have a different faction relation to the player than the player's own summon...but thats just a guess
User avatar
Kieren Thomson
 
Posts: 3454
Joined: Sat Jul 21, 2007 3:28 am

Post » Sun Nov 18, 2012 1:58 pm

This script (requiring SKSE) can do the trick i think :

Scriptname PlayerAliasScript extends ReferenceAliasActor Property Summoned AutoActor Property PlayerRef AutoEVENT OnSpellCast(Form akSpell)if ( akSpell ) && ( akSpell as Spell )int i = (akSpell as Spell).GetNumEffects() - 1WHILE i > -1if ( (akSpell as Spell).GetNthEffectMagicEffect(i) ) && ( (akSpell as Spell).GetNthEffectMagicEffect(i).GetAssociatedSkill() == "Conjuration" )	 Summoned = FindRandomActorFromRef(PlayerRef, 500)	 WHILE Summoned == PlayerRef || !Summoned.IsCommandedActor() || Summoned.IsHostileToActor(PlayerRef)	 Summoned = FindRandomActorFromRef(PlayerRef, 500)	 EndWHILE	 Notification("Player has summoned "+Summoned.GetActorBase().GetName())endifi -= 1EndWHILEendifEndEVENT
User avatar
kasia
 
Posts: 3427
Joined: Sun Jun 18, 2006 10:46 pm

Post » Sun Nov 18, 2012 5:19 pm

In the second post the OP already tells us that such a script will also pick up summons of allies.
User avatar
Chloe Yarnall
 
Posts: 3461
Joined: Sun Oct 08, 2006 3:26 am

Post » Sun Nov 18, 2012 5:29 am

This script (requiring SKSE) can do the trick i think :

Scriptname PlayerAliasScript extends ReferenceAliasActor Property Summoned AutoActor Property PlayerRef AutoEVENT OnSpellCast(Form akSpell)if ( akSpell ) && ( akSpell as Spell )int i = (akSpell as Spell).GetNumEffects() - 1WHILE i > -1if ( (akSpell as Spell).GetNthEffectMagicEffect(i) ) && ( (akSpell as Spell).GetNthEffectMagicEffect(i).GetAssociatedSkill() == "Conjuration" )	 Summoned = FindRandomActorFromRef(PlayerRef, 500)	 WHILE Summoned == PlayerRef || !Summoned.IsCommandedActor() || Summoned.IsHostileToActor(PlayerRef)	 Summoned = FindRandomActorFromRef(PlayerRef, 500)	 EndWHILE	 Notification("Player has summoned "+Summoned.GetActorBase().GetName())endifi -= 1EndWHILEendifEndEVENT

I think FindRandomActorFromRef(PlayerRef, 500) will always return the player.Nope, nevermind.
User avatar
c.o.s.m.o
 
Posts: 3419
Joined: Sat Aug 12, 2006 9:21 am

Post » Sun Nov 18, 2012 4:41 am

In the second post the OP already tells us that such a script will also pick up summons of allies.

Yeah, my bad. Unfortunately the GetName() trick can not work because Summoned.GetActorBase().GetName() returns just the Actor's name without Player's one, not like in game where you see both.

And summoned Actors don't belong to PlayerFaction.
User avatar
Elina
 
Posts: 3411
Joined: Wed Jun 21, 2006 10:09 pm

Post » Sun Nov 18, 2012 2:24 am

Thanks for the suggestions, but I ended up with a workable enough solution using perks. Basically I did a chain of AND checks on a conditional entry point perk; first IsCommandedActor=1, then GetShouldAttack Player=0, and finally IsHostile Player=0.

(This is for my http://skyrim.nexusmods.com/mods/22538/ mod, BTW.)

The first part determines if they are a summon. Minions will also fall in this category, but I have a separate check for IsPlayerTeammate so that is as I want. The next part checks if that minion would normally be hostile on sight to the player, which catches the vast majority of situations where I would want to avoid damaging them since there aren't many minions that are neutral while commanded, and last, the check for whether they are CURRENTLY hostile, which allows spells to hit targets that aggro due to friendly fire, or other strange circumstances.

Since the whole point was basically to have a toggle to stop spells and weapons from damaging the player's current teammates or minions, it wasn't so important to know if they were actually the player's or not. Those checks suffice, and also prevent damage to teammate's minions like Serana's risen dead.

I have to say, the conditional systems of this latest CK, perks and ability spells especially, are much more powerful than previous incarnations and save a ton of scripting for simple things like this. :)
User avatar
KiiSsez jdgaf Benzler
 
Posts: 3546
Joined: Fri Mar 16, 2007 7:10 am

Post » Sun Nov 18, 2012 10:41 am

Does your method distinguish between summoned undead and reanimated corpses? I badly need a method to distinguish the 2 kinds of actors.
User avatar
!beef
 
Posts: 3497
Joined: Wed Aug 16, 2006 4:41 pm

Post » Sun Nov 18, 2012 3:59 am

Not in that implementation, no. However in my latest version I also implemented some faction checks to catch a few rare scenarios where IsPlayerTeammate and the other checks above weren't catching everything. I'm not positive but I would guess summoned undead would belong to a certain faction?

Since you can't resurrect summons (they disappear when dead) and anything you do resurrect wouldn't likely be in the same faction as conjured summons, it seems anyway like a good place to start.
User avatar
Erich Lendermon
 
Posts: 3322
Joined: Sat Nov 03, 2007 4:20 pm

Post » Sun Nov 18, 2012 5:10 pm

There are condition funcitons detecting who killed an actor and the time since it's death (I can't remember the names). If those values aren't reset when animated, your could use them for distinguishing reanimateds from summons. Also, are you sure reanimated actors are registered as undead? if not, you could also use that.
User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am


Return to V - Skyrim