Summoning Script Not Working?

Post » Thu Jun 21, 2012 9:19 am

So, I'm trying to emulate a summoning spell as best as I can, to summon a permanent follower (and just rigging a summoning spell to my created NPC doesn't work, since summoned NPCs seem to think they're zombies). The script below is supposed to summon my NPC reference to the player, with a portal effect summoned right on top that disappears shortly after.

The code compiles correctly, but in game has no effect. My NPC is still in it's holding cell. The objectreferences are correctly designed in the CK, so it isn't that.


Scriptname aaInitialSummonsEffectScript extends activemagiceffectOBJECTREFERENCE CompanionREFOBJECTREFERENCE Portal1REFEVENT onEffectStart(ACTOR akTarget, ACTOR akCaster)		 game.getPlayer().placeAtMe(CompanionREF)		 CompanionREF.placeAtMe(Portal1REF)		 utility.wait(5)		 Portal1REF.disableNoWait()endEVENT

This should be quite simple. I can't help but think I'm overlooking something terribly obvious. Does anyone have any ideas as to what might be wrong here?
User avatar
Breautiful
 
Posts: 3539
Joined: Tue Jan 16, 2007 6:51 am

Post » Thu Jun 21, 2012 12:19 pm

PlaceAtMe creates a new reference of a passed base form parameter. Try http://www.creationkit.com/MoveTo_-_ObjectReference to move an existing reference to you.
User avatar
Katharine Newton
 
Posts: 3318
Joined: Tue Jun 13, 2006 12:33 pm

Post » Thu Jun 21, 2012 10:49 am

Try something like:
ScriptName aaInitialSummonsEffectScript extends ActiveMagicEffectActor Property CompanionREF AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)	Summon(akCaster, CompanionREF)EndEventFunction Summon(ObjectReference akSummoner = None, ObjectReference akSummon = None, Float afDistance = 150.0, Float afZOffset = 0.0, ObjectReference arPortal = None, Int aiStage = 0)	While aiStage < 6		aiStage += 1		If aiStage == 1 ; Shroud summon with portal			arPortal = akSummon.PlaceAtMe(Game.GetForm(0x0007CD55)) ; SummonTargetFXActivator disables and deletes itself		ElseIf aiStage == 2 ; Disable Summon			akSummon.Disable()		ElseIf aiStage == 3 ; Move portal in front of summoner			arPortal.MoveTo(akSummoner, Math.Sin(akSummoner.GetAngleZ()) * afDistance, Math.Cos(akSummoner.GetAngleZ()) * afDistance, afZOffset)		ElseIf aiStage == 4 ; Move summon to portal			akSummon.MoveTo(arPortal)		ElseIf aiStage == 5 ; Enable summon as the portal dissipates			akSummon.Enable()		EndIf		Utility.Wait(0.6)	EndWhileEndFunction

Edit: Made a function of it. Synchronized stages w/ activator sound.
User avatar
..xX Vin Xx..
 
Posts: 3531
Joined: Sun Jun 18, 2006 6:33 pm

Post » Thu Jun 21, 2012 7:53 am

DreamKing mentioned the main issue. http://www.creationkit.com/MoveTo_-_ObjectReference is what will spring your NPC from his holding cell.

Try something like:
ScriptName aaInitialSummonsEffectScript extends ActiveMagicEffectActor Property CompanionREF AutoActivator Property SummonTargetFXActivator Auto ; Disables and deletes itselfEvent OnEffectStart(Actor akTarget, Actor akCaster)...EndEvent
?

Whew. Look at Justin go. Even has that classic Trig formula in there! *lol* Frankly I think his suggestion is wasteful and slow (Heheh, he really hates it when you make accusations like this).

Kidding aside, I do something similar in one of my mods. Instead of the tacky Activator, I created a custom Spell + MagicEffect that fires off the Portal visual effect. You can use the MoveTo formula that Justin does (the third example down on the wiki) then simply do CompanionREF.Cast(PortalSpell).
User avatar
neil slattery
 
Posts: 3358
Joined: Wed May 16, 2007 4:57 am

Post » Thu Jun 21, 2012 5:04 pm

Ah, moveto was what I was originally looking for. I had derived the script from a false summon spell already existent in the game (some kind of mass skeleton summon) so it makes sense that it would just summon random skellies instead of specifically placed ones. . .

Awesomeness?

Wow, thank you for that effort, JustinOther! Alas, though; your summon spell didn't work for me either. :( It's a bit above my head as far as scripting goes, so I can't even troubleshoot it properly (like, how does the script know who the summoner is when the summoner isn't designated? Am I supposed to replace that with a PlayerREF? Is that 'akSummon' referring to the function? It's not working as a plug-and-play script, so I'm assuming I have to change something beyond the NPCRef. I'm so confused). I'm not sure what could be the problem; my NPC reference is properly indicated in the script's properties tab, the script is attached to a magic effect, which is attached to a spell cast on Self -- but nothing but the ImageSpace and spell sound effects (and not even the Activator sound effects) go off when the spell is cast. The spell works, but the script isn't activating.

Thank you very much for the assistance! I'm assuming your script works fine if you went through the trouble to put it on the wiki (I found that you added it today while I was trying to figure it out), so I'll try and muddle through and see what I'm doing wrong.
User avatar
Angela
 
Posts: 3492
Joined: Mon Mar 05, 2007 8:33 am

Post » Thu Jun 21, 2012 6:34 pm

Wow, thank you for that effort, JustinOther!
No sweat :) It's essentially code I'd already written for summoning my Bag of Holding, just with a few differences so it works with the average NPC.
  • how does the script know who the summoner is when the summoner isn't designated?
  • Am I supposed to replace that with a PlayerREF?
  • Is that 'akSummon' referring to the function?
  • The akSummoner argument must be defined when calling the function.
  • PlayerREF if you have a PlayerREF property or Game.GetPlayer(). Either will behave identically. If the player casts the spell, akCaster works too.
  • akSummon argument should be your actor.
    Summon(Game.GetPlayer(), Game.GetForm(0x000A2C94) As Actor) ; Will teleport Lydia to player
    Summon(Game.GetPlayer(), CompanionREF) ; Will teleport CompanionREF to player
Alas, though; your summon spell didn't work for me either. :(
The function *does work. Provided your CompanionREF property is filled, you've copypasta'd the Summon function, and are invoking it properly, it'll work no matter where you put it.

*tested with Lydia using an ActiveMagicEffect script

If you'd like, link it and I'll tinker with it 'til it works in your plugin too, then I could post whatever steps I needed to take to make it work so you can get in there and fix it. Could be retroactive interference from removed properties, testing in an area with no NavMesh... Something is different.
User avatar
Siobhan Thompson
 
Posts: 3443
Joined: Sun Nov 12, 2006 10:40 am

Post » Thu Jun 21, 2012 12:47 pm

I'm downloading your Bag of Holding mod to see how you filled out your variables and such. I'm really hopeless at this.
User avatar
Gavin Roberts
 
Posts: 3335
Joined: Fri Jun 08, 2007 8:14 pm

Post » Thu Jun 21, 2012 5:44 pm

If using that as an example, be sure to grab v1.141 (previous versions don't have the spell). Bear with it, and we'll figure out where the stop is and pull it pronto :) Link your mod if you want as another pair of eyes can't hurt.
User avatar
biiibi
 
Posts: 3384
Joined: Sun Apr 08, 2007 4:39 am

Post » Thu Jun 21, 2012 6:53 am

http://speedy.sh/HS7wV/CompanionIshtar1.esp

My NPC is going to be bald without the custom hair, but the important bits should be intact. I don't even know what the state of the script is right now; I was trying your script, then Aenara's suggestion with the cast effect, and then I tried the most basic .moveto -- all to no effect.

EDIT: For lurkers and future reference, the above link isn't going to work anymore; I took the .esp down since JustinOther uploaded a functional example of the script below.
User avatar
Smokey
 
Posts: 3378
Joined: Mon May 07, 2007 11:35 pm

Post » Thu Jun 21, 2012 12:28 pm

http://speedy.sh/HS7wV/CompanionIshtar1.esp

My NPC is going to be bald without the custom hair, but the important bits should be intact. I don't even know what the state of the script is right now; I was trying your script, then Aenara's suggestion with the cast effect, and then I tried the most basic .moveto -- all to no effect.

I downloaded your .esp and poked around some. Both of the magic effects (00IshtarSummons1Effect and 00IshtarSummonsFXEffect) have Casting Types set to "Concentration". Switch those to "Fire and Forget".

Now I'm guessing you want the first one to bring Ishtar to you. I'll need to see what's in that script "aaIshtarInitialSummonsEffectScript.psc". It should be in Data\Scripts\Source, if you want to upload it somewhere. Or you can edit it in the CK and paste it in a response here. Just put the code tags around the text.

I noticed you also have a script on the second effect. If that's the one that I suggested, the one that makes the portal effect around your summoned actor, it won't need one. All that's needed is a Hit Effect Art specified. I use "SummonTargetFX" there, iirc.
User avatar
Tom Flanagan
 
Posts: 3522
Joined: Sat Jul 21, 2007 1:51 am

Post » Thu Jun 21, 2012 3:14 pm

http://www.mediafire.com/?pprzjx8cijjhn3x to compare/contrast with the summoning working for both spells. I removed the 00 from the EditorIDs as they're *http://www.creationkit.com/Identifier_Reference and removed the Update.ESM dependency as it's all new forms.

*for, at very least, convenience of Auto-Filling properties

Not sure what, exactly, made the difference, but it works with the included script.
User avatar
Stace
 
Posts: 3455
Joined: Sun Jun 18, 2006 2:52 pm

Post » Thu Jun 21, 2012 6:02 pm

Sorry the .esp was so messy, Aenara; I forgot the scripts are stored elsewhere. The second spell was an attempt to implement your suggestion instead, since the other method wasn't executing for me.

But now it works! Huzzah! (Now I can finally get to the fun dialogue part! :D ) I'm looking over the changes you made, Justin, and it really WAS just a plug and play script. Maybe the digits in my EditorIDs really jacked up the scripting engine? I didn't know that was considered an invalid format, and I have no idea what else the issue might have been. That would also explain why I couldn't get even the simplest moveto script to work . . . So, I'm going to tentatively chalk this up to lesson learned: EditorIDs that start with numbers are Bad.

I would never have figured it out without you guys' help! I was getting really frustrated with it, but that script is perfect for my mod needs. Let me know if you ever need a writer or female voice actor, and I'll return the favor if I can. God knows I'm not going to be able to help anyone with scripting. :P
User avatar
Johanna Van Drunick
 
Posts: 3437
Joined: Tue Jun 20, 2006 11:40 am

Post » Thu Jun 21, 2012 6:36 pm

Right on, Amaranthine :) Must've been the EDIDs not auto-filling. I saw to it that there's still a consistent nomenclature so you can type 'Ish' in a CK list and the first 'Istar' form will be highlighted.

:foodndrink:
User avatar
phil walsh
 
Posts: 3317
Joined: Wed May 16, 2007 8:46 pm


Return to V - Skyrim