Initial Commit
Initial Commit
This commit is contained in:
74
_module/nss/craft_finalconf.nss
Normal file
74
_module/nss/craft_finalconf.nss
Normal file
@@ -0,0 +1,74 @@
|
||||
/*int StartingConditional()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
|
||||
object oItem = GetFirstItemInInventory(oPC);
|
||||
int nValue;
|
||||
int nDC;
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
if (GetLocalInt(oItem, "Prototype") == TRUE)
|
||||
{
|
||||
nValue = GetGoldPieceValue(oItem);
|
||||
nDC = 10 + nValue / 3250;
|
||||
if (GetLocalString(oItem, "Type") == "Melee") nDC = 10 + nValue / 3250;
|
||||
if (GetLocalString(oItem, "Type") == "Ammo") nDC = 10 + 99*nValue / 800;
|
||||
if (GetLocalString(oItem, "Type") == "Shooter" && GetItemHasItemProperty(oItem, ITEM_PROPERTY_UNLIMITED_AMMUNITION) == FALSE) nDC = 10 + nValue / 1500;
|
||||
if (GetLocalString(oItem, "Type") == "Shooter" && GetItemHasItemProperty(oItem, ITEM_PROPERTY_UNLIMITED_AMMUNITION) == TRUE) nDC = 10 + nValue / 3250;
|
||||
if (GetLocalString(oItem, "Type") == "Throwing" || GetLocalString(oItem, "Type") == "MightyThrowing") nDC = 10 + 50*nValue / 600;
|
||||
SetCustomToken(799, IntToString(nValue));
|
||||
SetCustomToken(798, IntToString(nDC));
|
||||
SetCustomToken(800, IntToString(3*nValue/4));
|
||||
}
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
return TRUE;
|
||||
}*/
|
||||
|
||||
#include "x2_inc_itemprop"
|
||||
#include "x4_inc_functions"
|
||||
|
||||
//This is actually the main function.
|
||||
int script(object oItem, object oPC)
|
||||
{
|
||||
int nValue;
|
||||
int nDC;
|
||||
nValue = GetGoldPieceValue(oItem);
|
||||
if (GetLocalString(oItem, "Type") == "Ammo") nValue = 99*nValue;
|
||||
nDC = 10 + nValue / 3250;
|
||||
if (GetLocalString(oItem, "Type") == "Melee") nDC = 10 + nValue / 3250;
|
||||
if (GetLocalString(oItem, "Type") == "Ammo") nDC = 10 + nValue / 800;
|
||||
if (GetLocalString(oItem, "Type") == "Shooter" && GetItemHasItemProperty(oItem, ITEM_PROPERTY_UNLIMITED_AMMUNITION) == FALSE) nDC = 10 + nValue / 1500;
|
||||
if (GetLocalString(oItem, "Type") == "Shooter" && GetItemHasItemProperty(oItem, ITEM_PROPERTY_UNLIMITED_AMMUNITION) == TRUE) nDC = 10 + nValue / 3250;
|
||||
if (GetLocalString(oItem, "Type") == "Throwing" || GetLocalString(oItem, "Type") == "MightyThrowing") nDC = 10 + 50*nValue / 600;
|
||||
SetCustomToken(799, IntToString(nValue));
|
||||
SetCustomToken(798, IntToString(nDC));
|
||||
SetCustomToken(800, IntToString(3*nValue/4));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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