Originally Posted by yihsiao
Is there a way to change how treasure drops work in KOTOR1?
I know many of the rewards like credits and other mundane items are randomly generated off kills and I wanted to see if there was a way I could modify them with other items or remove them entirely with the KOTOR Tool or another modding utility.
Random loot is handled via scripts. For loot dropped from containers the main logic is in the k_inc_treasure.nss
include file. For changes to that file to take effect however you need to recompile the scripts that use it. The standard ones are:
Random loot dropped by creatures has the main logic in the k_inc_drop.nss
include file. This file contains the function DR_SpawnCreatureTreasure()
, which is called inside the standard AI function GN_SetListeningPatterns()
(found in the k_inc_generic
include file). This function in turn is called by the OnSpawn
event script for creatures, and as such is run when they're loaded into the game world.
Thus, to make changes to the creature loot you'd need to recompile any OnSpawn event scripts that call this function. If you want the change to take effect globally you'd need to recompile them all. If you only want to affect a certain creature it's enough to check what OnSpawn script it uses and recompile that one. If it's a creature in a mod you're making you could give it a custom OnSpawn script for it.