tawney Posted February 3, 2015 Share Posted February 3, 2015 I don't know where to begin creating a script for a spell that will summon an NPC to where my character is. If this isn't possible, how might I script an item, such as a ring, to summon that NPC to me? Any help is greatly appreciated. Link to comment Share on other sites More sharing options...
Surilindur Posted February 3, 2015 Share Posted February 3, 2015 (edited) You can make a spell with only a script effect and attach the script that moves the NPC to player to that script effect. You can also give the effect a fancy name if you want. If you want to have the same NPC moved to the player every time, you can create a dummy cell with only that NPC and an xmarker in it (and a floor if you want). You can add one NPC to that cell, make it initially disabled, make it a persistent reference and give it a unique referenceID (or whatever the box above everything else in the menu that pops up when double-clicking the NPC is). Then give the marker its own unique... thing. If it is a referenceID. I am not an expert when it comes the names of these different things. :smile: Moving the NPC should be possible with two scripts. One attached to the NPC that, when it dies, resurrects it, moves it to the marker and disables it. The second would be the spell that enables the NPC and moves it to player. The NPC would need to be unique (a new base record, I think) so that it is possible to attach the script to it. And it should also have a follow package with player as the target. And the appropriate factions assigned, of course. I have no idea what kind of advice and how much you need but if you want to know more, I can try to help. I am sure others will help you, too. And others will also hopefully correct me if I am completely wrong - or at least I hope so. :D The script for the spell could be something like that (I am not sure, though, I do not have my gaming PC near just now): ScriptName UniquelyNamedSummonSpellScript Begin ScriptEffectStart TheUniqueNPCRef.Enable TheUniqueNPCRef.MoveTo Player ;TheUniqueNPCRef.PlayMagicEffectVisuals MYTH EndWhere TheUniqueNPCRef is the unique referenceID for the actor placed in the dummy cell. The third, commented out line in the ScriptEffectStart block just plays the Mythid Dawn summon visuals on the NPC. I commented it out because I have occasionally had the effects stick there even though the NPC was moved elsewhere. This is especially true for the next example (also commented out there) where the NPC "vanishes". You can remove the ; mark before them and see if they work as intended. They are not necessary, they just should look a bit better. The script should be defined as a magic effect instead of the default object script (bottom right corner of script editor if using CSE). The NPC could have something like that attached to it (again I am not sure): ScriptName UniquelyNamedNPCScript Begin OnDeath ;PlayMagicEffectVisuals MYTH ResurrectActor MoveToMarker UniquelyNamedMarkerRef Disable EndWhere UniquelyNamedMarkerRef is the referenceID of the marker in the dummy cell. This script should be defined as an object script. If you want the NPC to disappear when the spell runs out, you can just use something like the following magic effect script in the spell and forget about the NPC script and the first example of the magic effect script as they are not needed. But again, I am not completely sure. ScriptName UniquelyNamedSummonSpellAlternativeScript Begin ScriptEffectStart TheUniqueNPCRef.Enable TheUniqueNPCRef.MoveTo Player ;TheUniqueNPCRef.PlayMagicEffectVisuals MYTH End Begin ScriptEffectFinish ;TheUniqueNPCRef.PlayMagicEffectVisuals MYTH TheUniqueNPCRef.ResurrectActor TheUniqueNPCRef.MoveToMarker UniquelyNamedMarkerRef TheUniqueNPCRef.Disable EndIf those are completely wrong, please correct me. If someone happens to read this, that is. Edited February 3, 2015 by PhilippePetain Link to comment Share on other sites More sharing options...
tawney Posted February 4, 2015 Author Share Posted February 4, 2015 With the first script I'm getting a syntax error that says it's an invalid reference. Something about only object references and reference variables are allowed. I'm not sure what I did wrong. I created a dummy cell for the npc, dropped it inside, double clicked on it and set the reference editor id to something unique, and made sure initially disabled and persistent reference were checked. Also I made sure the script editor is set to be a magic effect. The NPC is essential so it shouldn't need to be sent to the cell after dying. I intend to use the spell only if I get separated from them. Link to comment Share on other sites More sharing options...
Surilindur Posted February 4, 2015 Share Posted February 4, 2015 (edited) Hmm... it worked just fine for me. Did you try to use the base record's ID (the one chosen when creating the NPC, selecting hair, adding equipment, etc.) or the ID of the specific instance of that base record (the one placed in the dummy cell)? And you did change the one in the script to the unique reference ID of your NPC? Because it only does the things to something with exactly that reference ID ("TheUniqueNPCRef" in the first example)? Here is an image of how I managed to make it work (if I manage to hide it in a spoiler or something, it is still rather large). Perhaps it could be useful? http://static-1.nexusmods.com/15/mods/101/images/45894-1-1423058011.jpg And if you only want to move the NPC to player, the following should work: ScriptName UniqueSummonSpellYetAnotherScript Begin ScriptEffectStart If TheUniqueNPCRef.GetDisabled TheUniqueNPCRef.Enable EndIf TheUniqueNPCRef.MoveTo Player TheUniqueNPCRef.PlayMagicEffectVisuals MYTH EndI use the Construction Set Extender by shadeMe, so I am not sure if it fixes some script writing issues those could be present in the original CS. At least it comes with its own script editor. If you are not using it, I would definitely recommend starting to use it immediately. It makes making mods enjoyable instead of painful. :smile: Edited February 4, 2015 by PhilippePetain Link to comment Share on other sites More sharing options...
Recommended Posts