Author Topic: Item Name Search Request  (Read 509 times)

Legacy_Ryuhi2000

  • Full Member
  • ***
  • Posts: 159
  • Karma: +0/-0
Item Name Search Request
« on: June 22, 2011, 04:33:34 am »


               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"
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Item Name Search Request
« Reply #1 on: June 22, 2011, 05:40:24 am »


               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 .
                     
                  


            

Legacy_Ryuhi2000

  • Full Member
  • ***
  • Posts: 159
  • Karma: +0/-0
Item Name Search Request
« Reply #2 on: June 22, 2011, 01:14:40 pm »


               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 '<img'>