Paladin555 Posted May 7, 2023 Share Posted May 7, 2023 Hi everyone, I'm trying to write a script for some npc battles. I want a character who's killed to respawn after 5 seconds and spawn back to it's original location. Here's what I have so far. I can't save the script because it keeps saying: "script RespawnNPC line 6, RespawnCount not found" Scriptname RespawnNPC int RespawnCount Begin OnDeath ; Increase the respawn count RespawnCount += 1 ; Respawn the NPC after a delay delayedStart 1.0, "Respawn"End Function Respawn() ; Spawn a new copy of the NPC at their original location Actor newActor = Actor.PlaceAtMe(GetBaseObject(), GetPosition(), GetRotation()) ; Decrement the respawn count RespawnCount -= 1 ; Disable the old NPC Disable() ; Destroy the old NPC after a delay delayedStart 5.0, "DestroyOldActor"End Function DestroyOldActor() ; Destroy the old actor Game.Delete(GetSelf())End Link to comment Share on other sites More sharing options...
madmongo Posted May 8, 2023 Share Posted May 8, 2023 The GECK doesn't support += and -=. Change RespawnCount += 1 to RespawnCount = RespawnCount + 1 and change RespawnCount -= 1 to RespawnCount = RespawnCount - 1. Link to comment Share on other sites More sharing options...
Paladin555 Posted May 18, 2023 Author Share Posted May 18, 2023 It keeps saying script command RespawnCount not found on line 8. Am I doing something wrong? Link to comment Share on other sites More sharing options...
madmongo Posted May 18, 2023 Share Posted May 18, 2023 (edited) Sorry, brain fart. That should be "set RespawnCount to RespawnCount + 1" Edited May 18, 2023 by madmongo Link to comment Share on other sites More sharing options...
Recommended Posts