4
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
1001 B

Scriptname defaultAliasRespawnScript extends ReferenceAlias
{script for simple respawning of an alias
Use with defaultQuestRespawnScript
}
function RespawnIfDead()
; debug.trace(self + " RespawnIfDead")
if GetActorReference().IsDead()
defaultQuestRespawnScript myQuest = GetOwningQuest() as defaultQuestRespawnScript
gotoState("respawning")
myQuest.Respawn(self)
gotoState("normal")
else
; debug.trace(self + "RespawnIfDead: I'm not dead - " + GetActorReference() + ".IsDead()=" + GetActorReference().IsDead())
endif
endFunction
auto state normal
Event OnDeath(Actor akKiller)
if bRespawningOn
defaultQuestRespawnScript myQuest = GetOwningQuest() as defaultQuestRespawnScript
gotoState("respawning")
myQuest.TryToRespawn(self)
gotoState("normal")
endif
endEvent
endState
state respawning
Event OnDeath(Actor akKiller)
endEvent
endState
bool Property bRespawningOn = true Auto
{set to false to stop this alias from auto-respawning when it dies
defaults to TRUE}