opusGlass Posted January 4, 2017 Share Posted January 4, 2017 I'm trying to spawn enemy NPCs at random intervals of time, say maybe once every few game days, but only at night. I have an idea of how I will achieve this but I'm just not sure if it's the best way: I will create a quest that starts enabled, and attach it to the player via an alias. I'll attach a script to that, which uses RegisterForSingleUpdate to run a basic check function every several hours. In that function, I will check the time of day. If it's night time, I will run a random check to decide whether or not to spawn. If it succeeds, I will spawn an NPC at some distance from the player. I will put an alias on that NPC with a second script attached. I will call RegisterForSingleUpdate on this NPC to schedule a de-spawn for him. When the NPC's update comes in, I will check if he is far away from the player -- if so, I will delete him. So, what do you guys think? Will this work? Is there a better/easier way? Link to comment Share on other sites More sharing options...
Masterofnet Posted January 4, 2017 Share Posted January 4, 2017 I think you might want to use some packages for this. Have a look at the random vampire attack quests. There is one that specifically has them attack the player. Even the Dragon Attack player quest may be useful. Link to comment Share on other sites More sharing options...
opusGlass Posted January 6, 2017 Author Share Posted January 6, 2017 I think you might want to use some packages for this. Have a look at the random vampire attack quests. There is one that specifically has them attack the player. Even the Dragon Attack player quest may be useful. Okay, thanks. I looked into it and it seems those quests are hooked through the Script Event story manager node. I've never worked with Story Manager before so I've got a lot to learn. One concern I have -- do you know if two mods that add a quest to the same story manager node will conflict with each other? Link to comment Share on other sites More sharing options...
Masterofnet Posted January 6, 2017 Share Posted January 6, 2017 No they do not. Story Manager is easy to work with, you should have this quest up a running in not time. Link to comment Share on other sites More sharing options...
opusGlass Posted January 8, 2017 Author Share Posted January 8, 2017 No they do not. Story Manager is easy to work with, you should have this quest up a running in not time. Question -- do you know of any way to test the spawn quests? Player.startquest <questID> doesn't seem to do anything :/ Link to comment Share on other sites More sharing options...
Masterofnet Posted January 8, 2017 Share Posted January 8, 2017 (edited) If your quest is attached to the Story Manager Event, the conditions on it may be preventing the quest from starting. Edited January 8, 2017 by Masterofnet Link to comment Share on other sites More sharing options...
Recommended Posts