jacksonl Posted June 25, 2014 Share Posted June 25, 2014 (edited) Hello, I would like to have 3 Npcs respawn much like how creatures, and enemies respawn out in wasteland after a set time. Currently I am using this script : scn mynpcscript begin ontriggerenter player mynpcref1.enable end This script currently spawns one npc, one time.I have respawn checked on my current npc, but even after 72 hours and exiting and re-entering the cell he does not come back. How can I edit this or rewrite it to fit my needs? Cheers, Sam Edit: Basically what I would like is 3 Fiends to respawn back into the world, after they are killed; and this continues forever. Edited June 25, 2014 by jacksonl Link to comment Share on other sites More sharing options...
JJ2198 Posted June 25, 2014 Share Posted June 25, 2014 Bit of an amateur so this is probably not the best way to do it, but should work. scn ScriptName Begin OnTriggerEnter Player ActorRef1.resurrect ActorRef1.MoveTo Pos1 end Use Xmarkers for the MoveTo. Link to comment Share on other sites More sharing options...
jacksonl Posted June 26, 2014 Author Share Posted June 26, 2014 (edited) Bit of an amateur so this is probably not the best way to do it, but should work. scn ScriptName Begin OnTriggerEnter Player ActorRef1.resurrect ActorRef1.MoveTo Pos1 end Use Xmarkers for the MoveTo. In order to make the npc respawn I have to once again bump into the trigger area.What I would like Ideally, is that once the player enters the trigger area initially, it spawn the npc in and if he in fact dies. He will once again spawn in at his starting location without the need to touch the trigger again. Edited June 26, 2014 by jacksonl Link to comment Share on other sites More sharing options...
JJ2198 Posted June 26, 2014 Share Posted June 26, 2014 Right, okay then maybe something like this then. scn ScriptName Begin GameMode If GetDayOfWeek == 0 || GetDayOfWeek == 3 ActorRef1.Resurrect ActorRef1.MoveTo Pos1 endif end This should resurrect and move them back every sunday and wednesday, that work for you? Link to comment Share on other sites More sharing options...
jacksonl Posted June 26, 2014 Author Share Posted June 26, 2014 (edited) Edit: Also thank you very much for bearing with me JJ, I'm learning the scripting ropes! I put the new script in, but the npc does not seem to spawn in on Wednsday or Sunday. Could it be that the Script needs to be turned on somewhere/somehow now that it no longer is using the OnTriggerEnter Player. Perhaps I can use the previous script to activate this script? So something like: scn ScriptName Begin OnTriggerEnter Player *Start ScriptName code* end Edited June 26, 2014 by jacksonl Link to comment Share on other sites More sharing options...
JJ2198 Posted June 26, 2014 Share Posted June 26, 2014 (edited) Sorry about that, did some testing and this should work:Needs to be attached to something to run, so just make a trigger box wherever and have it running the script and that should do it. Also make sure to check the persistent ref box. scn ScriptName Begin GameMode int Respawn If GetDayOfWeek == 0 || GetDayOfWeek == 3 If ActorRef1.GetDead == 1 && Respawn == 0 ActorRef1.Resurrect Set Respawn to 1 endif else Set Respawn to 0 endif end Edited June 26, 2014 by JJ2198 Link to comment Share on other sites More sharing options...
jacksonl Posted June 26, 2014 Author Share Posted June 26, 2014 (edited) Sorry about that, did some testing and this should work:Needs to be attached to something to run, so just make a trigger box wherever and have it running the script and that should do it. Also make sure to check the persistent ref box. scn ScriptName Begin GameMode int Respawn If GetDayOfWeek == 0 || GetDayOfWeek == 3 If ActorRef1.GetDead == 1 && Respawn == 0 ActorRef1.Resurrect Set Respawn to 1 endif else Set Respawn to 0 endif end Works like a charm, my sincerest thanks JJ! I had two more questions: Can I set it to be a random time during the Sunday or Wednsday, to give it variation? Also, can I use add multiple NPC's to this by using changing the code to the below - If ActorRef1.GetDead == 1 && ActorRef2.GetDead == 1 && ActorRef3.GetDead == 1 && Respawn == 0ActorRef1.Resurrect && ActorRef2.Resurrect && ActorRef3.Resurrect Edited June 26, 2014 by jacksonl Link to comment Share on other sites More sharing options...
JJ2198 Posted June 26, 2014 Share Posted June 26, 2014 For setting it to a specific hour try if gamehour == ## (0-23) and I think || and && only work for conditions so just do sperate lines for the resurrecting. Link to comment Share on other sites More sharing options...
jacksonl Posted June 26, 2014 Author Share Posted June 26, 2014 For setting it to a specific hour try if gamehour == ## (0-23) and I think || and && only work for conditions so just do sperate lines for the resurrecting. Thank you JJ, You've helped me take a tremendous step forward. All credit goes to you :thumbsup: Link to comment Share on other sites More sharing options...
jacksonl Posted June 26, 2014 Author Share Posted June 26, 2014 (edited) scn ScriptName Begin GameMode int Respawn If GameHour == 12 && GetDayOfWeek == 0 || GameHour == 06 GetDayOfWeek == 3 If ActorRef1.GetDead == 1 && Respawn == 0 ActorRef1.Resurrect Set Respawn to 1 endif If ActorRef2.GetDead == 1 && Respawn == 0 ActorRef2.Resurrect Set Respawn to 1 endif If ActorRef3.GetDead == 1 && Respawn == 0 ActorRef3.Resurrect Set Respawn to 1 endif else Set Respawn to 0 endif end Hey JJ, I tried adding in the GameHour == ## and putting in separate lines for each additional enemy. I definitely did something wrong.I tried both the GameHour and additional enemies separate but here is the code combined. If you get a chance, any ideas? Thanks again Edited June 26, 2014 by jacksonl Link to comment Share on other sites More sharing options...
Recommended Posts