Difference between revisions of "Complete Example Scripts"
Jump to navigation
Jump to search
Undo revision 51939 by Quindraco (talk) - Not syntactically correct.
imported>Quindraco |
imported>Rasikko |
||
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 | *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. | ||
<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 | ||
Event OnEffectStart(Actor akTarget, Actor akCaster) | Event OnEffectStart(Actor akTarget, Actor akCaster) | ||
Line 655: | Line 654: | ||
; 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( | arPortal = akSummon.PlaceAtMe(Game.GetFormFromFile(0x0007CD55, "Skyrim.ESM")) ; SummonTargetFXActivator disables and deletes itself shortly after stage 5 | ||
ElseIf aiStage == 2 ; Disable Summon | ElseIf aiStage == 2 ; Disable Summon | ||
akSummon.Disable() | akSummon.Disable() |