Initial Commit
Initial Commit
This commit is contained in:
63
_module/nss/craft_nogold.nss
Normal file
63
_module/nss/craft_nogold.nss
Normal file
@@ -0,0 +1,63 @@
|
||||
/*int StartingConditional()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
|
||||
object oItem = GetFirstItemInInventory(oPC);
|
||||
int nCost;
|
||||
int nGold;
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
if (GetLocalInt(oItem, "Prototype") == TRUE)
|
||||
{
|
||||
nCost = 3*GetGoldPieceValue(oItem)/4;
|
||||
nGold = GetGold(oPC);
|
||||
if (nGold < nCost) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
#include "x2_inc_itemprop"
|
||||
|
||||
//This is actually the main function.
|
||||
int script(object oItem, object oPC)
|
||||
{
|
||||
int nCost;
|
||||
int nValue;
|
||||
int nGold;
|
||||
nValue = GetGoldPieceValue(oItem);
|
||||
if (GetLocalString(oItem, "Type") == "Ammo") nValue = 99*nValue;
|
||||
nCost = 3*nValue/4;
|
||||
nGold = GetGold(oPC);
|
||||
if (nGold < nCost) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int StartingConditional()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
int nSlot = 0;
|
||||
object oItem;
|
||||
int nResult;
|
||||
|
||||
//Check if the item being crafted is equipped
|
||||
while (nSlot < 18)
|
||||
{
|
||||
oItem = GetItemInSlot(nSlot, oPC);
|
||||
if (GetLocalInt(oItem, "Prototype") == TRUE)
|
||||
nResult = script(oItem, oPC);
|
||||
nSlot++;
|
||||
}
|
||||
//If the item is not equipped, search for it in the inventory
|
||||
oItem = GetFirstItemInInventory(oPC);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
if (GetLocalInt(oItem, "Prototype") == TRUE)
|
||||
nResult = script(oItem, oPC);
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
|
||||
return nResult;
|
||||
}
|
||||
Reference in New Issue
Block a user