Difference between revisions of "Complete Example Scripts"

Jump to navigation Jump to search
1,137 bytes added ,  11:42, 3 December 2014
no edit summary
imported>Langerz82
imported>DarkWolfModding
Line 910: Line 910:
EndFunction
EndFunction
</source>
</source>
=Resurrect an Enemy on Death Script=
Created by [http://www.nexusmods.com/skyrim/users/6211524/? DarkWolfModding].
This is a script that will resurrect an enemy for a defined amount of times.
<source lang=papyrus>
Scriptname ResurrectEnemySCRIPT Extends Actor
import game
import utility
import debug
Actor Property PlayerREF Auto
int Property MaxDeathCount auto
Int Property CurrentDeathCount Auto ;DO NOT Change
Event OnDeath(Actor akKiller)
AddToCurrentDeathCount()
If (CurrentDeathCount <= MaxDeathCount) ;If Death count is lower than MaxDeathCount do the next bit of code
wait(2); Wait 2 Seconds real time
Self.PlaceAtMe(GetFormFromFile(0x0007CD55, "Skyrim.ESM"));Place Summon FX at dead NPC
Self.Resurrect() ;Resurrect Dead NPC
EndIf
EndEvent
Function AddToCurrentDeathCount()
CurrentDeathCount += 1 ;CurrentDeathCount = CurrentDeathCountValue + 1
EndFunction
</source>
Once you compile the script just attach the script to an enemy actor and set the value of MaxDeathCount to the desired max amount of deaths.
--[[User:DarkWolfModding|DarkWolfModding]] ([[User talk:DarkWolfModding|talk]]) 2014-12-03T11:42:37 (EST)
{{Languages}}
{{Languages}}
[[Category: Papyrus]]
[[Category: Papyrus]]

Navigation menu