Battledale_PRC8/_module/nss/set_cloak_next.nss
Jaysyn904 4dba880acb Added ACP v4.1
Added ACP v4.1. Full compile.  Updated module name.  Updated release archive.
2024-09-08 18:23:43 -04:00

42 lines
942 B
Plaintext

int GetNextCloakIndex( object oCloak)
{
int iIndex = GetItemAppearance( oCloak, ITEM_APPR_TYPE_SIMPLE_MODEL, 0);
iIndex++;
int iItemtype = GetBaseItemType( oCloak);
if ( iIndex ==0)
iIndex = 1;
else if( iIndex == 32)
iIndex = 51; //CEP2.2
else if( iIndex == 65)
iIndex = 99;
else if( iIndex >= 100)
iIndex = 1;
return iIndex;
}
void main()
{
object oPC = GetPCSpeaker();
object oPlayer = oPC;
object oCloak = GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC);
int iIndex = GetNextCloakIndex(oCloak);
if( GetIsDM( oPlayer))
SendMessageToPC( oPlayer, "The index is: " + IntToString( iIndex));
object oNewCloak = CopyItemAndModify(oCloak, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, iIndex, TRUE);
if( GetIsObjectValid(oNewCloak))
{
AssignCommand( oPlayer, ActionEquipItem(oNewCloak, INVENTORY_SLOT_CLOAK));
DestroyObject( oCloak);
}
else
DestroyObject( oNewCloak);
}