Jump to content

Recommended Posts

Posted

Hello,

I am needing help in having a script that I can attach to an Actor that makes them respawn after death after a certain amount of time.

Like, the player kills said Actor, say 10 seconds passes, and the actor respawns. Creating an infinite loop.

Thanks!

Posted

You can use the event OnDeath or OnDying, in it you can call a 10 seconds timer with StartTimer, and respawn it in the OnTimer Event.

 

Search for examples of those in the wiki.

Posted

Did you mean "resurrect" instead of "respawn"?

 

 

Scriptname YOURSCRIPTNAME extends Actor Const

Int Property ResurrectTime = 10 Auto Const


Event OnDying(Actor akKiler)
	StartTimer(RespawnTime, 555)
EndEvent

Event OnTimer(int aiTimerID)
	If aiTimerID == 555
		ResurrectActor()
	EndIf
EndEvent

Function ResurrectActor()
	If IsDead()
		Resurrect()
	EndIf
EndFunction

 

 

 

Or did you mean to spawn a new NPC?

 

 

Scriptname YOURSCRIPTNAME extends Actor Const

Int Property SpawnTime = 10 Auto Const


Event OnDying(Actor akKiler)
	StartTimer(SpawnTime, 555)
EndEvent

Event OnTimer(int aiTimerID)
	If aiTimerID == 555
		SpawnActor()
	EndIf
EndEvent

Function SpawnActor()
	If !GetLeveledActorBase()
		PlaceActorAtMe(GetActorBase())
	Else
		PlaceActorAtMe(GetLeveledActorBase())
	EndIf
EndFunction

 

 

 

NPCs respawn when their Cell resets.

Posted

Did you mean "resurrect" instead of "respawn"?

 

 

Scriptname YOURSCRIPTNAME extends Actor Const

Int Property ResurrectTime = 10 Auto Const


Event OnDying(Actor akKiler)
	StartTimer(RespawnTime, 555)
EndEvent

Event OnTimer(int aiTimerID)
	If aiTimerID == 555
		ResurrectActor()
	EndIf
EndEvent

Function ResurrectActor()
	If IsDead()
		Resurrect()
	EndIf
EndFunction

 

 

 

Or did you mean to spawn a new NPC?

 

 

Scriptname YOURSCRIPTNAME extends Actor Const

Int Property SpawnTime = 10 Auto Const


Event OnDying(Actor akKiler)
	StartTimer(SpawnTime, 555)
EndEvent

Event OnTimer(int aiTimerID)
	If aiTimerID == 555
		SpawnActor()
	EndIf
EndEvent

Function SpawnActor()
	If !GetLeveledActorBase()
		PlaceActorAtMe(GetActorBase())
	Else
		PlaceActorAtMe(GetLeveledActorBase())
	EndIf
EndFunction

 

 

 

NPCs respawn when their Cell resets.

Thanks, but what I mean is like, for example. In the cell "DebugRange" , the T-Posing NPC's, once they die, their dead body despawns and they respawn back on their marker after like 3 seconds. Was wanting something like that and if possible a timer added onto it. And is looping so it does not have any limit to how many times it can be done. I tried messing with the script there but I am not very good at making them.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...