MongoMonk Posted September 3, 2019 Share Posted September 3, 2019 I am looking for some way to check whether an NPC has been encountered before in the same session. My script already starts on each actor whose 3D is loaded (attached via the race record).What I need is some sort of variable or something which I can set for an NPC which will be automatically cleared once Skyrim is restarted. Any help would be greatly appreciated! Link to comment Share on other sites More sharing options...
RichWebster Posted September 4, 2019 Share Posted September 4, 2019 You could attach a script to a quest alias set to the NPC, when you encounter them set a script variable (maybe in an OnActivate event) then using OnPlayerLoadGame just reset that variable. Link to comment Share on other sites More sharing options...
MongoMonk Posted September 4, 2019 Author Share Posted September 4, 2019 Thank you for the input! Is OnPlayerLoadGame called on game load for each NPC? Or just for the player? And ideally I would really like to avoid attaching a script to all NPCs. As I said I run a script which catches all NPCs anyway already (attached to the race record via a skyproc patcher). And I assume with script variable you just mean any variable I set in my script? How would it be specific to an NPC though? Link to comment Share on other sites More sharing options...
RichWebster Posted September 4, 2019 Share Posted September 4, 2019 There's a bunch of different ways you could go about it. One method is to use the Dynamically Attaching Scripts setup, which has a tutorial on the wiki. Storing the data could be done in an array perhaps, add NPCs to an array which is emptied with each fresh load. Link to comment Share on other sites More sharing options...
maxarturo Posted September 4, 2019 Share Posted September 4, 2019 (edited) As RichWebster said. " There's a bunch of different ways you could go about it " I read that you don't want to add a script to the npc directly, but this is just a rough idea : Put on that npc you want the player to detect a script that the npc will detect the player. int count EVENT OnInit() if ActorREF.getDistance(game.getPlayer()) < 1500 count = count + 1 If (count == 1) ; Do Stuff EndIf EndIf ENDEVENT Edited September 5, 2019 by maxarturo Link to comment Share on other sites More sharing options...
Recommended Posts