Summon spells - keeping reference of the summoned minion ?

Post » Wed Jun 20, 2012 8:32 pm

As far as I know, casting a summon spell adds the effect to the caster as a buff, and then creates the minion in the world. What I want to do is to add a script to this self effect, and inside this script I need to reference my summoned minion actor. I don't think I can simply use "akTarget" because the summoned minion is not exactly the target of the effect (the effect is "Target Location" in the summon atronach case).

So, how can I keep reference to the summoned minion in a summon spell? I just want to know who are my minions in real time.
User avatar
Zoe Ratcliffe
 
Posts: 3370
Joined: Mon Feb 19, 2007 12:45 am

Post » Wed Jun 20, 2012 10:08 am

Create them with the PlaceAtMe() function. Have the spell use a custom projectile, which spawns an explosion, which drops a marker, and have that marker create the minion, and store the referenece in a global variable after killing any previous minion stored there.

You can check for the twin souls perk, and have two globals. If the player has the perk, and the second variable is empty, it would store the minion there. If both are full, it would kill the one in the first variable, move the minion in the second variable to the first one, and then save it's minion in the second variable.
User avatar
Robert DeLarosa
 
Posts: 3415
Joined: Tue Sep 04, 2007 3:43 pm

Post » Wed Jun 20, 2012 2:12 pm

Create them with the PlaceAtMe() function. Have the spell use a custom projectile, which spawns an explosion, which drops a marker, and have that marker create the minion, and store the referenece in a global variable after killing any previous minion stored there.

You can check for the twin souls perk, and have two globals. If the player has the perk, and the second variable is empty, it would store the minion there. If both are full, it would kill the one in the first variable, move the minion in the second variable to the first one, and then save it's minion in the second variable.

This is more work than is necessary.

PlaceActorAtMe() returns the Actor when you use it.


You can do the following:

Actor Property MyMinion AutoActorBase Property MyMinionBase AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)MyMinion = Game.GetPlayer().PlaceActorAtMe(MyMinionBase, 4);do stuff with MyMinionEndEvent

Now you have the Actor object for MyMinion assigned and you can manipulate that object within this script as long as the Magic Effect is active. If you want to pass this value to a different script, there is extra work involved.

In order to make the script kill your minion when the Magic Effect ends, do the following:

Event OnEffectFinish(Actor akTarget, Actor akCaster)MyMinion.Delete()EndEvent
User avatar
Micah Judaeah
 
Posts: 3443
Joined: Tue Oct 24, 2006 6:22 pm

Post » Wed Jun 20, 2012 12:54 pm

This is more work than is necessary.

PlaceActorAtMe() returns the Actor when you use it.


You can do the following:

Actor Property MyMinion AutoActorBase Property MyMinionBase AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)MyMinion = Game.GetPlayer().PlaceActorAtMe(MyMinionBase, 4);do stuff with MyMinionEndEvent

Now you have the Actor object for MyMinion assigned and you can manipulate that object within this script as long as the Magic Effect is active. If you want to pass this value to a different script, there is extra work involved.

In order to make the script kill your minion when the Magic Effect ends, do the following:

Event OnEffectFinish(Actor akTarget, Actor akCaster)MyMinion.Delete()EndEvent

And that places the minion at the summon spell target location how?
User avatar
kennedy
 
Posts: 3299
Joined: Mon Oct 16, 2006 1:53 am

Post » Wed Jun 20, 2012 7:44 am

And that places the minion at the summon spell target location how?

It doesn't. It places it at you. It's really not relevant - the goal is to summon a creature and get the Actor object for that creature, not to summon it at the target location. I provided a method that does exactly what he asked albeit differently than how you did it. Don't get your panties in a bunch because I provided a simple method for returning the Actor object. There is a time and a place for your method (which I have even used), but I don't think it's necessary for this particular situation.
User avatar
CArla HOlbert
 
Posts: 3342
Joined: Wed Feb 21, 2007 11:35 pm

Post » Wed Jun 20, 2012 10:39 am

It doesn't. It places it at you. It's really not relevant - the goal is to summon a creature and get the Actor object for that creature, not to summon it at the target location. I provided a method that does exactly what he asked albeit differently than how you did it. Don't get your panties in a bunch because I provided a simple method for returning the Actor object. There is a time and a place for your method (which I have even used), but I don't think it's necessary for this particular situation.

The OP was specifically asking about summoning at a target location.
User avatar
ImmaTakeYour
 
Posts: 3383
Joined: Mon Sep 03, 2007 12:45 pm

Post » Wed Jun 20, 2012 1:44 pm

The OP was specifically asking about summoning at a target location.

Because that's the limitation set by the "Summon Creature" effect archetype. If he's using a script to summon the creature (PlaceActorAtMe()) then he doesn't need to use that effect archetype to begin with, rendering the need for a target location unnecessary. He wasn't specifically asking about that, he says, "in this case."

What was actually requested:
So, how can I keep reference to the summoned minion in a summon spell? I just want to know who are my minions in real time.


I provided an alternative solution to this problem and you're getting upset about it. You need to take a chill pill, we're all here to help each other out.
User avatar
Olga Xx
 
Posts: 3437
Joined: Tue Jul 11, 2006 8:31 pm

Post » Wed Jun 20, 2012 9:32 am

The methods suggested by aWesom3 and Redwood Elf will work if you're making your own custom summon spells. If you want to get the summon from the vanilla summon spells, I suggest putting a magic effect on the player with a script such as this:

Scriptname Example extends ActiveMagicEffectFormList property SummonSpells autoFormList property SummonCreatures autoActor property MySummon autoEvent OnSpellCast(Form akSpell)	if (SummonSpells.HasForm(akSpell))		Utility.Wait(1)		Actor SummonRef = Game.FindClosestReferenceOfAnyTypeInListFromRef(SummonedCreatures, GetTargetActor(), 2048.0) as Actor		if (SummonRef)			if (!SummonRef.IsCommandedActor() || SummonRef.IsHostileToActor(GetTargetActor()))				SummonRef = None			endif		endif		int count = 0		while (!SummonRef && count < 10)			SummonRef = Game.FindRandomReferenceOfAnyTypeInListFromRef(SummonCreatures, GetTargetActor(), 2048.0) as Actor			if (!SummonRef.IsCommandedActor() || SummonRef.IsHostileToActor(GetTargetActor()))				SummonRef = None			endif			count += 1		endwhile		MySummon = SummonRef	endifEndEvent

It should work for most situations, but there are two flaws:

1. If you have a follower/ally who summoned a creature, it could return his/her summoned creature instead.
2. You might be unlucky and can't find your summoned creature even after 10 tries.
User avatar
Kelvin
 
Posts: 3405
Joined: Sat Nov 17, 2007 10:22 am

Post » Wed Jun 20, 2012 7:32 pm

I provided an alternative solution to this problem and you're getting upset about it. You need to take a chill pill, we're all here to help each other out.

Who's upset? I'm merely pointing out that you were giving an answer that ignored part of the initial query. You're the one that seems to be getting bent out of shape by having it pointed out that your 'solution' doesn't fit the specifications of a summon spell...
User avatar
BaNK.RoLL
 
Posts: 3451
Joined: Sun Nov 18, 2007 3:55 pm

Post » Wed Jun 20, 2012 7:05 am

Who's upset? I'm merely pointing out that you were giving an answer that ignored part of the initial query. You're the one that seems to be getting bent out of shape by having it pointed out that your 'solution' doesn't fit the specifications of a summon spell...

You're trying to tell me I'm wrong where there really isn't a wrong way to do it. The result is the same - a summoned creature appears and returns a reference which he can then manipulate. It's a difference of philosophies and if you can't see that, then I don't know what to tell you.
User avatar
Emily Shackleton
 
Posts: 3535
Joined: Sun Feb 11, 2007 12:36 am


Return to V - Skyrim