khulse Posted October 26, 2016 Share Posted October 26, 2016 My scripting knowledge isn't much, so I'm having a little trouble. I borrowed the following script from the creation kit wiki's "complete example scripts". I've got it working consistently and so forth. I'd also like to change the spell effect it uses from the generic "SummonTargetFXActivator" to a custom effect that's more appropriate for what the spell is supposed to be doing. Putting the activator for the effect together is no problem, but getting it to use that instead of SummonTargetFXActivator is proving to be beyond my meager programming skills. Anyone have any suggestions on how I can do that? scriptName AAHiveMoveActivatorScript extends ActiveMagicEffect ObjectReference Property YourSummonREF Auto ; An ObjectReference will also work with the summon function GlobalVariable Property aiStage Auto Event OnEffectStart(Actor akTarget, Actor akCaster) Summon(akCaster, YourSummonREF) EndEvent ; GetFormFromFile below to enable 'Global' flag Function Summon(ObjectReference akSummoner = None, ObjectReference akSummon = None, Float afDistance = 150.0, Float afZOffset = 0.0, ObjectReference arPortal = None, Int aiStage = 0) Global While aiStage < 6 aiStage += 1 If aiStage == 1 ; Shroud summon with portal arPortal = akSummon.PlaceAtMe(Game.GetFormFromFile(0x0007CD55, "Skyrim.ESM")) ; SummonTargetFXActivator disables and deletes itself shortly after stage 5 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) EndWhile aiStage = 0 EndFunction Link to comment Share on other sites More sharing options...
ReDragon2013 Posted October 26, 2016 Share Posted October 26, 2016 Maybe next adjusted wiki script could be helpful to understand what the original script is doing. Not all wiki scripts are really handy to modify! ScriptName RepeatableSummonEffectScript extends ActiveMagicEffect {rewritten by ReDragon 2016, source: http://www.creationkit.com/index.php?title=Complete_Example_Scripts} Actor PROPERTY YourSummonREF auto ; fill with an existing actor ;ObjectReference PROPERTY YourSummonREF auto ; will also work with the summon function Activator PROPERTY SummonTargetFXActivator auto ; fill with activtor which has FormID "0x0007CD55" ; -- EVENTs -- 2 EVENT OnEffectStart(Actor akTarget, Actor akCaster) Debug.Trace("SummonEffectScript: OnEffecStart() - caster = " +akCaster+", target = " +akTarget+" " +self) ; a bit information about runtime Summon(akCaster, YourSummonREF as ObjectReference) ENDEVENT EVENT OnEffectFinish(Actor akTarget, Actor akCaster) Debug.Trace("SummonEffectScript: OnEffectFinish() - caster = " +akCaster+", target = " +akTarget) ENDEVENT ; -- FUNCTION -- ;------------------------------------------------------------------------------------------------------- FUNCTION Summon(Actor akSummoner, ObjectReference akSummon, Float afDistance=150.0, Float afZOffset=0.0) ;------------------------------------------------------------------------------------------------------- IF (akSummoner) && (akSummon) && (SummonTargetFXActivator) ELSE RETURN ; - STOP - akCaster is <None> OR YourSummonREF is <None> ENDIF ;--------------------- ; Shroud summon with portal aiStage == 1 ;; ObjectReference Function PlaceAtMe(akFormToPlace, aiCount=1, abForcePersist=False, abInitiallyDisabled=False) native ;;; objectReference arPortal = akSummon.PlaceAtMe(Game.GetForm(0x0007CD55), 1, False, False) ; "arPortal" is non-peristent placed a SummonTargetFXActivator objectReference arPortal = akSummon.PlaceAtMe(SummonTargetFXActivator as Form, 1, False, False) ; same as above but is using a property Utility.Wait(0.6) ; ----------------------------------------- ; Disable Summon aiStage == 2 akSummon.Disable() ; switch OFF Utility.Wait(0.25) ; ----------------------------------------- ; Move portal in front of summoner aiStage == 3 float f = akSummoner.GetAngleZ() arPortal.MoveTo(akSummoner as ObjectReference, (Math.Sin(f) * afDistance), (Math.Cos(f) * afDistance), afZOffset) Utility.Wait(0.5) ;------------------------------------------ ; Move summon to portal aiStage == 4 akSummon.MoveTo(arPortal) Utility.Wait(0.25) ;------------------------------------------ ; Enable summon as the portal dissipates aiStage == 5 akSummon.Enable() ; switch ON ;;; Utility.Wait(0.6) ; SummonTargetFXActivator disables and deletes itself, if this function finished (shortly after stage 5) hopefully ENDFUNCTION Link to comment Share on other sites More sharing options...
irswat Posted October 26, 2016 Share Posted October 26, 2016 (edited) Open up Skyrim.esm in tes5edit and search for this form: 0x0007CD55. You'll find that it is SummonTargetFXActivator. So I'm going to guess what you want to do is get the FormID of the effect you are trying to replace it with, and put it in the script here. Edited October 26, 2016 by irswat Link to comment Share on other sites More sharing options...
PeterMartyr Posted October 26, 2016 Share Posted October 26, 2016 Load Skyrim in TES5Edit then paste 0007CD55 in FormID in TES5Edit & hit Enter Key to search Pick another effect & replace Form ID in the Script, remember to place X back, Note the original script had to many " 0 " I would've wrote it has 0x7CD55, thank god papyrus ignores Empty Zero's in formID To be more precise formID has 8 digits not 9 12345678 in code becomes 0x345678 "Plugin Name" the first two digits is plugin load order & ignored, always replace them with 0x Link to comment Share on other sites More sharing options...
khulse Posted October 27, 2016 Author Share Posted October 27, 2016 Maybe next adjusted wiki script could be helpful to understand what the original script is doing. Not all wiki scripts are really handy to modify! No, they're not, especially for someone who's trying to figure out how to do it without much in the way of scripting skill. I'll try fiddling with your's and see if it'll work the way I want it to.Thank you for the help!!! Open up Skyrim.esm in tes5edit and search for this form: 0x0007CD55. You'll find that it is SummonTargetFXActivator. So I'm going to guess what you want to do is get the FormID of the effect you are trying to replace it with, and put it in the script here. Load Skyrim in TES5Edit then paste 0007CD55 in FormID in TES5Edit & hit Enter Key to search Pick another effect & replace Form ID in the Script, remember to place X back, Note the original script had to many " 0 " I would've wrote it has 0x7CD55, thank god papyrus ignores Empty Zero's in formID To be more precise formID has 8 digits not 9 12345678 in code becomes 0x345678 "Plugin Name" the first two digits is plugin load order & ignored, always replace them with 0x I could just switch out SummonTargetFXActivator for a different one, I suppose. The only trouble is, SummonTargetFXActivator is designed for this (it self disables), but the effect I want to use isn't there. I need to create a custom activator with the same self disable script attached and the effect I want. I'm not sure how reliable this kind of setup would be at retrieving a custom formID from a mod .esp instead of an .esm. I know filling a variable works, since 99% of papyrus scripts do it that way. Link to comment Share on other sites More sharing options...
khulse Posted October 27, 2016 Author Share Posted October 27, 2016 (edited) @ ReDragon2013 It works perfectly! I had to fiddle with the settings in the nif for the spell effect I wanted to get it to work as an activator, but now that it's all set up everything works more or less the way I want it to. Thank you for the help! For anyone else that's trying to use a custom spell effect with this: you need to create an activator in the creation kit. Easiest way is to clone the summontargetfxactivator and swap out the mesh for the one you want to use. The nif that I wanted to use (lurkerstompexplosion.nif) didn't work originally. I had to swap out the NiStringsExtraData block in the nif for a BSBehaviorGraphExtraData, then rename it to 'BGED' and put in Magic\IdleOnLoad.hkx in the behavior graph file field. Then I had to rename the NiControlerSequence block to mIdle. A little complicated, but it works. Edit to Add: oh, and of course, I renamed and saved the modified lurkerstomexplosion.nif. It's not a good idea to override vanilla resources if you can help it. Edited October 27, 2016 by khulse Link to comment Share on other sites More sharing options...
Recommended Posts