ActionEquip problem

I have a NPC which unequip at night in order to “proneB” on a bed, and equip back on day to go back to its post.

My problem is that the NPC refuse to equip back into



with the function :ActionEquipItem

while the other pieces are equiped back without problem. when the NPC goes hostile it’s equiping itself the weapon. So it’s not a problem of stats or character ability.

Any idea ?

1 Like

I’ve never had an issue with that. Maybe try it with a slight delay and see if that makes a difference?

1 Like

this might be a bit cludgy but perhaps leave them equipped and try

// TWH - OEI 5/25/2006
// Returns TRUE if it found an object to set weapon visibilty on
// oObject is the object to set weapon visibility on
// nVisibile 0 for invisibile, 1 for visible, and 4 is default engine action
// nType is: 0 - weapon, 1 - helm, 2 - both
int SetWeaponVisibility( object oObject, int nVisibile, int nType=0 );

No, SetWeaponVisibility doesn’t change the weapon visible state.

I can unequip everything, I can equip all the character stuff except the weapon, but I can’t equip back the weapon, the NPC equip it alone if hostile.

delay an Equip() subfunction, like Rj suggests, by ~1 sec ?

for weapons only

No delay functions does nothing

Equip right hand first, then left hand.

If you equip other way, the left switches to right automatically and any other right hand equip just replaces this.

Edit: It sounds like you are trying to equip two weapons, and so I have assumed this. If not, my bad. :flushed:

Try using ClearAllActions right before the ActionEquip commands of the weapons.

AL ready tried all of these, but I can’t force a weapon to equip while all the other pieces are fine.

Can we see the script?

	object oTalmiss = GetObjectByTag("talmiss");

if(GetIsNight()&& !GetGlobalInt("TempleShout0904")){


	SendMessageToPC(GetFirstPC(FALSE),"day: " + GetTag(GetLocalObject(oTalmiss,"chestItem")));
	SendMessageToPC(GetFirstPC(FALSE),"day: " + GetTag(GetLocalObject(oTalmiss,"leftHand")));
	SendMessageToPC(GetFirstPC(FALSE),"day: " + GetTag(GetLocalObject(oTalmiss,"rightHand")));					
	//BUG the NPC refuses to equip right hand and left hand item.

Um, isnt the left handed re-equip function commented out? Try uncommenting it?
Anyways, if you already did and this was just a typo on the post let’s try the following:
Disclaimer: I don’t have access to the toolset right now (I’m on Linux, I would need to know how to get NWN2 running here properly…), so I can’t test this and there might be a syntax error here and there (if compiling gives an errror check where the problem is and correct accordingly).
First of all, make a subroutine at the beginning of the script, above the void main:

void ReEquipStuff(object oNPC)

then try chaning the part with the else to the following

	/*SendMessageToPC(GetFirstPC(FALSE),"day: " + GetTag(GetLocalObject(oTalmiss,"chestItem")));
	SendMessageToPC(GetFirstPC(FALSE),"day: " + GetTag(GetLocalObject(oTalmiss,"leftHand")));
	SendMessageToPC(GetFirstPC(FALSE),"day: " + GetTag(GetLocalObject(oTalmiss,"rightHand")));	*/

	//BUG the NPC refuses to equip right hand and left hand item.
1 Like

There is asbolutly no problem with the remove part.

The problem is when it’s time to equip them back, weapons don’t equip while armors and jewelery does.

I call it remove equipment but it’s only a misnomer, it actually equips the items, give it a try.
Edit: There, now I renamed it ReEquipStuff

it’s exactly the same command/instructions except they are wrapped, I doubt it will change anything but it’s giving me an idea.

They are wrapped and they are not delayed from each other, they only have a common delay from the teleport, that’s the whole point.
Also the left handed equip is not commented…

Before trying to do stuff with the left, let’s try with the right :slight_smile: The right doesn’t work even if it’s alone. When I ll get the right hand working, I ll work with the left.

Also, are you sure that when the stuff in the else is called, it’s called always after what is in the if?
Because the local variables are stored in the first part, if the conditions that satisfy the else happen before the IF, those variables are never stored therefore it won’t requip anything.

if it’s an armor or not a weapon it’s equiped. If it’s a weapon it stays in the inventory. I will change the script holder for this action and see if it changes something.

By the way, how is this script called? From a dialogue, a heartbeat on creature, an on enter?