Jump to content

Home

[K1] Get if npc has weapon


sekan

Recommended Posts

Posted

Hi,

 

I need a script that checks if a npc got a weapon. The weapon for this script is equipped. This shall be used in a dialog as a Conditional script.

Posted

int StartingConditional()
{
   object oNPC = GetObjectByTag("NPC_TAG");
   object oWeapon = GetItemPossessedBy(oNPC, "WEAPON_TAG");

   if ((GetIsObjectValid(oWeapon) == TRUE))
   {
       return TRUE;
   }
       return FALSE;
}

--Stream

Posted
Hi,

 

I need a script that checks if a npc got a weapon. The weapon for this script is equipped. This shall be used in a dialog as a Conditional script.

 

Or, if the weapon has to be in one of the main character's weapon slots you could do something like:

 


int IsEquipped(int iSlot, string sTag, object oActor) {
   return (GetTag(GetItemInSlot(iSlot, oActor)) == sTag);
}

int StartingConditional() {
   object oPC  = GetFirstPC();
   string sTag ="[color=Yellow]WeaponTag[/color]";

   return (   IsEquipped(INVENTORY_SLOT_RIGHTWEAPON, sTag, oPC)
           || IsEquipped(INVENTORY_SLOT_LEFTWEAPON, sTag, oPC));
}

 

(Change WeaponTag to the tag of the weapon to look for.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...