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
In Kotor Tool look under Scripts....there is generic script a_take_item that you could attach to your dialog.
I now have this but I am getting an error for the first paramater of the ActionTakeItem command.
void main()
{
ActionTakeItem( "black_market_pad", GetFirstPC());
}
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.
It now compiles but doesn't remove the item. I was thinking of using the built in script but can't find the parameters boxes. I am using DLGEditor.
Thanks again
Try this tutorial...explains it pretty well with pictures...good luck
http://www.lucasforums.com/showthread.php?t=195438&highlight=parameters)
void main()
{
object oItem = GetObjectByTag("black_market_pad");
DestroyObject(oItem, GetFirstPC());
}
How about this?
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.