object oItem;
/* Script generated by
Lilac Soul's NWN Script Generator, v. 2.3
For download info, please visit:
http://nwvault.ign.com/View.php?view=Other...&id=4683&id=625 */
void main()
{
object oPC;
if (!GetIsPC(GetItemActivatedTarget())
){
SendMessageToPC(GetItemActivator(), "Thats not a PC!");
return;}
if (GetItemPossessedBy(oPC, "kovkey")== OBJECT_INVALID)
{
oPC = GetItemActivatedTarget();
CreateItemOnObject("kovkey", oPC);
oPC = GetItemActivator();
FloatingTextStringOnCreature("You have been given the KoV Members and Guests Key! You have tempory access to some of the members only restricted areas of the mod!", oPC);
}
else if (GetItemPossessedBy(oPC, "kovkey")!= OBJECT_INVALID)
{
oPC = GetItemActivatedTarget();
oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem)=="kovkey") DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC);
}
oPC = GetItemActivator();
FloatingTextStringOnCreature("The KoV Members and Guests Key has been removed! You no longer have access to the restricted areas of the mod!", oPC);
}
}
Ok stumped at why this script is not working. It compiles properly. It does half it should and then fails me.
Ok the script is a unique power script, based on a tool that targets PC's, when it targets a PC the script is supposed to see if the PC has an item by the tag "kovkey"; if it does not have it, its supposed to add it onto the PC and send the message thats shown above.
It does all that fine.
The problem im having is, when the PC targeted has the item "kovkey" or any number of those items. Its supposed to delete them from his/her inventory and then state the message above.
It does not do that, what it does is each time i target myself for instance, (and i have the item from the mod load up) is just add the item, then it states the first message above.
Any help would be appreciated.