//::///////////////////////////////////////////////
//:: Name: returnweapon
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*This script is supposed to simulate returning throwing weapons by keeping a
constant stack of 1.
*/
//:://////////////////////////////////////////////
//:: Created By: Robert the Bard
//:: Created On: 05, March, 2007
//:://////////////////////////////////////////////
#include "x2_inc_switches"
void main()
{
object oReturn = GetPCItemLastUnequipped();
object oPC = GetPCItemLastUnequippedBy();
int nStack = (GetItemStackSize(oReturn));
if (GetBaseItemType(oReturn)== BASE_ITEM_DART || BASE_ITEM_THROWINGAXE)
GetTag(oReturn);
{
if (GetTag(oReturn)!="returnweapon")
return;
else (GetNumStackedItems(oReturn));
if (nStack ==2)
CreateItemOnObject("returnweapon", oPC, 1);
}
}
This is a compiled script, but it doesn't function correctly. If you unequip the weapon with 1 or 2 in the right hand slot, it will create another. However, trying to run it on equip froze up my test server. I have tried to run it off of OnEquip, OnUnequip, and OnInventoryDisturb, but it won't do what I'm looking to do. Perhaps somebody can see a flaw in my logic, which seems to have snuck past the compiler...
|