Files
HeroesStone_PRC8/_module/nss/divineright.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

79 lines
2.6 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Glowing Items Sample Item Script
//:: divineright
//:: Copyright (c) 2004 Jason Stephenson
//:://////////////////////////////////////////////
/*
This is a sample script for a sword with a tag
of "divineright" that is intended to show how to use
the glowitem_inc install and delete functions
on an item.
*/
//:://////////////////////////////////////////////
//:: Created By: Jason Stephenson (Dyrcona)
//:: Created On: August 8, 2004
//:://////////////////////////////////////////////
#include "x2_inc_switches"
#include "glowitem_inc"
int PCIsInArea(object oArea)
{
object oPC = GetFirstObjectInArea(oArea);
if(!GetIsPC(oPC))
{
oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC,oPC);
}
return(GetIsObjectValid(oPC));
}
void main()
{
object oPC;
object oItem;
itemproperty ipBonus;
int nEvent = GetUserDefinedItemEventNumber();
switch (nEvent) {
case X2_ITEM_EVENT_EQUIP:
oPC = GetPCItemLastEquippedBy();
oItem = GetPCItemLastEquipped();
/* if (GetAlignmentLawChaos(oPC) == ALIGNMENT_LAWFUL && GetAlignmentGoodEvil(oPC) == ALIGNMENT_GOOD) {
if (GetClassByPosition(1, oPC) == CLASS_TYPE_PALADIN || GetClassByPosition(2, oPC) == CLASS_TYPE_PALADIN
|| GetClassByPosition(3, oPC) == CLASS_TYPE_PALADIN) {
ipBonus = ItemPropertyEnhancementBonus(3);
}
else {
ipBonus = ItemPropertyEnhancementBonus(0);
}
IPSafeAddItemProperty(oItem, ipBonus);
} */
if (GetAlignmentLawChaos(oPC) == ALIGNMENT_LAWFUL && GetAlignmentGoodEvil(oPC) == ALIGNMENT_GOOD)
{
ipBonus = ItemPropertyEnhancementBonus((GetLevelByClass(CLASS_TYPE_PALADIN, oPC) > 0) ? 3 : 0);
IPSafeAddItemProperty(oItem, ipBonus);
}
InstallGlowItemAlignmentEffect(oItem, ALIGNMENT_EVIL, ITEM_VISUAL_HOLY, 10.0f);
break;
case X2_ITEM_EVENT_UNEQUIP:
case X2_ITEM_EVENT_UNACQUIRE:
if (nEvent == X2_ITEM_EVENT_UNEQUIP)
oItem = GetPCItemLastUnequipped();
else
oItem = GetModuleItemLost();
ipBonus = GetFirstItemProperty(oItem);
while (GetIsItemPropertyValid(ipBonus)) {
if (GetItemPropertyType(ipBonus) == ITEM_PROPERTY_ENHANCEMENT_BONUS)
RemoveItemProperty(oItem, ipBonus);
ipBonus = GetNextItemProperty(oItem);
}
DeleteGlowItemEffect(oItem);
break;
}
SetExecutedScriptReturnValue(X2_EXECUTE_SCRIPT_END);
}