Aller au contenu

Photo

Item Name Search Request


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Ryuhi2000

Ryuhi2000
  • Members
  • 97 messages
I need a script  to search for "Vere Umbra" in item names from items on the targeted player in their main inventory and in bag inventory.

if they have items with "Vere Umbra" in their name  in their inventory  destroy the items with "Vere Umbra"

#2
Kato -

Kato -
  • Members
  • 392 messages
Since I don't know from where the script is called but you mention a targeted player, it would be:

#include "x2_inc_switches"
void main()
{
    if(GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
    object oPC = GetItemActivatedTarget();
    if(!GetIsPC(oPC)) return;
    object oItem = GetFirstItemInInventory(oPC); 
    while(GetIsObjectValid(oItem))
    { 
          if(FindSubString(GetName(oItem), "Vere Umbra") > -1)  DestroyObject(oItem);
          oItem = GetNextItemInInventory(oPC);
    }  
}

Then you would give this script the same name as the activated item's tag, to use the tag-based system. Don't forget that your item must have the property Cast Spell: Unique Power on it, so that you can "use" it on your targets.


Kato

Modifié par Kato_Yang, 22 juin 2011 - 07:24 .


#3
Ryuhi2000

Ryuhi2000
  • Members
  • 97 messages
tyvm Kato i should have specified it was supposed to be a Unique Power Script but i thought it would be a given with the way i explained the target :)