Osiris/API/GenerateItems

From Divinity Engine Wiki
Jump to: navigation, search
Full Definition(s)
  • call GenerateItems((CHARACTERGUID)_Player, (CHARACTERGUID)_Trader)
Description

First throws a TradeGenerationStarted event. Next, existing trade treasure in _Trader's inventory is removed (see that call for details). Then new trade treasure gets generated using the level of _Player and potentially based on the game's current difficulty level. These generated items are immediately added to the trader's inventory and are identified. If a custom trade treasure table is set for the trader, this one is used, otherwise the default one(s) set for the trader character in the sidebar is/are used. If the used trade treasure table(s) is invalid/does not exist, no new items get generated. Finally, a TradeGenerationEnded event is thrown.

Notes
  • When a character dies, only the five most expensive items from its inventory are kept, in addition to story items. The rest is discarded by code. This discarding happens right before the CharacterDying event.
  • The equivalent call for items is GenerateTreasure.
See Also