TheRaymondPlex Posted March 15, 2020 Share Posted March 15, 2020 Hello everyone! I need your help with code... First of all, I do NOT know Papyrus. And I don't want to learn it just for one thing I need.Well. I want to create one spell, that will spawn a magic barrier with collision around you. The model I want to use is the small barrier from Magnus Eye. WorldObjects\MovableStatic\Clutter\EyeOfMagnus\MGEyeBarrierSmall.nif And i don't know, how to realise that.. For example, there is a mod, called Apocalypse. And there is one spell, that summons a stone wall from ground. The type of it's spell is Concentration. I tried to edit the script for that spell, but CK says, that I can't do it, because there is no source file with script. And also there is a mod, called Dark Envoy - Vampire Powers, that has very close spell (Ominous Cage) to that barrier I want. It activates as talent, and can be diactivated with E button. In general, there sould be a spell with fire and forget type on self, that creates this barrier with its rotation animation and sound around the caster. And that would be great, if there is an ability to change the models scale with script. And finaly there should be an ability to disable it on E. How to realise that? Any ideas guys? Link to comment Share on other sites More sharing options...
maxarturo Posted March 15, 2020 Share Posted March 15, 2020 (edited) This is quite simple to do, just add this script to your 'Magic Effect': ObjectReference Property Barrier Auto Sound Property SoundFx Auto int instanceID Actor SelfRef Event OnEffectStart(Actor akTarget, Actor akCaster) SelfRef = akCaster SelfRef.PlaceAtMe(Barrier, 1) instanceID = SoundFx.Play(SelfRef) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) Barrier.Disable(true) Sound.StopInstance(instanceID) Barrier.Delete() EndEvent "And finaly there should be an ability to disable it on E" To do this you need to make the 'Barrier' an "Activator" in CK and place on it a "Self Disable On Activate" script. And also change this line in the script above. ObjectReference Property Barrier Auto TO Activator Property Barrier Auto "if there is an ability to change the models scale with script." Yes, this can also be done, but start with the basic first before diving into deeper waters. * Don't forget to fill in the properties. Edited March 15, 2020 by maxarturo Link to comment Share on other sites More sharing options...
ReDragon2013 Posted March 15, 2020 Share Posted March 15, 2020 (edited) You wrote: "CK says, that I can't do it, because there is no source file with script."The Skyrim CreationKit is looking for specific path that includes all of the source scripts. drive:\ Steam \ SteamApps \ Common \ Skyrim \ Data \ Scripts \ SourceWhat maxaturo tried to tell you is that:You have to open the CreationKit and create the 'Barrier' as an "Activator" (or select an existing and make a copy from). After that assign to the Activator the vanilla script as follow:defaultDisableSelfOnActivate Scriptname defaultDisableSelfOnActivate extends ObjectReference {for anything that you want to disable itself once its activated} auto STATE WaitingToBeActivated EVENT OnActivate (objectReference triggerRef) Disable() GoToState("Disabled") EndEvent EndState STATE Disabled ;done doing stuff endSTATE You do NOT have to create the script, it is already existing in vanilla game! The magic effect should have attached a "unique named" script as follow (similiar to the script which maxarturo posted):rayBarrierMGEFScript Scriptname rayBarrierMGEFScript extends ActiveMagicEffect ; https://forums.nexusmods.com/index.php?/topic/8495558-script-need-your-help-with-spawning-a-barrier-with-spell/ ; properties Activator PROPERTY Barrier auto ; a base object as activator Sound PROPERTY SoundFx auto ; sound to play for ; variables Int instanceID ObjectReference myRef ;Actor caster ; *** ; -- EVENTs -- 2 EVENT OnEffectStart(Actor akTarget, Actor akCaster) ;;; caster = akCaster ; *** make the caster persistent by script (not needed for this script) myRef = akCaster.PlaceAtMe(Barrier, 1) ; create a barrier as object instanceID = SoundFx.Play(akCaster as ObjectReference) ; play sound fx, store soundID ENDEVENT EVENT OnEffectFinish(Actor akTarget, Actor akCaster) IF ( myRef ) myRef.Disable(TRUE) ; switch object off with fading out IF (instanceID > 0) Sound.StopInstance(instanceID) ; stop playing sound fx instanceID = 0 ; remove soundID ENDIF myRef.Delete() ; mark script placed object for delete myRef = None ; remove script persistence, object can be deleted by game engine ENDIF ENDEVENT ; vanilla SAMPLE script ;----------------------------------------------------------------------- ; Scriptname DLC1MagicCastFromSunScript extends ActiveMagicEffect ; ; Static Property PlacedXMarker auto ; {This is the marker the spell is cast from. Use the XMarker please} ; ; Activator Property ActivatorRef Auto ; {This is the art that will be used for the sun burst visual effect} ; ; ObjectReference MyActivator = None ; ----------------------------------- ; snippets of code: ; ; ObjectReference XMarkerRef = CasterActor.placeAtMe(PlacedXMarker) ; ; MyActivator = XMarkerRef.placeatme(ActivatorRef) Edited March 15, 2020 by ReDragon2013 Link to comment Share on other sites More sharing options...
TheRaymondPlex Posted March 16, 2020 Author Share Posted March 16, 2020 Thanks a lot for the scripts! But where can I change the model of the barrier? If I create a new spell, for example, from the copy of the Candle Light, I should change it's magic effect to mine and its ID. But in the magic effect window there is no any parameter, that will allow me to change the model to spawn, as I know. If I want to spawn a usual barrel, for example, with the ability to disable it on E after spawning, what and where should I change? Can somebody tell me, how to create that spell correctly? That would be great, if someone has an ability to give me a plan of creating it. I've watched a lot of tutorials, but there are only something like "How to summon an NPC with spell" or "Creating a spell in CK".. and there is no info, that I need.. no one shows, how to spawn/create an object with spell. As I understand, we need to spawn an activator with spell. That's ok. There are a lot of tutorials about creating an activator. But I don't know, where is this connection between spell and spawning an activator.. I want to fully understand the mechanichs of it. If you know that, give me some of your knowledge, please)Or if you are able to, help me with the creating from very beginning, please. This in not necessary, but if you can, then it would be nice. Link to comment Share on other sites More sharing options...
maxarturo Posted March 17, 2020 Share Posted March 17, 2020 (edited) Sorry in advance !, and i don't want to sound like an A*****..., but the fact that you are asking: "where is this connection between spell and spawning an activator" Makes me realize that you are at the very beginning and you don't know the very basics, and that's ok we were all in the same position at some point. But, i personally can't be involved right now with teaching someone how to mod, at the moment i have very limited free time !. * The "Activator" or the "Static" is selected in the script's properties that will be added in your "Magic Effect". * Maybe another kind soul can pick up from here... And again sorry !. Edited March 17, 2020 by maxarturo Link to comment Share on other sites More sharing options...
TheRaymondPlex Posted March 17, 2020 Author Share Posted March 17, 2020 Sorry in advance !, and i don't want to sound like an A*****..., but the fact that you are asking:"where is this connection between spell and spawning an activator"Makes me realize that you are at the very beginning and you don't know the very basics, and that's ok we were all in the same position at some point.But, i personally can't be involved right now with teaching someone how to mod, at the moment i have very limited free time !. * The "Activator" or the "Static" is selected in the script's properties that will be added in your "Magic Effect". And again sorry !. It's ok. You can not apologize. I understand, that I want a lot of things from you. And yes, I'm in modding just a few days. But anyway, you did all you can do already. So thank very much for the answers and for this little hint about "activators" and "statics". Link to comment Share on other sites More sharing options...
Recommended Posts