Jump to content

Home

Items drop [KotOR]


Salk

Recommended Posts

Hello!

 

Can someone shed some light about how the game handles items drop? I guess there is a randomization for some NPCs while some others that carry unique / plot items always drop them.

 

How does it work?

 

Thanks!

Link to comment
Share on other sites

Hello!

 

Can someone shed some light about how the game handles items drop? I guess there is a randomization for some NPCs while some others that carry unique / plot items always drop them.

 

How does it work?

 

Thanks!

 

I'll try not to overload you with info...:)

 

First off, the NPCs that always drop the same items. That's because they have those in their inventory in their .utc file. Auto-drop on death...

 

Okay, the game drops treasure in two ways:

 

1. Using k_inc_drop to determine random loot for creatures.

 

2. Using k_inc_treasure to determine random loot for containers.

 

Random Loot For Creatures:

In the OnSpawn event for creatures, they call a function that generates their random loot. That function calls functions from k_inc_drop, and is passed the level of the creature. This level is in the .utc, but is modified by the game's level-scaling.

 

Now in k_inc_drop...

The game has an assorted list of items that it classifies into 3 level zones. K_inc_drop has these levels at 5, 10, and 15, and refers to them at DR_LOW_LEVEL, DR_MEDIUM_LEVEL, and DR_HIGH_LEVEL.

 

If the creature's level is under or equal to 5, they normally get small stuff like

 

  • Repair Kits
  • Frag grenades
  • Med Packs
  • and stacks of 5,10, or 25 credits

 

***WARNING***This applies to all categories

I say normally because the way the functions are called, the creature will always get the treasure of their level, but there's a random chance that they will get a second copy of their treasure function called, and another random chance that they will get the function for the next higher level-category called.

***WARNING***

 

If the creature's level is under or equal to 10 and greater than 5, they normally get small stuff like

  • Advanced Repair Kit
  • 50 credits
  • Advanced Med Pack
  • Battle Stimulant
  • Adrenal Stamina
  • Adrenal Alacrity
  • Adrenal Strength
  • Stun Grenade
  • Frag Grenade
  • Poison Grenade
  • Sonic Grenade
  • Adhesive Grenade
  • Cryo Grenade
  • and Ion Grenade

 

If the creature's level is under or equal to 15, but greater than 10, they still get the Midlevel items, but have a chance to get high level items.

 

If the creature's level is greater than 15, they will usually get stuff like

  • Super Repair Kit
  • Life Pack
  • Thermal Detonator
  • Speed Stim
  • Hyper versions of the Stimulants from Mid levels
  • All of the grenades from Mid-levels
  • Plasma Grenade
  • Random credits between 50 and 99

 

The relevant code for this is:

Show spoiler
(hidden content - requires Javascript to show)
void DR_CreateRandomTreasure(object oTarget = OBJECT_SELF)
{
   int nLevel = GetHitDice(oTarget);
   if (nLevel > DR_HIGH_LEVEL)
   {
       DR_CreateHighTreasure();
       if(Random(2) == 0)
       {
           DR_CreateHighTreasure();
       }
       if(Random(2) == 0)
       {
           DR_CreateMidTreasure();
       }
   }
   else if (nLevel <= DR_HIGH_LEVEL && nLevel > DR_MEDIUM_LEVEL)
   {
       DR_CreateMidTreasure();
       if(Random(3) == 0)
       {
           DR_CreateHighTreasure();
       }
       if(Random(2) == 0)
       {
           DR_CreateMidTreasure();
       }
   }
   else if (nLevel <= DR_MEDIUM_LEVEL && nLevel > DR_LOW_LEVEL)
   {
       DR_CreateMidTreasure();
       if(Random(2) == 0)
       {
           DR_CreateLowTreasure();
       }
   }
   else
   {
       DR_CreateLowTreasure();
       if(Random(3) == 0)
       {
           DR_CreateLowTreasure();
       }
       if(Random(4) == 0)
       {
           DR_CreateMidTreasure();
       }
   }
}

// creates a low level treasure: med pack/repair, frag grenade, credits
void DR_CreateLowTreasure()
{
  //AurPostString("dropping low",5,6,5.0);
   string sTemplate;
   int nStack = 1;
   int nRandom = Random(6);
   switch(nRandom)
   {
       case 0: sTemplate = "g_i_drdrepeqp001";  //repair kit
       break;

       case 1:
           sTemplate = "g_i_credits001";// 5 stack
           nStack = 5;
           DR_CreateFillerCredits();
       break;

       case 2:
           sTemplate = "g_i_credits002";  //10 stack
           nStack = 10;
           DR_CreateFillerCredits();
       break;

       case 3:
           sTemplate = "g_i_credits003";  // 25 stack
           nStack = 25;
           DR_CreateFillerCredits();
       break;

       case 4: sTemplate = "g_i_medeqpmnt01";// med kit
       break;

       case 5: sTemplate = "g_w_fraggren01"; // frag grenade
       break;
   }

   CreateItemOnObject(sTemplate,OBJECT_SELF,nStack);
}

// creates midlevel treasure: adv-med/repair, any gredade, stims, credits
void DR_CreateMidTreasure()
{
   string sTemplate;
   int nStack = 1;
   int nRandom = Random(15);
   switch (nRandom)
   {
       case 0: sTemplate = "g_i_drdrepeqp002";  //advanced repair kit
       break;

       case 1:
           sTemplate = "g_i_credits004";  // 50 stack
           nStack = 50;
           DR_CreateFillerCredits();
       break;

       case 2: sTemplate = "g_i_medeqpmnt02"; //advanced med pack
       break;

       case 3: sTemplate = "g_i_cmbtshot001"; //battle stimulant
       break;

       case 4: sTemplate = "g_i_adrnaline003";  //adrenal stamina
       break;

       case 5: sTemplate = "g_i_adrnaline002"; // adrenal alacrity
       break;

       case 6: sTemplate = "g_i_adrnaline001"; // adrenal strength
       break;

       case 7:
           sTemplate = "g_w_stungren01";  // stun grenade
           nStack = 2;
       break;

       case 8:
           sTemplate = "g_w_fraggren01";  // fragmentation grenade
           nStack = 2;
       break;

       case 9: sTemplate = "g_w_poisngren01"; // poison gredade
       break;

       case 10: sTemplate = "g_w_sonicgren01"; // sonic grenade
       break;

       case 11: sTemplate = "g_w_adhsvgren001"; // adhesive grenade
       break;

       case 12: sTemplate = "g_w_cryobgren001";// cryo grenade
       break;

       case 13: sTemplate = "g_w_iongren01";// ion grenade
       break;
   }
   CreateItemOnObject(sTemplate,OBJECT_SELF,nStack);
}

// creates high treasure: adv stims, grenades, ultra med/repair, credits
void DR_CreateHighTreasure()
{
   string sTemplate;
   int nStack = 1;
   int nRandom = Random(16);
   switch (nRandom)
   {
       case 0: sTemplate = "g_i_drdrepeqp003";  //super repair kit
       break;

       case 1: sTemplate = "g_w_thermldet01"; //Thermal detinator
       break;

       case 2: sTemplate = "g_i_medeqpmnt03"; //life pack
       break;

       case 3: sTemplate = "g_i_cmbtshot003";//speed stim
       break;

       case 4: sTemplate = "g_i_cmbtshot002"; //hyper battle stim
       break;

       case 5: sTemplate = "g_i_adrnaline006"; //huper adrenal stamina
       break;

       case 6: sTemplate = "g_i_adrnaline005"; //hyper adrenal alacrity
       break;

       case 7: sTemplate = "g_i_adrnaline004";// hyper adrenal strength
       break;

       case 8:
       sTemplate = "g_w_poisngren01"; // poison gredade
       nStack = 2;
       break;

       case 9:
       sTemplate = "g_w_sonicgren01"; // sonic grenade
       nStack = 2;
       break;

       case 10:
       sTemplate = "g_w_adhsvgren001"; // adhesive grenade
       nStack = 2;
       break;

       case 11:
       sTemplate = "g_w_cryobgren001";// cryo grenade
       nStack = 2;
       break;

       case 12:
       sTemplate = "g_w_firegren001";// plasma grenade
       nStack = 2;
       break;

       case 13:
       sTemplate = "g_w_iongren01";// ion grenade
       nStack = 2;
       break;

       case 14:
       sTemplate = "g_i_credits015";
       nStack = Random(50) + 50;
       break;

       case 15: sTemplate = "g_w_firegren001";// plasma grenade
       break;

   }
   CreateItemOnObject(sTemplate,OBJECT_SELF,nStack);
}

 

Due to the length of the post, I won't post the way for containers unless you want me to, okay? Sorry about the length...:comp9:

Link to comment
Share on other sites

Thank you very much for your help, Fair Strides 2!

 

I was especially interested in the item drop for Ajunta Pall because I am working on revising his quest a little due to, in my opinion, rather bad inconsistent choices made by the developers.

 

I had tried to do this by setting the droppable flag to 0 using Kotor Tool but it did not work.

 

Any suggestions?

Link to comment
Share on other sites

Thank you very much for your help, Fair Strides 2!

 

I was especially interested in the item drop for Ajunta Pall because I am working on revising his quest a little due to, in my opinion, rather bad inconsistent choices made by the developers.

 

I had tried to do this by setting the droppable flag to 0 using Kotor Tool but it did not work.

 

Any suggestions?

 

Could you PM me the details of what you're trying to do? I'll be able to help more that way.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...