PoA_PRC8/_module/nss/npc_template_inc.nss
Jaysyn904 7cabddf4b3 2025/08/15 Updates
Updated for PRC8 updates.
2025-08-15 14:47:26 -04:00

50 lines
1.1 KiB
Plaintext

/* npc_template_inc
Common functions for Creature Templates
By: Jaysyn
Created: 2024-11-14 08:27:30
*/
#include "prc_inc_fork"
#include "nw_inc_gff"
#include "prc_inc_natweap"
#include "prc_inc_util"
void ReallyEquipItemInSlot(object oNPC, object oItem, int nSlot);
void ReallyEquipItemInSlot(object oNPC, object oItem, int nSlot)
{
if (GetItemInSlot(nSlot) != oItem)
{
//ClearAllActions();
AssignCommand(oNPC, ActionEquipItem(oItem, nSlot));
DelayCommand(0.5, ReallyEquipItemInSlot(oNPC, oItem, nSlot));
}
}
// Get the size of a JSON array
int GetJsonArraySize(json jArray)
{
int iSize = 0;
while (JsonArrayGet(jArray, iSize) != JsonNull())
{
iSize++;
}
return iSize;
}
int CheckForWeapon(object oCreature)
{
if (GetIsWeapon(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oCreature)) == 1 || GetIsWeapon(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oCreature)) == 1)
{
// oCreature has a weapon in at least one hand
return TRUE;
}
else
{
// oCreature doesn't have a weapon in either hand
return FALSE;
}
}
//:: void main(){}