Jump to content

Home

Scripting: one one-handed weapon is wielded


aristey

Recommended Posts

Greetings.

I'm having some scripting problem. I need to check, if OBJECT_SELF is wielding only one one-handed weapon (in his right hand, obviously). How can this be achieved? I'm trying to do this for K1 to specify.

 

I tried this variant

   object leftweapon = GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON , OBJECT_SELF);
   if (!GetIsObjectValid (leftweapon))
   // no weapon in left hand
   {
       object rightweapon = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, OBJECT_SELF);
       if (GetIsObjectValid (rightweapon))
       // some weapon in right hand; added in order to block bonuses for unarmed combat
       {
           <additional code; not related to the problem>
       }
   }

While it does work correctly for two one-handed weapons (i.e. 2 blasters) and for one one-handed weapon (i.e. blaster), it treats all two-handed weapons (i.e. blaster rifle) as one-handed.

Link to comment
Share on other sites

Just a guess but could it be that when you equip a two handed weapon it equips in one slot and just disables the other slot.

 

I will have another look though.

 

Hm... Now that you've mentioned it, the idea seems quite logical. Thanks for the reply.

I've made a workaround by using GetBaseItemType(rightweapon) to exclude all two-handed weapons. Though it works, this solution is far from well-favored. I steel would prefer something else.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...