FunkySwerve wrote...
Here's the rundown, so far as I know it, from having dealt with this extensively back when I used letoscript. You can Get, but NOT Set or Delete, variables on a pc during onclientexit. The PC object is already invalid by the time onclientexit fires. Most data will need to be set on the pc in local form beforehand, and retrieved from those locals, rather than retrieved with the standard command. This is true, for example, for PCPlayername. I'm frankly surprised you were able to do a GetName.
As far as using a LocalObject to Set vars on them when they're gone, you can't. The object local is just a pointer to an object, but that object is at that point invalid.
You want a database, or array, as Shad suggested, to track players. If you use a database, you COULD set vars on them when they were offline, and load to locals, deleting the database entries if desired, when they log in again. The array, by contrast, would lose the data when the mod is reset, assuming you're storing it somewhere in the module, or on the module object. I'm happy to elaborate, if you like.
Funky
Thanks for the rundown, Funky. I had discovered as much with the test scripts I had posted.
I am using a "DATABASE" so to speak for this in my test. I set values using a unique PC ID that I create for each PC when they log in. So all values in the database (in this case they are local vars on the mod) are preceded by the ID.
However I wanted to know if I could still use the PC Object after the player had logged out because I am using a modified bioware db (NBDE), and values can be set according to PC object. But since as you knew and I have verified for myself, the PC object is invalid after player logout and so this does not work.
The trick is that I am tracking player data when a PC is logged out. I need to track this data in locals so that a PC who tries to log in and out a few times instantly has the right data associated with their character: Also... this data needs to be stored to a database so that it is waiting for a PC upon login after reset. It is essentially a temporary buffer of data to be stored while a PC is in an uncontrolled werewolf state. I will essentially have a separate werewolf database, that tracks werewolf state (active/inactive), position and hitpoints. And set a flag to the character database (a unique table just for character data) for any PC at the moment they become active werewolves. If this werewolf flag is TRUE upon log in, it will mean that they logged out before the werewolf was done, and so I will check the PC versus the werewolf database (basically a werewolf table), and use that to update PC status rather than the older data in the character database.
And yes, I know NWNX would make all of this easier, but I am not interested in using NWNX for these modules, because I plan on posting them to the vault for anyone to use without the additional install of NWNX.