Jump to content

Home

Taking items from a Character.


TimBob12

Recommended Posts

Hi there,

It's me again with more modding problems. I never really realised how powerful scripting was but now I'm stuck. I know how to give a character an item but I can't for the life of me find how to take an item from a character. I am using a datapad system to check whether dialog responses should be there and I want to take a datapad.

 

I would be extremely grateful to anyone that helps.

 

Thanks in advance

 

TimBob12

Link to comment
Share on other sites

I'm not a good scripting person either, but looking at this command actiontakeitem I think maybe it should be like this

 

void main() {

object oItem = GetObjectByTag("black_market_pad");

object oTake = GetFirstPC();

ActionTakeItem(oItem, oTake);

}

 

Try that I'm not sure if it will compile

 

The a_take_item script from kotortool looks like this:

 

// a_take_item
// Parameter Count: 2
// Param1 - The quantity of the item to take from the player.
// Param2 - item's tag (as a string)
// This script takes the quantity of the item designated
// in the parameter from the player.
//
// KDS, 07/23/04
void main() {

   int nQuantity = GetScriptParameter( 1 );
   int i;
   string sItem = GetScriptStringParameter();

if(nQuantity == 0) nQuantity = 1;

   object oItem = GetItemPossessedBy (GetPartyLeader(),sItem);
   if (GetIsObjectValid(oItem))
   {
       int nStackSize = GetItemStackSize(oItem);
       if(nQuantity < nStackSize)
       {
           nQuantity = nStackSize - nQuantity;
           SetItemStackSize(oItem, nQuantity);
       }
       else if(nQuantity > nStackSize || nQuantity == nStackSize)
       {
           DestroyObject(oItem);
       }
   }
}

 

Where if you are using a dialog editor you just put the script name on the script line and use the parameter boxes to fill in your specifics.

Link to comment
Share on other sites

Newbiemodder: Thanks but just realised that's for TSL only. That arrives in the post next week. Im modding KOTOR.

 

deathdisco: It compiles with a parameter 2 mismatch error.

 

Hmmm. I'll have a think today.

 

Edit: Hey thanks guys but just found that it was a simple typo in the dialogue. Thanks again for helping me with the scripts.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...