Jump to content

[LE] Check whether actor was encountered before in the same session [Papyrus][Skyrim]


MongoMonk

Recommended Posts

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

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

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

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 by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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