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

38 lines
1.2 KiB
Plaintext

#include "x2_inc_switches"
#include "prc_x2_itemprop"
#include "prc_inc_spells"
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
object oPC=OBJECT_SELF;
object oItem;
float fLvl;
if (nEvent==X2_ITEM_EVENT_SPELLCAST_AT)
{
oItem = PRCGetSpellTargetObject();
int nSpell = PRCGetSpellId();
int nLvl = StringToInt(Get2DAString("spells","innate",nSpell));
if (nLvl==0) fLvl = 0.5;
else fLvl = IntToFloat(nLvl);
fLvl = GetLocalFloat(oItem,"CurrentLvl") + fLvl;
//this function determines how powerful ring is - higher the more dope
if ( fLvl > 3.0)
{
SendMessageToPC(oPC,"The ring can't store this spell");
SetExecutedScriptReturnValue();
return;
}
itemproperty ipProp = ItemPropertyCastSpell(IPGetIPConstCastSpellFromSpellID(nSpell),IP_CONST_CASTSPELL_NUMUSES_0_CHARGES_PER_USE);
IPSafeAddItemProperty(oItem,ipProp,0.0,X2_IP_ADDPROP_POLICY_IGNORE_EXISTING,FALSE,FALSE);
SetLocalFloat(oItem,"CurrentLvl",fLvl);
SendMessageToPC(oPC,"You have stocked this spell");
}
SetExecutedScriptReturnValue();
}