Author Topic: Get Is Item Worn?  (Read 526 times)

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
Get Is Item Worn?
« on: August 07, 2010, 07:06:10 am »


               I need to know if someone has a function that can return if the ActivatedItemTarget()  of a tagbased item, is targeting an Item the PC is wearing...

Thanks for the help...

I get an error when I try to get the object type of the activated target, anyone know why or how to get the type of the target?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Get Is Item Worn?
« Reply #1 on: August 07, 2010, 09:51:14 am »


               LINK - look for int GetSlotByItem, if this will return -1 player dont have item equipped.
               
               

               
            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
Get Is Item Worn?
« Reply #2 on: August 08, 2010, 12:24:05 pm »


               I don't see GetSlotByItem in your link...

could you post it here?

Also, how do you use -1?  (Is this correct? if(nInt == -1)  ?

What about the error I was getting, did you read about that?
               
               

               


                     Modifié par Genisys, 08 août 2010 - 11:26 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Get Is Item Worn?
« Reply #3 on: August 08, 2010, 01:10:22 pm »


               

int GetSlotByItem(object oItem, object oCreature=OBJECT_SELF)
{
int nTh;
 for(;nTh < NUM_INVENTORY_SLOTS;nTh++)
 {
 object oitem = GetItemInSlot(nTh,oCreature);
  if(oitem == oItem)
  {
  return nTh;
  }
 }
return -1;
}

example

 if(GetSlotByItem(oItem,oPC) < 0)//or == -1 like you wrote
 {
  //PC dont have item in any slot/worn
 }


next time, try CTRL+F in your browser '<img'>
               
               

               


                     Modifié par ShaDoOoW, 08 août 2010 - 12:11 .
                     
                  


            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
Get Is Item Worn?
« Reply #4 on: August 09, 2010, 12:31:40 pm »


               tanks a lot XD