2025/11/30 Update

Updated module to NWN:EE v37-17
Updated NWNxEE libraries to latest.
Associated new PRC8 module script for the GUI event.
Deleted old prc_2da_cache creature from top hak as it's now unneeded.
Full compile.
This commit is contained in:
Jaysyn904
2025-11-30 22:04:26 -05:00
parent 243ed8a652
commit 8ca4aed814
1252 changed files with 19391 additions and 19766 deletions

View File

@@ -211,7 +211,7 @@ void main ()
//:: The creature's type changes to plant with the appropriate augmented subtype.
//:: Hit Dice: Change all current Hit Dice to d8s.
jNewCreature = JsonModifyRacialType(jBaseCreature, RACIAL_TYPE_PLANT);
jNewCreature = json_ModifyRacialType(jBaseCreature, RACIAL_TYPE_PLANT);
//:: Armor Class: A greenbound creature's natural armor bonus improves by 6 over that of the base creature.
jNewCreature = json_IncreaseBaseAC(jNewCreature, 6);

View File

@@ -21,426 +21,6 @@
#include "npc_template_inc"
#include "inc_debug"
#include "prc_inc_json"
//:: Get a random General feat.
void ApplyParagonBonusFeat(object oCreature, int iFeat);
//:: Adds Paragon SLA's to jCreature.
//::
json json_AddParagonPowers(json jCreature)
{
// Get the existing SpecAbilityList (if it exists)
json jSpecAbilityList = GffGetList(jCreature, "SpecAbilityList");
// Create the SpecAbilityList if it doesn't exist
if (jSpecAbilityList == JsonNull())
{
jSpecAbilityList = JsonArray();
}
//:: Greater Dispelling 3x / Day
int i;
for (i = 0; i < 3; i++)
{
json jSpecAbility = JsonObject();
jSpecAbility = GffAddWord(jSpecAbility, "Spell", 67);
jSpecAbility = GffAddByte(jSpecAbility, "SpellCasterLevel", 15);
jSpecAbility = GffAddByte(jSpecAbility, "SpellFlags", 1);
// Manually add to the array
jSpecAbilityList = JsonArrayInsert(jSpecAbilityList, jSpecAbility);
}
//:: Add Haste 3x / Day
for (i = 0; i < 3; i++)
{
json jSpecAbility = JsonObject();
jSpecAbility = GffAddWord(jSpecAbility, "Spell", 78);
jSpecAbility = GffAddByte(jSpecAbility, "SpellCasterLevel", 15);
jSpecAbility = GffAddByte(jSpecAbility, "SpellFlags", 1);
// Manually add to the array
jSpecAbilityList = JsonArrayInsert(jSpecAbilityList, jSpecAbility);
}
//:: See Invisiblity 3x / Day
for (i = 0; i < 3; i++)
{
json jSpecAbility = JsonObject();
jSpecAbility = GffAddWord(jSpecAbility, "Spell", 157);
jSpecAbility = GffAddByte(jSpecAbility, "SpellCasterLevel", 15);
jSpecAbility = GffAddByte(jSpecAbility, "SpellFlags", 1);
// Manually add to the array
jSpecAbilityList = JsonArrayInsert(jSpecAbilityList, jSpecAbility);
}
//:: Add the list to the creature
jCreature = GffAddList(jCreature, "SpecAbilityList", jSpecAbilityList);
return jCreature;
}
//:: Directly modifies jCreature's Challenge Rating.
//:: This is useful for most XP calculations.
//::
json json_UpdateParagonCR(json jCreature, int nBaseCR, int nBaseHD)
{
int nNewCR;
//:: Calculate additional CR by HD
if(nBaseHD <= 6)
{
nNewCR = nBaseCR + 18;
}
else if(nBaseHD <= 16)
{
nNewCR = nBaseCR + 15;
}
else
{nNewCR = nBaseCR + 12;}
//:: Modify Challenge Rating
jCreature = GffReplaceFloat(jCreature, "ChallengeRating"/* /value" */, IntToFloat(nNewCR));
return jCreature;
}
//:: Get a random General feat.
void PickParagonBonusFeat(object oCreature)
{
//:: Paragon creatures get a +15 to all ability scores,
//:: so can always meet feat pre-reqs.
//:: Detect spellcasting classes (FOR FUTURE USE)
int i;
for (i = 1; i <= 8; i++)
{
if (GetIsArcaneClass(GetClassByPosition(i, oCreature)))
{
SetLocalInt(oCreature, "ParagonArcaneCaster", 0);
}
if (GetIsDivineClass(GetClassByPosition(i, oCreature)))
{
SetLocalInt(oCreature, "ParagonDivineCaster", 0);
}
}
switch (Random(18))
{
//:: Dodge -> Mobility -> Spring Attack
case 0:
{
int iDodge = GetHasFeat(FEAT_DODGE, oCreature);
int iMobility = GetHasFeat(FEAT_MOBILITY, oCreature);
int iSpringAttack = GetHasFeat(FEAT_SPRING_ATTACK, oCreature);
//:: Grant only the first missing feat in the chain
if (iDodge == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_DODGE);
}
else if (iMobility == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_MOBILITY);
}
else if (iSpringAttack == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_SPRING_ATTACK);
}
}
break;
//:: Power Attack -> Cleave -> Imp Power Attack -> Great Cleave
case 1:
{
int iPower = GetHasFeat(FEAT_POWER_ATTACK, oCreature);
int iCleave = GetHasFeat(FEAT_CLEAVE, oCreature);
int iImpPower = GetHasFeat(FEAT_IMPROVED_POWER_ATTACK, oCreature);
int iGrCleave = GetHasFeat(FEAT_GREAT_CLEAVE, oCreature);
//:: Grant only the first missing feat in the chain
if (iPower == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_POWER_ATTACK);
}
else if (iCleave == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_CLEAVE);
}
else if (iImpPower == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_IMPROVED_POWER_ATTACK);
}
else if (iGrCleave == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_GREAT_CLEAVE);
}
}
break;
//:: Expertise -> Imp Expertise -> Whirlwind Attack -> Imp Whirlwind Attack
case 2:
{
int iEx = GetHasFeat(FEAT_EXPERTISE, oCreature);
int iImpEx = GetHasFeat(FEAT_IMPROVED_EXPERTISE, oCreature);
int iWhirl = GetHasFeat(FEAT_WHIRLWIND_ATTACK, oCreature);
int iImpWhirl = GetHasFeat(FEAT_IMPROVED_WHIRLWIND, oCreature);
//:: Grant only the first missing feat in the chain
if (iEx == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_EXPERTISE);
}
else if (iImpEx == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_IMPROVED_EXPERTISE);
}
else if (iWhirl == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_WHIRLWIND_ATTACK);
}
else if (iImpWhirl == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_IMPROVED_WHIRLWIND);
}
}
break;
//:: Disarm -> Expertise -> Improved Disarm -> Imp Expertise
case 3:
{
int iDisarm = GetHasFeat(FEAT_DISARM, oCreature);
int iEx = GetHasFeat(FEAT_EXPERTISE, oCreature);
int iImpDisarm = GetHasFeat(FEAT_IMPROVED_DISARM, oCreature);
int iImpEx = GetHasFeat(FEAT_IMPROVED_EXPERTISE, oCreature);
//:: Grant only the first missing feat in the chain
if (iDisarm == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_DISARM);
}
else if (iEx == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_EXPERTISE);
}
else if (iImpDisarm == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_IMPROVED_DISARM);
}
else if (iImpEx == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_IMPROVED_EXPERTISE);
}
}
break;
//:: Toughness
case 4:
{
ApplyParagonBonusFeat(oCreature, FEAT_TOUGHNESS);
}
break;
//:: Great Fortitude
case 5:
{
ApplyParagonBonusFeat(oCreature, FEAT_GREAT_FORTITUDE);
}
break;
//:: Lightining Reflexes
case 6:
{
ApplyParagonBonusFeat(oCreature, FEAT_LIGHTNING_REFLEXES);
}
break;
//:: Iron Will -> Unnatural Will
case 7:
{
int iIronWill = GetHasFeat(FEAT_IRON_WILL, oCreature);
int iUnnaturalWill = GetHasFeat(FEAT_UNNATURAL_WILL, oCreature);
//:: Grant only the first missing feat in the chain
if (iIronWill == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_IRON_WILL);
}
else if (iUnnaturalWill == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_UNNATURAL_WILL);
}
}
break;
//:: Blind-Fight
case 8:
{
ApplyParagonBonusFeat(oCreature, FEAT_BLIND_FIGHT);
}
break;
//:: Improved Initiative
case 9:
{
ApplyParagonBonusFeat(oCreature, FEAT_IMPROVED_INITIATIVE);
}
break;
//:: Alertness
case 10:
{
ApplyParagonBonusFeat(oCreature, FEAT_ALERTNESS);
}
break;
//:: Blooded
case 11:
{
ApplyParagonBonusFeat(oCreature, FEAT_BLOODED);
}
break;
//:: Side-step Charge
case 12:
{
ApplyParagonBonusFeat(oCreature, FEAT_SIDESTEP_CHARGE);
}
break;
//:: Thug
case 13:
{
ApplyParagonBonusFeat(oCreature, FEAT_THUG);
}
break;
//:: Dive for Cover
case 14:
{
ApplyParagonBonusFeat(oCreature, FEAT_DIVE_FOR_COVER);
}
break;
//:: Endurance -> Strong Stomach
case 15:
{
int iEndurance = GetHasFeat(FEAT_ENDURANCE, oCreature);
int iStrStomach = GetHasFeat(FEAT_STRONG_STOMACH, oCreature);
//:: Grant only the first missing feat in the chain
if (iEndurance == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_ENDURANCE);
}
else if (iStrStomach == 0)
{
ApplyParagonBonusFeat(oCreature, FEAT_STRONG_STOMACH);
}
}
break;
//:: Resist Disease
case 16:
{
ApplyParagonBonusFeat(oCreature, FEAT_RESIST_DISEASE);
}
break;
//:: Resist Poison
case 17:
{
ApplyParagonBonusFeat(oCreature, FEAT_RESIST_POISON);
}
break;
}
}
//:: Check & apply the feat using EffectBonusFeat if it
//:: doesn't exist on the creature already
void ApplyParagonBonusFeat(object oCreature, int iFeat)
{
// If the creature does not already have the feat, apply it
if (!GetHasFeat(iFeat, oCreature))
{
effect eFeat = EffectBonusFeat(iFeat);
effect eLink = UnyieldingEffect(eFeat);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oCreature);
}
else
{
DelayCommand(0.0f, PickParagonBonusFeat(oCreature));
}
}
//:: Apply Paragon effects to a non-PC creature
void ApplyParagonEffects(object oCreature, int nBaseHD, int nBaseCR)
{
//:: Declare major variables
int nNewCR;
effect eParagon;
//:: Set maximum hit points for each HD
int nParagonHP = (GetMaxPossibleHP(oCreature) + (nBaseHD * GetAbilityModifier(ABILITY_CONSTITUTION, oCreature)));
SetCurrentHitPoints(oCreature, nParagonHP);
//:: Tripling the speed for all movement types
eParagon = EffectLinkEffects(eParagon, EffectMovementSpeedIncrease(300));
//:: +25 luck bonus on all attack rolls
eParagon = EffectLinkEffects(eParagon, EffectAttackIncrease(25));
//:: +20 luck bonus on damage rolls for melee and thrown ranged attacks
eParagon = EffectLinkEffects(eParagon, EffectDamageIncrease(20));
//:: AC Bonuses: +12 insight, +12 luck
eParagon = EffectLinkEffects(eParagon, EffectACIncrease(12, AC_DODGE_BONUS));
eParagon = EffectLinkEffects(eParagon, EffectACIncrease(12, AC_DEFLECTION_BONUS));
//:: Boost caster & SLA level by 15
SetLocalInt(oCreature, PRC_CASTERLEVEL_ADJUSTMENT, 15);
//:: Fire and cold resistance 10, or keep the higher existing resistance if applicable
eParagon = EffectLinkEffects(eParagon, EffectDamageResistance(DAMAGE_TYPE_FIRE, 10));
eParagon = EffectLinkEffects(eParagon, EffectDamageResistance(DAMAGE_TYPE_COLD, 10));
//:: Damage Reduction 20/epic or retain existing DR if higher
eParagon = EffectLinkEffects(eParagon, EffectDamageReduction(20, DAMAGE_POWER_ENERGY));
//:: Spell Resistance equal to CR +10, or retain existing SR if higher
int iExSR = GetSpellResistance(oCreature);
int nSpellResistance;
if (iExSR < nBaseCR + 10)
{
nSpellResistance = nBaseCR + 10;
}
else
{
nSpellResistance = 0;
}
eParagon = EffectLinkEffects(eParagon, EffectSpellResistanceIncrease(nSpellResistance));
//:: Fast Healing 20
eParagon = EffectLinkEffects(eParagon, EffectRegenerate(20, 6.0f));
//:: Saving Throws: +10 insight bonus on all saving throws
eParagon = EffectLinkEffects(eParagon, EffectSavingThrowIncrease(SAVING_THROW_ALL, 10));
//:: Skills: +10 competence bonus to all skill checks
int nSkillID = 0;
while (TRUE)
{
//:: Get & check skill
string sSkillLabel = Get2DACache("skills", "Label", nSkillID);
//:: Break when out of skills
if (sSkillLabel == "")
break;
//:: Apply the skill increase effect for the current skill
eParagon = EffectLinkEffects(eParagon, EffectSkillIncrease(nSkillID, 10));
//:: Move to the next skill ID
nSkillID++;
}
//:: Two free general feats.
PickParagonBonusFeat(oCreature);
PickParagonBonusFeat(oCreature);
eParagon = UnyieldingEffect(eParagon);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eParagon, oCreature);
}
void main ()
{

View File

@@ -2,7 +2,8 @@
void main()
{
object oPlayer = GetLastGuiEventPlayer();
ExecuteScript("prc_onplayergui");
object oPlayer = GetLastGuiEventPlayer();
int nType = GetLastGuiEventType();
object oTarget = GetLastGuiEventObject();
int nValue = GetLastGuiEventInteger();

View File

@@ -11,40 +11,6 @@
#include "prc_inc_natweap"
#include "prc_inc_util"
void ReallyEquipItemInSlot(object oNPC, object oItem, int nSlot);
//:: Moved into PRC includes
void ReallyEquipItemInSlot(object oNPC, object oItem, int nSlot)
{
if (GetItemInSlot(nSlot) != oItem)
{
//ClearAllActions();
AssignCommand(oNPC, ActionEquipItem(oItem, nSlot));
DelayCommand(0.5, ReallyEquipItemInSlot(oNPC, oItem, nSlot));
}
}
// Get the size of a JSON array
int GetJsonArraySize(json jArray)
{
int iSize = 0;
while (JsonArrayGet(jArray, iSize) != JsonNull())
{
iSize++;
}
return iSize;
}
int CheckForWeapon(object oCreature)
{
if (GetIsWeapon(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oCreature)) == 1 || GetIsWeapon(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oCreature)) == 1)
{
// oCreature has a weapon in at least one hand
return TRUE;
}
else
{
// oCreature doesn't have a weapon in either hand
return FALSE;
}
}
//:: void main(){}

View File

@@ -140,7 +140,7 @@ void NWNX_Administration_SetPlayOption(int option, int value);
///
/// @param playerName The community (login name).
/// @param characterName The character name.
/// @return Returns TRUE if successful
/// @return Returns TRUE if successful.
int NWNX_Administration_DeleteTURD(string playerName, string characterName);
/// @brief Get an @ref admin_debug "Administration Debug Type" value.

View File

@@ -93,7 +93,7 @@ int NWNX_Area_GetAreaSpotModifier(object area);
/// @sa NWNX_SkillRanks_SetAreaModifier() to change any skill modifier.
void NWNX_Area_SetAreaSpotModifier(object area, int spotModifier);
/// @brief Get the listen modifer of area
/// @brief Get the listen modifier of area
/// @param area The area object.
/// @return The value of the Listen skill modifier for this area.
int NWNX_Area_GetAreaListenModifier(object area);
@@ -343,7 +343,7 @@ struct NWNX_Area_AreaWind NWNX_Area_GetAreaWind(object oArea);
/// @brief Set the default discoverability mask for objects in an area.
/// @param oArea The area or OBJECT_INVALID to set a global mask for all areas. Per area masks will override the global mask.
/// @param nObjectTypes A mask of OBJECT_TYPE_* constants or OBJECT_TYPE_ALL for all suitable object types. Currently only works on Creatures, Doors (Hilite only), Items and Useable Placeables.
/// @param nObjectTypes A mask of OBJECT_TYPE_* constants or OBJECT_TYPE_ALL for all suitable object types. Currently only works on Creatures, Doors (Hilite only), Items and Usable Placeables.
/// @param nMask A mask of OBJECT_UI_DISCOVERY_*
/// @param bForceUpdate If TRUE, will update the discovery mask of ALL objects in the area or module(if oArea == OBJECT_INVALID), according to the current mask. Use with care.
void NWNX_Area_SetDefaultObjectUiDiscoveryMask(object oArea, int nObjectTypes, int nMask, int bForceUpdate = FALSE);

View File

@@ -323,7 +323,7 @@ void NWNX_Creature_SetSkillRank(object creature, int skill, int rank);
int NWNX_Creature_GetSkillRankByLevel(object creature, int skill, int level);
/// @brief Set the ranks in a skill for creature assigned at a level.
/// @note It only affect the leveling array, to know what to do on level-down. To effectivly change the skill rank on the current level, NWNX_Creature_SetSkillRank is also needed.
/// @note It only affect the leveling array, to know what to do on level-down. To effectively change the skill rank on the current level, NWNX_Creature_SetSkillRank is also needed.
/// @param creature The creature object.
/// @param skill The skill id.
/// @param level The level they gained skill ranks.
@@ -636,7 +636,7 @@ void NWNX_Creature_SetCriticalMultiplierModifier(object oCreature, int nModifier
/// @brief Gets the critical hit multiplier modifier for the Creature
/// @param oCreature The target creature
/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand
/// @param nBaseItem The baseitem modifer to retrieve. BASE_ITEM_GLOVES for Unarmed, '-1' for all
/// @param nBaseItem The baseitem modifier to retrieve. BASE_ITEM_GLOVES for Unarmed, '-1' for all
/// @return the current critical hit multiplier modifier for the creature
int NWNX_Creature_GetCriticalMultiplierModifier(object oCreature, int nHand = 0, int nBaseItem = -1);
@@ -668,7 +668,7 @@ void NWNX_Creature_SetCriticalRangeModifier(object oCreature, int nModifier, int
/// @brief Gets the critical hit range modifier for the creature.
/// @param oCreature The target creature
/// @param nHand 0 for all attacks, 1 for Mainhand, 2 for Offhand
/// @param nBaseItem The baseitem modifer to retrieve. BASE_ITEM_GLOVES for Unarmed, '-1' for all
/// @param nBaseItem The baseitem modifier to retrieve. BASE_ITEM_GLOVES for Unarmed, '-1' for all
/// @return the current critical hit range modifier for the creature
int NWNX_Creature_GetCriticalRangeModifier(object oCreature, int nHand = 0, int nBaseItem = -1);
@@ -1023,6 +1023,19 @@ int NWNX_Creature_GetMulticlassLimit(object oCreature);
/// @note Persistence is enabled after a server reset by the first use of this function.
void NWNX_Creature_SetMulticlassLimit(object oCreature, int nLimit, int bPersist = FALSE);
/// @brief Gets the creature's number of bonus spells.
/// @param oCreature The creature object.
/// @param nMultiClass The character class position, starting at 0.
/// @param nSpellLevel The spell level, 0 to 9.
int NWNX_Creature_GetNumberOfBonusSpells(object oCreature, int nMultiClass, int nSpellLevel);
/// @brief Modifies the creature's number of bonus spells.
/// @param oCreature The creature object.
/// @param nMultiClass The character class position, starting at 0.
/// @param nSpellLevel The spell level, 0 to 9.
/// @param nDelta The value to change the number of bonus spells by. Can be negative.
void NWNX_Creature_ModifyNumberBonusSpells(object oCreature, int nMultiClass, int nSpellLevel, int nDelta);
/// @}
void NWNX_Creature_AddFeat(object creature, int feat)
@@ -2248,3 +2261,21 @@ void NWNX_Creature_SetMulticlassLimit(object oCreature, int nLimit, int bPersist
NWNXPushObject(oCreature);
NWNXCall(NWNX_Creature, "SetMulticlassLimit");
}
int NWNX_Creature_GetNumberOfBonusSpells(object oCreature, int nMultiClass, int nSpellLevel)
{
NWNXPushInt(nSpellLevel);
NWNXPushInt(nMultiClass);
NWNXPushObject(oCreature);
NWNXCall(NWNX_Creature, "GetNumberOfBonusSpells");
return NWNXPopInt();
}
void NWNX_Creature_ModifyNumberBonusSpells(object oCreature, int nMultiClass, int nSpellLevel, int nDelta)
{
NWNXPushInt(nDelta);
NWNXPushInt(nSpellLevel);
NWNXPushInt(nMultiClass);
NWNXPushObject(oCreature);
NWNXCall(NWNX_Creature, "ModifyNumberBonusSpells");
}

View File

@@ -86,8 +86,9 @@ struct NWNX_Damage_AttackEventData
int iAttackResult; ///< 1=hit, 2=parried, 3=critical hit, 4=miss, 5=resisted, 7=automatic hit, 8=concealed, 9=miss chance, 10=devastating crit
int iWeaponAttackType; ///< 1=main hand, 2=offhand, 3-5=creature, 6=extra(haste), 7=unarmed, 8=unarmed extra
int iSneakAttack; ///< 0=neither, 1=sneak attack, 2=death attack, 3=both
int iAttackType; ///< 65002=Attack of Opportunity, 65003=Riposte or a FeatID like KnockDown or some other special attack.
int bRangedAttack; /// TRUE if it is a ranged attack
int bKillingBlow; ///< TRUE if the hit is a killing blow
int iAttackType; ///< 65002=Attack of Opportunity, 65003=Riposte or a FeatID like KnockDown or some other special attack.
int iToHitRoll; ///< The to hit roll of the attack
int iToHitModifier; ///< The to hit modifier of the attack
};
@@ -311,6 +312,7 @@ struct NWNX_Damage_AttackEventData NWNX_Damage_GetAttackEventData()
data.iAttackType = NWNXPopInt();
data.iToHitRoll = NWNXPopInt();
data.iToHitModifier = NWNXPopInt();
data.bRangedAttack = NWNXPopInt();
return data;
}

View File

@@ -112,7 +112,7 @@ void NWNX_Effect_ReplaceEffectByIndex(object oObject, int nIndex, struct NWNX_E
/// @return FALSE/0 on failure TRUE/1 on success.
int NWNX_Effect_RemoveEffectById(object oObject, string sID);
/// @brief Applys an effect, bypassing any processing done by ApplyEffectToObject
/// @brief Applies an effect, bypassing any processing done by ApplyEffectToObject
/// @param eEffect The effect to be applied.
/// @param oObject The object to apply it to.
void NWNX_Effect_Apply(effect eEffect, object oObject);

View File

@@ -174,7 +174,7 @@ _______________________________________
SLOT | int | |
@note This event does not run on login as the base game OnPlayerEquipItem event does. (Because this event hooks CNWSCreature::RunEquip which calls CNWSCreature::EquipItem. When the player character is first loaded, EquipItem is called directly.)
@note If the goal is to prevent items from being equiped under certain conditions, and since this event does not run on login, it could be helpful to additionally use NWNX_Creature_RunUnequip() in the OnClientEnter (or similar) event.
@note If the goal is to prevent items from being equipped under certain conditions, and since this event does not run on login, it could be helpful to additionally use NWNX_Creature_RunUnequip() in the OnClientEnter (or similar) event.
_______________________________________
## Item Unequip Events
@@ -279,6 +279,20 @@ _______________________________________
TARGET_POSITION_Z | float | |
ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events
_______________________________________
## Feat Decrement Remaining Uses Events
- NWNX_ON_DECREMENT_REMAINING_FEAT_USES_BEFORE
- NWNX_ON_DECREMENT_REMAINING_FEAT_USES_AFTER
`OBJECT_SELF` = The object owning the feat
Event Data Tag | Type | Notes |
----------------------|--------|-------|
FEAT_ID | int | |
REMAINING_USES | int | Decremented by 1 in the _AFTER event if the _BEFORE event wasn't skipped |
@note Skipping the _BEFORE event will prevent the feat uses being decremented
_______________________________________
## Has Feat Events
- NWNX_ON_HAS_FEAT_BEFORE
@@ -1765,6 +1779,7 @@ _______________________________________
LOADING_GAME | int | TRUE if the itemproperty is being applied when loading into the game and not due to equipping the item. |
INVENTORY_SLOT | int | The INVENTORY_SLOT_* the item is (un)equipped to/from. |
PROPERTY | int | The ITEM_PROPERTY_* type. |
ID | int | The ID of the item property. |
SUBTYPE | int | The subtype of the itemproperty. |
TAG | string | The optional tag set by TagItemProperty() |
COST_TABLE | int | The index into iprp_costtable.2da |
@@ -1785,6 +1800,22 @@ _______________________________________
\code{.c}
NWNX_Events_AddIDToWhitelist("NWNX_ON_ITEMPROPERTY_EFFECT", ITEM_PROPERTY_*);
\endcode
_______________________________________
## Ability Change Events
- NWNX_ON_ABILITY_CHANGE_BEFORE
- NWNX_ON_ABILITY_CHANGE_AFTER
`OBJECT_SELF` = The player object
Event Data Tag | Type | Notes
----------------------|------|-------
ABILITY | int | The ABILITY_* constant |
VALUE | int | The new ability value |
MOD | int | The new ability modifier (only available in AFTER) |
@note The event only fires for players. It might fire a few times during (before) client enter when all the items are equipped and one or more of them have a bonus to abilities. To detect and possibly skip events happening before client enter one can use `GetIsObjectValid(GetArea(OBJECT_SELF))`.
@warning The nwscript function GetAbilityModifier() will return the **old** modifier when used in this event. Use the MOD event data to get the new value.
*/
/// @name Events Event Constants
@@ -1840,6 +1871,8 @@ const string NWNX_ON_ITEM_ACQUIRE_BEFORE = "NWNX_ON_ITEM_ACQUIRE_BEFORE";
const string NWNX_ON_ITEM_ACQUIRE_AFTER = "NWNX_ON_ITEM_ACQUIRE_AFTER";
const string NWNX_ON_USE_FEAT_BEFORE = "NWNX_ON_USE_FEAT_BEFORE";
const string NWNX_ON_USE_FEAT_AFTER = "NWNX_ON_USE_FEAT_AFTER";
const string NWNX_ON_DECREMENT_REMAINING_FEAT_USES_BEFORE = "NWNX_ON_DECREMENT_REMAINING_FEAT_USES_BEFORE";
const string NWNX_ON_DECREMENT_REMAINING_FEAT_USES_AFTER = "NWNX_ON_DECREMENT_REMAINING_FEAT_USES_AFTER";
const string NWNX_ON_HAS_FEAT_BEFORE = "NWNX_ON_HAS_FEAT_BEFORE";
const string NWNX_ON_HAS_FEAT_AFTER = "NWNX_ON_HAS_FEAT_AFTER";
const string NWNX_ON_DM_GIVE_GOLD_BEFORE = "NWNX_ON_DM_GIVE_GOLD_BEFORE";
@@ -2293,6 +2326,7 @@ string NWNX_Events_GetEventData(string tag);
/// - CharacterSheetPermitted event
/// - Input Drop Item
/// - Decrement Spell Count event
/// - Decrement Remaining Feat Uses event
/// - Play Visual Effect event
/// - EventScript event
/// - Broadcast Safe Projectile event

View File

@@ -45,7 +45,7 @@ int NWNX_Feat_GetModifierConstant(string featMod)
else if (featMod == "VISUALEFFECT") return NWNX_FEAT_MODIFIER_VISUALEFFECT;
else if (featMod == "SPELLSAVEDCFORSCHOOL") return NWNX_FEAT_MODIFIER_SPELLSAVEDCFORSCHOOL;
else if (featMod == "SPELLSAVEDCFORSPELL") return NWNX_FEAT_MODIFIER_SPELLSAVEDCFORSPELL;
return NWNX_FEAT_MODIFIER_INVALID;
}
@@ -75,4 +75,4 @@ void NWNX_Feat_LoadFeatModifiers(string sColumnName = "FeatModsTable")
}
}
}
}
}

View File

@@ -60,7 +60,7 @@ const int NWNX_FEEDBACK_SKILL_HEAL_TARGET_NOT_DISPSND = 55;
const int NWNX_FEEDBACK_SKILL_HEAL_VALID_TARGETS = 56;
const int NWNX_FEEDBACK_SKILL_STEALTH_IN_COMBAT = 60;
/// Miscellaneous Targetting Messages
/// Miscellaneous Targeting Messages
const int NWNX_FEEDBACK_TARGET_UNAWARE = 6;
const int NWNX_FEEDBACK_ACTION_NOT_POSSIBLE_STATUS = 7;
const int NWNX_FEEDBACK_ACTION_NOT_POSSIBLE_PVP = 187;

View File

@@ -108,8 +108,8 @@ int NWNX_Item_MoveTo(object oItem, object oTarget, int bHideAllFeedback = FALSE)
/// @param oItem The item object.
/// @param nModifier the modifier to apply (After any Override)
/// @param bPersist Whether the modifier should persist to gff field. Strongly Recommended to be TRUE (See warning)
/// @note This function (or override partner) must be used each server reset to reenable persistence. Recommended use on OBJECT_INVALID OnModuleLoad.
/// @warning if Persistence is FALSE, or not renabled, beware characters may trigger ELC logging in with now-invalid ItemLevelRestrictions equipped.
/// @note This function (or override partner) must be used each server reset to re-enable persistence. Recommended use on OBJECT_INVALID OnModuleLoad.
/// @warning if Persistence is FALSE, or not re-enabled, beware characters may trigger ELC logging in with now-invalid ItemLevelRestrictions equipped.
void NWNX_Item_SetMinEquipLevelModifier(object oItem, int nModifier, int bPersist = TRUE);
/// @brief Gets the applied modifier to the Minimum Level to Equip (Item Level Restriction).
@@ -120,8 +120,8 @@ int NWNX_Item_GetMinEquipLevelModifier(object oItem);
/// @param oItem The item object.
/// @param nOverride the nOverride to apply (Before any Modifier)
/// @param bPersist Whether the modifier should persist to gff field. Strongly Recommended to be TRUE (See warning)
/// @note This function (or modifier partner) must be used each server reset to reenable persistence. Recommended use on OBJECT_INVALID OnModuleLoad.
/// @warning if Persistence is FALSE, or not renabled, beware characters may trigger ELC logging in with now-invalid ItemLevelRestrictions equipped.
/// @note This function (or modifier partner) must be used each server reset to re-enable persistence. Recommended use on OBJECT_INVALID OnModuleLoad.
/// @warning if Persistence is FALSE, or not re-enabled, beware characters may trigger ELC logging in with now-invalid ItemLevelRestrictions equipped.
void NWNX_Item_SetMinEquipLevelOverride(object oItem, int nOverride, int bPersist = TRUE);
/// @brief Gets the applied override to the Minimum Level to Equip (Item Level Restriction).

View File

@@ -292,16 +292,16 @@ int NWNX_Object_GetIsDestroyable(object oObject);
/// @brief Checks for specific spell immunity. Should only be called in spellscripts
/// @param oDefender The object defending against the spell.
/// @param oCaster The object casting the spell.
/// @param nSpellId The casted spell id. Default value is -1, which corrresponds to the normal game behaviour.
/// @param nSpellId The casted spell id. Default value is -1, which corresponds to the normal game behaviour.
/// @return -1 if defender has no immunity, 2 if the defender is immune
int NWNX_Object_DoSpellImmunity(object oDefender, object oCaster, int nSpellId=-1);
/// @brief Checks for spell school/level immunities and mantles. Should only be called in spellscripts
/// @param oDefender The object defending against the spell.
/// @param oCaster The object casting the spell.
/// @param nSpellId The casted spell id. Default value is -1, which corrresponds to the normal game behaviour.
/// @param nSpellLevel The level of the casted spell. Default value is -1, which corrresponds to the normal game behaviour.
/// @param nSpellSchool The school of the casted spell (SPELL_SCHOOL_* constant). Default value is -1, which corrresponds to the normal game behaviour.
/// @param nSpellId The casted spell id. Default value is -1, which corresponds to the normal game behaviour.
/// @param nSpellLevel The level of the casted spell. Default value is -1, which corresponds to the normal game behaviour.
/// @param nSpellSchool The school of the casted spell (SPELL_SCHOOL_* constant). Default value is -1, which corresponds to the normal game behaviour.
/// @return -1 defender no immunity. 2 if immune. 3 if immune, but the immunity has a limit (example: mantles)
int NWNX_Object_DoSpellLevelAbsorption(object oDefender, object oCaster, int nSpellId=-1, int nSpellLevel=-1, int nSpellSchool=-1);

View File

@@ -77,7 +77,7 @@ const int NWNX_PLAYER_PLATFORM_SONY_PS4 = 70;
/// @}
/// @brief Force display placeable examine window for player
/// @note If used on a placeable in a different area than the player, the portait will not be shown.
/// @note If used on a placeable in a different area than the player, the portrait will not be shown.
/// @param player The player object.
/// @param placeable The placeable object.
void NWNX_Player_ForcePlaceableExamineWindow(object player, object placeable);
@@ -453,6 +453,11 @@ object NWNX_Player_GetTURD(object oPlayer);
/// @param oPlayer The player to reload the color palette for
void NWNX_Player_ReloadColorPalettes(object oPlayer);
/// @brief Get the current open store of oPlayer.
/// @param oPlayer The player.
/// @return The open store or OBJECT_INVALID if no store is open.
object NWNX_Player_GetOpenStore(object oPlayer);
/// @}
void NWNX_Player_ForcePlaceableExamineWindow(object player, object placeable)
@@ -976,3 +981,10 @@ void NWNX_Player_ReloadColorPalettes(object oPlayer)
NWNXPushObject(oPlayer);
NWNXCall(NWNX_Player, "ReloadColorPalettes");
}
object NWNX_Player_GetOpenStore(object oPlayer)
{
NWNXPushObject(oPlayer);
NWNXCall(NWNX_Player, "GetOpenStore");
return NWNXPopObject();
}

View File

@@ -51,4 +51,3 @@ void NWNX_Profiler_PopPerfScope()
{
NWNXCall(NWNX_Profiler, "PopPerfScope");
}

View File

@@ -3077,7 +3077,7 @@ int NWNX_Redis_XREVRANGE(
/**
* XLEN
*
* Return the number of entires in a stream
* Return the number of entries in a stream
*
* Time complexity: O(1)
* Annotated return value: integer
@@ -3092,7 +3092,7 @@ int NWNX_Redis_XLEN(
* Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each stream. Can block.
*
* Time complexity: For each stream mentioned: O(N) with N being the number of elements being
* returned, it menas that XREAD-ing with a fixed COUNT is O(1). Note that when
* returned, it means that XREAD-ing with a fixed COUNT is O(1). Note that when
* the BLOCK option is used, XADD will pay O(M) time in order to serve the M
* clients blocked on the stream getting new data.

View File

@@ -3072,7 +3072,7 @@ int XREVRANGE(
/**
* XLEN
*
* Return the number of entires in a stream
* Return the number of entries in a stream
*
* Time complexity: O(1)
* Annotated return value: integer
@@ -3087,7 +3087,7 @@ int XLEN(
* Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each stream. Can block.
*
* Time complexity: For each stream mentioned: O(N) with N being the number of elements being
* returned, it menas that XREAD-ing with a fixed COUNT is O(1). Note that when
* returned, it means that XREAD-ing with a fixed COUNT is O(1). Note that when
* the BLOCK option is used, XADD will pay O(M) time in order to serve the M
* clients blocked on the stream getting new data.

View File

@@ -34,7 +34,7 @@ string NWNX_Rename_GetPCNameOverride(object oTarget, object oObserver = OBJECT_I
/// @brief Clears an overridden PC Name.
/// @param oTarget The PC whose overridden name to clear, use OBJECT_INVALID if you're clearing all overrides for an observer.
/// @param oObserver The observer whose overriden name of oTarget is being cleared.
/// @param oObserver The observer whose overridden name of oTarget is being cleared.
/// If oTarget is OBJECT_INVALID then all overrides are cleared.
/// @param clearAll If true, both the global and personal overrides will be cleared for that target PC.
/// Requires oObserver be OBJECT_INVALID.

View File

@@ -64,8 +64,8 @@ void NWNX_SQL_PreparedObjectFull(int position, object value, int base64 = TRUE);
/// @param position The nth ? in a prepared statement.
void NWNX_SQL_PreparedNULL(int position);
/// @brief Set the Json value of a prepared statement at given position.
/// Convienence function to match other Prepared(type) functions.
/// @brief Set the Json value of a prepared statement at given position.
/// Convenience function to match other Prepared(type) functions.
/// @param position The nth ? in a prepared statement.
/// @param value The value to set.
void NWNX_SQL_PreparedJson(int position, json value);
@@ -103,7 +103,7 @@ void NWNX_SQL_DestroyPreparedQuery();
/// @return The last error message generated by the database.
string NWNX_SQL_GetLastError();
/// @brief Gets the number of parameteres expected by a prepared query.
/// @brief Gets the number of parameters expected by a prepared query.
/// @return Returns the number of parameters expected by the prepared query or -1 if no query is prepared.
int NWNX_SQL_GetPreparedQueryParamCount();