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