// NWNX Events for Linux allows us to bypass the animation that plays when you use an item. // The trade off for this is that you have to rework the way items are used. This script // handles all variations of item properties that may be used. If the item doesn't fall // into one of these categories then the generic tag based scripting takes over. // // Created by Zunath on July 21, 2011 #include "nwnx_events" #include "gun_include" #include "rhs_include" void main() { object oPC = OBJECT_SELF; object oTarget = GetEventTarget(); object oItem = GetEventItem(); object oDatabase = GetItemPossessedBy(oPC, PC_DATABASE); string sTag = GetTag(oItem); int iEvent = GetEventType( ); int iSubtype = GetEventSubType(); // Change Ammo Priority Property int iAmmoPriority = IPGetItemHasProperty(oItem, ItemPropertyCastSpell(548, IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE), -1, FALSE); // Change Firing Mode Property int iChangeFiringMode = IPGetItemHasProperty(oItem, ItemPropertyCastSpell(546, IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE), -1, FALSE); // Combine Property int iCombine = IPGetItemHasProperty(oItem, ItemPropertyCastSpell(547, IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE), -1, FALSE); // Unique Power: Self Only Property int iActivateSelf = IPGetItemHasProperty(oItem, ItemPropertyCastSpell(335, IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE), -1, FALSE); // Toggle Radio Power Property int iRadioPower = IPGetItemHasProperty(oItem, ItemPropertyCastSpell(549, IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE), -1, FALSE); // Change Radio Channel Property int iRadioChannel = IPGetItemHasProperty(oItem, ItemPropertyCastSpell(550, IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE), -1, FALSE); // Use Lockpick Property int iLockpick = IPGetItemHasProperty(oItem, ItemPropertyCastSpell(551, IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE), -1, FALSE); string sChangeAmmoScript = "gun_changeammo"; string sChangeModeScript = "gun_changemode"; string sCombineScript = "reo_combine"; string sRadioTogglePowerScript = "radio_toggpower"; string sRadioChangeChannelScript = "radio_changechan"; string sUseLockpickScript = "item_lockpick"; int bBypassEvent = TRUE; // Firearms - Ammo Priority (0), Change Firing Mode (1), Combine (2) if(iAmmoPriority && iCombine && iChangeFiringMode) { if(iSubtype == 0) { ExecuteScript(sChangeAmmoScript, oPC); } else if(iSubtype == 1) { ExecuteScript(sChangeModeScript, oPC); } else if(iSubtype == 2) { ExecuteScript(sCombineScript, oPC); } } // Firearms - Ammo Priority (0), Change Firing Mode (1) else if(iAmmoPriority && iChangeFiringMode) { if(iSubtype == 0) { ExecuteScript(sChangeAmmoScript, oPC); } else if(iSubtype == 1) { ExecuteScript(sChangeModeScript, oPC); } } // Firearms - Ammo Priority (0), Combine (1) else if(iAmmoPriority && iCombine) { if(iSubtype == 0) { ExecuteScript(sChangeAmmoScript, oPC); } else if(iSubtype == 1) { ExecuteScript(sCombineScript, oPC); } } // Firearms - Ammo Priority (0) else if(iAmmoPriority) { if(iSubtype == 0) { ExecuteScript(sChangeAmmoScript, oPC); } } // Unique Power Self Only and Combine else if(iCombine && iActivateSelf) { // Combine if(iSubtype == 0) { ExecuteScript(sCombineScript, oPC); } else if(iSubtype == 1) { bBypassEvent = FALSE; } } // Combine (0) else if(iCombine) { if(iSubtype == 0) { ExecuteScript(sCombineScript, oPC); } } // Change Radio Channel (0) and Toggle Radio Power (1) else if(iRadioPower && iRadioChannel) { bBypassEvent = TRUE; // Change Radio Channel if(iSubtype == 0) { ExecuteScript(sRadioChangeChannelScript, oPC); } // Toggle Radio Power else if(iSubtype == 1) { ExecuteScript(sRadioTogglePowerScript, oPC); } } // Use Lockpick (0) else if(iLockpick) { bBypassEvent = TRUE; ExecuteScript(sUseLockpickScript, oPC); } // All of the updated items. These will all bypass the Use Item animation. else if(sTag == PC_DATABASE || sTag == RHS_FURNITURE_TOOL_RESREF) { ExecuteScript(sTag, OBJECT_SELF); bBypassEvent = TRUE; } // Fire tag based scripting in all other cases (I.E: Don't bypass this event) // Allows for backwards compatibility until we convert other systems over to Linux else { bBypassEvent = FALSE; } // The entirety of the OnActivateItem will be skipped if bBypassEvent is true. if(bBypassEvent) { BypassEvent(); } }