Skip to content

Tag Based Scripting - Add Bonus Feat to player?

Able to add effects just fine, but how can we add a feat, FEAT_WEAPON_PROFICIENCY_MARTIAL for example to the OnAquire aspect of a Tag Based Script? Or does it have to be gear based only (or player skin?

Comments

  • TerrorbleTerrorble Member Posts: 179
    Pretty sure you can add it to the player skin this way when they acquire the item in the OnAcquire script:
    itemproperty ipWPM = ItemPropertyBonusFeat(IP_CONST_FEAT_WEAPON_PROF_MARTIAL);
    
    //Get the skin object... however you get the skin object.
    object oSkin = SKIN_SupportGetSkin(GetModuleItemAcquiredBy());
    
    AddItemProperty(DURATION_TYPE_PERMANENT,ipWPM,oSkin);
    
  • BuddywarriorBuddywarrior Member Posts: 62
    Ok, I think I have it, In case anyone else needs this.
    #include "x2_inc_itemprop"
    
    
    void OnAcquire(object oEventItem, object oAcquiredBy, object oTakenFrom, int nStackSize)
    {
        object oItem;
        itemproperty ipAdd;
        object oPC = oAcquiredBy;
    
        // Only fire for PCs.
        if ( !GetIsPC(oPC) )
            return;
    
        // Alter the skin item equipped by the PC.
        oItem = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);
        ipAdd = ItemPropertyBonusFeat(IP_CONST_FEAT_WEAPON_PROF_MARTIAL);
        IPSafeAddItemProperty(oItem, ipAdd);
    }
    
Sign In or Register to comment.