PDA

View Full Version : [KOTOR]Item Property Subtypes


jinger
05-26-2006, 02:05 PM
i need to equip an npc via script with items of the pc's inventory without ignoring the item's requirements (like restrictions on alignment/class/feat..). is there any way to get the subtype of an item prop? it's not quite enough using GetItemHasItemProperty

stoffe
05-26-2006, 03:23 PM
i need to equip an npc via script with items of the pc's inventory without ignoring the item's requirements (like restrictions on alignment/class/feat..). is there any way to get the subtype of an item prop? it's not quite enough using GetItemHasItemProperty

Unfortunately not. The functionality for manipulating item properties via script were added to the NWN version of NWScript after KotOR was released. You'll probably have to manually ensure they only have items they should be capable of using.

jinger
05-26-2006, 08:32 PM
:( mmm, still i could see if an ActionEquipItem fails, how would i do that, besides the obvious (to check the item slot after the attempt), is there not a better way?

jinger
05-27-2006, 02:15 PM
i have worked a lame something out :P this whole thing was for the rescue mission on the Leviathan, i mean you have to send someone to save your skin and you'd send him unarmed? no, you wouldn't.
void TakeWeapon();
void TakeBestClassItem();
void ReturnBadItems();

object oHold = GetObjectByTag("PlstcCrt");
object oPC = GetFirstPC();
object oItem,oBadItem;
int nSlot;
int nBase1=BASE_ITEM_SHORT_SWORD;
int nBase2=BASE_ITEM_LONG_SWORD;
int nBase3=BASE_ITEM_VIBRO_BLADE;
int nBase4=BASE_ITEM_VIBRO_SWORD;
int nBase5=BASE_ITEM_SHORT_LIGHTSABER;
int nBase6=BASE_ITEM_LIGHTSABER;

void main()
{
SetGlobalNumber("Lev_Escape",NPC_JUHANI);
nSlot=INVENTORY_SLOT_RIGHTWEAPON;
oBadItem=OBJECT_INVALID;
AssignCommand(GetObjectByTag("Juhani"),TakeWeapon());
}

void TakeWeapon()
{
oItem = GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON);
if(oItem!=OBJECT_INVALID)
{
ActionDoCommand(ActionUnequipItem(oItem));
ActionDoCommand(GiveItem(oItem,oPC));
}
oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON);
if(oItem!=OBJECT_INVALID)
{
int nBase = GetBaseItemType(oItem);
if( (nBase==nBase1) || (nBase==nBase2) || (nBase==nBase3) ||
(nBase==nBase4) || (nBase==nBase5) || (nBase==nBase6)
) return;
ActionDoCommand(ActionUnequipItem(oItem));
ActionDoCommand(GiveItem(oItem,oPC));
}
TakeBestClassItem();
}


void TakeBestClassItem()
{
if(GetItemInSlot(nSlot)!=OBJECT_INVALID)
{
AssignCommand(oHold,ReturnBadItems());
}
else
{
if(oBadItem!=OBJECT_INVALID)
{
ActionDoCommand(GiveItem(oBadItem,oHold));
oBadItem=OBJECT_INVALID;
}
if(nBase6)
{
oItem = GetFirstItemInInventory(oPC);
while((oItem!=OBJECT_INVALID)&&((GetPlotFlag(oItem)==TRUE)||(GetBaseItemType(oIte m)!=nBase6)))
{
oItem = GetNextItemInInventory(oPC);
}
if(oItem!=OBJECT_INVALID)
{
oBadItem=oItem;
ActionDoCommand(ActionTakeItem(oItem,oPC));
ActionDoCommand(ActionEquipItem(oItem,nSlot,TRUE)) ;
}
else
{
nBase6=nBase5; nBase5=nBase4; nBase4=nBase3;
nBase3=nBase2; nBase2=nBase1; nBase1=0;
}
ActionDoCommand(DelayCommand(0.6,TakeBestClassItem ()));
}

}
}



void ReturnBadItems()
{
oItem = GetFirstItemInInventory();
while(oItem!=OBJECT_INVALID)
{
GiveItem(oItem,oPC);
oItem = GetNextItemInInventory();
}
}you're on the ebon hawk when this happens so i got me a plasteel cylinder where you put everything the guy can't equip till he's got something in his hand, then you put the items back in the pc's inventory. still i really don't like this, you can't actually choose the equipment, i think i'll join the guy in the party, let the player choose the equipment, and go on with the show as soon as you talk to him, like on the Endar Spire.