Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Scripting: one one-handed weapon is wielded

Page: 1 of 1
 aristey
04-30-2011, 5:09 PM
#1
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.
 TimBob12
04-30-2011, 5:21 PM
#2
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.
 aristey
05-01-2011, 11:19 AM
#3
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.
Page: 1 of 1