Difference between revisions of "Complete Example Scripts"

Jump to navigation Jump to search
80 bytes added ,  11:02, 25 May 2018
imported>Quindraco
imported>Quindraco
Line 644: Line 644:


= Summon Spell =
= Summon Spell =
*The below will summon YourSummonREF from wherever they are to the player. In this example, it's dealt with by a spell, but the function could be placed and/or called elsewhere. If as a spell, be sure to set the cooldown time to about 3.0 seconds so the caster can't cast it again until it's worked itself out.
*The below will summon YourSummonREF from wherever they are to the player. In this example, it's dealt with by a spell, but the function could be placed and/or called elsewhere. If as a spell, be sure to set the charge time to about 3.0 seconds so the caster can't cast it again until it's worked itself out.
<Source lang="Papyrus">ScriptName RepeatableSummonEffectScript extends ActiveMagicEffect
<Source lang="Papyrus">ScriptName RepeatableSummonEffectScript extends ActiveMagicEffect


Actor Property YourSummonREF Auto ; An ObjectReference will also work with the summon function
Actor Property YourSummonREF Auto ; An ObjectReference will also work with the summon function
Activator Property portal = Game.GetFormFromFile(0x0007CD55, "Skyrim.ESM") Auto ; default value is SummonTargetFXActivator


Event OnEffectStart(Actor akTarget, Actor akCaster)
Event OnEffectStart(Actor akTarget, Actor akCaster)
Line 654: Line 655:


; GetFormFromFile below to enable 'Global' flag
; 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  
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
         While aiStage < 6
                 aiStage += 1
                 aiStage += 1
                 If aiStage == 1 ; Shroud summon with portal
                 If aiStage == 1 ; Shroud summon with portal
                         arPortal = akSummon.PlaceAtMe(Game.GetFormFromFile(0x0007CD55, "Skyrim.ESM")) ; SummonTargetFXActivator disables and deletes itself shortly after stage 5
                         arPortal = akSummon.PlaceAtMe(portal) ; SummonTargetFXActivator disables and deletes itself shortly after stage 5
                 ElseIf aiStage == 2 ; Disable Summon
                 ElseIf aiStage == 2 ; Disable Summon
                         akSummon.Disable()
                         akSummon.Disable()
Anonymous user

Navigation menu