Initial Commit
Initial Commit
This commit is contained in:
47
_module/nss/craft_prevrhand.nss
Normal file
47
_module/nss/craft_prevrhand.nss
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "x2_inc_itemprop"
|
||||
|
||||
//This is actually the main function.
|
||||
void script(object oItem, object oPC)
|
||||
{
|
||||
int nCurrentApp = GetItemAppearance(oItem, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RHAND);
|
||||
int nNewApp;
|
||||
switch (nCurrentApp)
|
||||
{
|
||||
case 3: nNewApp = 1; break;
|
||||
case 4: nNewApp = 3; break;
|
||||
case 5: nNewApp = 4; break;
|
||||
case 6: nNewApp = 5; break;
|
||||
case 7: nNewApp = 6; break;
|
||||
case 9: nNewApp = 7; break;
|
||||
case 192: nNewApp = 9; break;
|
||||
case 1: nNewApp = 192; break;
|
||||
default: nNewApp = 1; break;
|
||||
}
|
||||
object oModified = CopyItemAndModify(oItem, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RHAND, nNewApp, TRUE);
|
||||
SetItemCursedFlag(oModified, TRUE);
|
||||
if (oModified != OBJECT_INVALID) DestroyObject(oItem);
|
||||
ExecuteScript("craft_pcequip", oPC);
|
||||
return;
|
||||
}
|
||||
|
||||
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