RATDOG/_module/nss/ra_antinude.nss
Jaysyn904 16a00a66f5 Updated Giant Wasp Hive
Updated Giant Wasp Hive.  Got the Outcasts spawning with clothes on. Full compile.
2022-12-06 00:36:59 -05:00

33 lines
1.1 KiB
Plaintext

// This method does not use ActionEquipMostEffectiveArmor() and is a workaround
// to allow equipping clothing. It will equip any armor in the entering object's
// inventory. It can easily be modified to be used on a NPC's spawn script, but
// this is a good thing to have on a trigger around the module spawn point for
// PCs. Thanks to georage.
void main()
{
// Get the entering object
object oNPC = GetEnteringObject();
string sLocal = "DO_ONCE" + ObjectToString(OBJECT_SELF);
// Only do this once, and only to NPCs
if(GetLocalInt(oNPC, sLocal) || GetIsPC(oNPC)) return;
// Set to not do it again
SetLocalInt(oNPC, sLocal, TRUE);
// Loop the object's inventory and equip the first
object oItem = GetFirstItemInInventory(oNPC);
while(GetIsObjectValid(oItem))
{
// Check if armor, of course
if(GetBaseItemType(oItem) == BASE_ITEM_ARMOR)
{
// Equip it and stop the script
AssignCommand(oNPC, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST));
return;
}
oItem = GetNextItemInInventory(oNPC);
}
}