Author Topic: ItemProperty restriction  (Read 356 times)

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
ItemProperty restriction
« on: June 20, 2012, 11:12:34 pm »


               So... I have something like this:


void SetRune(itemproperty ipProperty)
{

object oPC      = GetItemActivator();
object oActiv   = GetItemActivated();
object oTarget  = GetItemActivatedTarget();
string sDesc    = GetDescription(oTarget);
int nFreeSlot   = GetLocalInt(oTarget, "RUNESLOT");
int nWeaponOnly = GetLocalInt(oActiv, "WEAPON_ONLY_RUNE");
int nGetStack   = GetItemStackSize(oActiv);

    if(nWeaponOnly == 1 && (IPGetIsRangedWeapon(oTarget) || IPGetIsMeleeWeapon(oTarget)) == FALSE)
        SendMessageToPC(oPC, "This rune can be aplied only on weapon");
    else
        {
        if(nFreeSlot > 0)
            {
            AddItemProperty(DURATION_TYPE_PERMANENT, ipProperty, oTarget);
            SetDescription(oTarget, sDesc + "\\n" + GetName(oActiv));
            SetLocalInt(oTarget, "RUNESLOT", nFreeSlot-1);

            if(nGetStack == 1)
                DestroyObject(oActiv);
            else
                SetItemStackSize(oActiv, nGetStack-1);
            }
        else
            SendMessageToPC(oPC, "This item has no free rune slot");
        }
}

How to modify it to restrict the possibility of adding the same rune again?
I tried to set on rune var: RUNE_TYPE string TIER_1_RUNE_1, but if I set other rune on the item (TIER_1_RUNE_2), I can set up first again ':huh:'
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
ItemProperty restriction
« Reply #1 on: June 20, 2012, 11:18:15 pm »


               look in the bioware include x2_inc_itemprop at the function IPSafeAddItemProperty
               
               

               
            

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
ItemProperty restriction
« Reply #2 on: June 21, 2012, 12:18:43 am »


               LOL!
Not exactly as you say, but I forget about IPGetItemHasProperty haha
Thanks :-D