When a player starts a module for the first time, how is their initial inventory set? Like, you tend to start with a few healing potions, a torch, maybe some armor, maybe a weapon… Is that hard-coded into the game, or is there a script that populates it? Relatedly, is OnModuleLoad called whenever the player starts a new game, or is it also called whenever a saved game is loaded? If OnModuleLoad is invoked on loading a saved game, is there an event that triggers only when a module is started for the first time?
I imagine, if OnModuleLoad is called every time, then you need to use variables to flag whether a PC is spawning for the first time ever.
They come in with what they have. If creating a new character, they get what the package 2da for their class says they get (and that can be literally anything, minor headache mp).
On module load does fire for when the game is loaded from save, and variables are a good thing to deal with whether you want to know if it’s the first time their character is in module.
Makes sense. I guess this still means that you could empty their inventory when they spawn in, if you wanted to do away with that headache. I mean, doesn’t Hordes of the Underdark do that?
It’s also useful to tell area and trigger entry scripts that we are loading a saved game, so that they don’t fire unnecessarily. The “Reload” switch should be deleted at the end of area entry (trigger scripts fire first). OnClientEnter needs something like this:
Thanks a bunch. Your code reminded me that I need to set the player’s starting gold, but is there a reason you have a loop to take gold in 50k increments? Like does TakeGoldFromCreature get dodgy if you use an unboundedly high parameter?