Originally Posted by SniperHF
Since this seems more about traders now :P, maybe you guys know the answer to this one:

So if vendors refresh based on time, do random NPCs as well? If Random NPCs do not refresh based on time, what differentiates the vendors so that they refresh (via Osiris I assume).

It's mostly about our paranioa with running out of handles ;-)

So ..... one could ask, are there really random NPCs ? Are there really traders ?

My answer would be no, the 'traders' only have much bigger treasure tables, that makes them different, they react differently to theft (because Osiris tells them to) and they claim item ownership in a certain area (also because Osiris tells them so).
Otherwise they are not different at all from the 'randoms', so yes, the randoms have exactly the same treasure generation.

The random NPCs don't matter that much though because usually they use very small treasure tables like 'GenericNpc' and there have to be very many treasure creations to really matter. From what I've heard, enemy mobs still allow save scumming, so they must be exempt from normal treasure pre-creation.
(I don't know how gold is handled, but gold uses a root template too, but that must be an implicit one, because we don't see it anywhere in Equipment.txt. I have absolutely no idea, where that comes from but I know that I can remove all my gold with a CharacterAddGold( -Amount ) and but I can also remove it by moving the handle of it's root template somewhere else. I can add gold with CharacterAddGold() but I can also add gold with ItemTemplateAddToCharacter( "LOOT_Gold_A_Big_A_.....whatever", _Char, _Amount ), so gold is an absolute enigma to me ;-)

As mentioned, I'm not sure if pre-creation works for trade treasure generation too or if it is only done for real containers. My guess is, that trade treasure is also pre-created.

The two code pieces in _Trade.txt that check if treasure should be generated are

Code
PROC
  GenTradeItems((CHARACTER)_Player,(CHARACTER)_Trader)
  AND
  DB_TraderGeneratedTreasureForLevel(_Trader,_OldLevel)
  AND
  CharacterGetLevel(_Player,_NewLevel)
  AND
  _NewLevel > _OldLevel
THEN
  NOT DB_TraderGeneratedTreasureForLevel(_Trader,_OldLevel);
  DB_TraderGeneratedTreasureForLevel(_Trader,_NewLevel);
  DoGenTradeItems(_Player,_Trader);


for the 'levelup' recreation and

Code
PROC	
  GenTradeItems((CHARACTER)_Player,(CHARACTER)_Trader) 
  AND 
  NOT _Trader.DoesNotWantToTrade() 
  AND
  LastTradeItemGeneration(_Trader,(INTEGER)_THLastGen) 
  AND 
  _THLastGen != 0 
  AND		// check if last generation was long enough ago:
  Time(_,_,_TH) 
  AND
  IntegerSubtract(_TH,_THLastGen,_Delta) 
  AND
  _Delta >= 12
THEN	
  DoGenTradeItems(_Player,_Trader);


for the 'after 1 hour' creation

I cannot find anything in the code that suggests that traders are handled in any way different. They are only normal NPCs after all.