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