REO-EE/_module/nss/adv_mod_equip.nss
Jaysyn904 f82740bbbd Initial commit
Initial commit
2024-02-22 13:22:03 -05:00

31 lines
852 B
Plaintext

// Created by Zunath
#include "x2_inc_switches"
#include "adv_include"
void main()
{
// Does not fire if debug mode is on, or if the item was not equipped
if(GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_EQUIP || GetLocalInt(GetModule(), "DEBUG") == 1) return;
object oPC = GetPCItemLastEquippedBy();
if(!GetIsPC(oPC) || GetIsDM(oPC)) return;
object oItem = GetPCItemLastEquipped();
string sResref = GetResRef(oItem);
string sName = GetName(oItem);
// Prevents PC properties item from not being equipped
if(sName == "PC Properties" || !GetIsObjectValid(oItem)){return;}
int iCanWear = ADV_CanItemBeEquipped(oPC, oItem);
// Can't wear the item, unequip it.
if(iCanWear == FALSE)
{
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionUnequipItem(oItem));
}
}