generated from Jaysyn/ModuleTemplate
Initial Commit
Initial Commit.
This commit is contained in:
37
_module/nss/storering.nss
Normal file
37
_module/nss/storering.nss
Normal file
@@ -0,0 +1,37 @@
|
||||
#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();
|
||||
}
|
||||
Reference in New Issue
Block a user