LoD_PRC8/_module/nss/waterkeyhandout.nss
Jaysyn904 94990edc60 Initial Upload
Initial Upload
2023-09-21 21:20:34 -04:00

97 lines
2.3 KiB
Plaintext

/*BLACKSMITH SCRIPT
Created by
Lilac Soul's NWN Script Generator, v. 1.3
for download info please visit
http://lilacsoul.revility.com
*/
int lsn=1;
//lsstype=3
void SetItemLocals()
{
SetLocalString(OBJECT_SELF, "lsn1", "waterkey");
SetLocalInt(OBJECT_SELF, "lsc_waterkey", 1);
SetLocalString(OBJECT_SELF, "lsi1_waterkey", "DearJohnLetter");
SetLocalInt(OBJECT_SELF, "lss_waterkey", -10);
SetLocalInt(OBJECT_SELF, "lsv_waterkey", -10);
}
void CreateGold(object oTarget, int nAmount)
{
CreateItemOnObject("nw_it_gold001", oTarget, nAmount);
}
void main()
{
object oOwner=GetPCSpeaker();
if (!GetLocalInt(OBJECT_SELF, "lsvar_set"))
{
SetItemLocals();
SetLocalInt(OBJECT_SELF, "lsvar_set", TRUE);
}
if (lsn==0) return;
object oItem;
int bOkay, nGold, nCount, nNum, nLoop, nLoops, nHasGold, nVis;
string sCur, sReq;
for (nLoop=1; nLoop<=lsn; nLoop++)
{
sCur=GetLocalString(OBJECT_SELF, "lsn"+IntToString(nLoop));
nNum=GetLocalInt(OBJECT_SELF, "lsc_"+sCur);
for (nLoops=1; nLoops<=nNum; nLoops++)
{
sReq=GetLocalString(OBJECT_SELF, "lsi"+IntToString(nLoops)+"_"+sCur);
if (GetStringLeft(sReq, 8)==" gold ")
{
nGold=StringToInt(GetStringRight(sReq, GetStringLength(sReq)-8));
if (GetGold(oOwner)>=nGold) nCount++;
}
else if (GetItemPossessedBy(oOwner, sReq)!=OBJECT_INVALID)
{
SetLocalObject(OBJECT_SELF, "ls__"+IntToString(nLoops), GetItemPossessedBy(oOwner, sReq));
nCount++;
}
}
if (GetLocalInt(OBJECT_SELF, "lss_"+sCur)==-10) bOkay=TRUE;
else if (GetLastSpell()==GetLocalInt(OBJECT_SELF, "lss_"+sCur)) bOkay=TRUE;
else bOkay=FALSE;
if (bOkay && (nCount==nNum)) bOkay=TRUE;
else bOkay=FALSE;
if (bOkay==TRUE)
{
if (nGold>0)
TakeGoldFromCreature(nGold, oOwner, TRUE);
for (nLoops=1; nLoops<=nNum; nLoops++)
{
oItem=GetLocalObject(OBJECT_SELF, "ls__"+IntToString(nLoops));
DestroyObject(oItem);
}
CreateItemOnObject(sCur, oOwner);
int nVis=GetLocalInt(OBJECT_SELF, "lsv_"+sCur);
if (nVis!=-10) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nVis), oOwner);
}
oItem=OBJECT_INVALID;
bOkay=FALSE;
nGold=0;
nCount=0;
sCur="";
sReq="";
nNum=0;
}
}