PDA

View Full Version : Changing Treasure Drops Off Corpses


yihsiao
06-23-2009, 12:58 PM
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.

Thanks!

Demongo
06-23-2009, 01:16 PM
If you want to modify the item what an NPC(later corpse:xp:) has, you should edit the NPCs .utc file. There is a bitton called "Inventory" in the .utc file(you should edit it with KotorTool. Double click to bring up the editor). Click on it. You can see the list of items on the left side. Drag one item, and drop it into the Inventory. Make sure you check it is Droppable;)

DarthCyclopsRLZ
06-23-2009, 06:05 PM
Merely messing with the .utc file nly works for placeables with unique names. If you wanna change the items in specific lockers/boxes with generic names, edit the module files.

1. Make copies of all module .rim files. Anything from the Modules folder if you wanna play it really safe.
2. Get an ERF/RIM editor. ERFEdit will get the job done.
3. Extract all files from the module's .rim file. with the ERF/RIM editor.
4. Mod the inventory of any placeable to your heart's content with Kotor Tool or whatever utility.
5. Go back to the ERF/RIM editor. Make a new .rim file with all the module files from your modding directory.
6. Replace the files in the Modules folder of your KOTOR game. Voila.

Rinse and repeat for all modules you want to mod. Not as elegant as scripting, but at least it allows you to do something about the useless gear/rewards/whatever you'll find.

On a final note, I'd advise to mod .dlg files otherwise.

yihsiao
06-24-2009, 11:19 AM
Thanks for your input guys. That does help with the non-random treasure drops.

There's also a random treasure generator that drops random treasure like grenades, credits, etc. Do you know where I can edit this to generate a more appropriate reward for my mod?

Seeing how this is very similar to modding Baldur's Gate 2 (another Bioware game) and BG2 .2DAs allowed you to edit random treasure drops, I have a gut feeling there is a data file/script I'm overlooking.

Demongo
06-24-2009, 11:27 AM
I'm not sure of it, but I think that the "random item generator" is some kind of built-in feature. It usually generates some credits,grenades or some simple stuff.

TheSpartanJedi
06-24-2009, 11:50 AM
I'm following DarthCyclops's instructions, but I can't find where to open the UTC files I extraced with KOTOR. Also, I'm not sure on which RIM to extract. For example, if I'm trying to edit drops from the Sith Commandos on Telos during the attack, do I extract 220TEL.rim or 220TEL_s.rim?

R2-X2
06-24-2009, 11:54 AM
220TEL_s.rim. The _s.rim file has all the GFF files (utc/uti/utp...)in it.

TheSpartanJedi
06-24-2009, 11:56 AM
220TEL_s.rim. The _s.rim file has all the GFF files (utc/uti/utp...)in it.

That's what I thought, thanks. I also found out how to open the files with KOTOR Tool (File>Open GFF Files...)

stoffe
06-24-2009, 01:01 PM
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.

Thanks!

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:

k_plc_tresciv.nss
k_plc_trescorhig.nss
k_plc_trescorlow.nss
k_plc_trescormid.nss
k_plc_tresdrdhig.nss
k_plc_tresdrdlow.nss
k_plc_tresdrdmid.nss
k_plc_tresmilhig.nss
k_plc_tresmillow.nss
k_plc_tresmilmid.nss
k_plc_tresrakat.nss
k_plc_tresshahig.nss
k_plc_tresshalow.nss
k_plc_tresshamid.nss
k_plc_tressndppl.nss

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.

k_amb_prey_spawn.nss
k_def_ambient.nss
k_def_ambmob.nss
k_def_bandspn.nss
k_def_calospn.nss
k_def_grenspn.nss
k_def_repairsp.nss
k_def_spawn01.nss
k_hen_candspwn.nss
k_hen_spawn01.nss
k_hjol_spawn01.nss
k_pdan_iriaz_sp.nss
k_pdan_kath03.nss
k_pdan_mand52.nss
k_pdan_stand02.nss
k_pkas_freyyspwn.nss
k_pkas_heart_on.nss
k_pman_amb_9.nss
k_pman_beast_9.nss
k_pman_shield_9.nss
k_ptat_amb1.nss
k_ptat_gizkaspwn.nss
k_swg_xor_def.nss