Making companions jump

andgalf… It does work… But then it doesn’t and I made sure she gets stripped of everything a long time before I run travus’ script. It’s got nothing to do with running it on a stripped person either because it works when she’s stripped and in the hangout… It’s a mystery.

Alright. I’m really curious exactly when this script is run and it doesn’t work. You jump her to the hangout first and then try to put new clothes on her? Or is it the other way around? Do you have a picture of the dialogue when doing this perhaps (in the toolset I mean)? There’s got to be a way to get to the bottom of this. If you somehow run the jumping script at the same time as the equipping script I think that might have to do with things.

EDIT: Can’t you do the equipping when she arrives at the hangout through a trigger? Or is that the way you do it? I’m sorry, but I’m still a bit confused with how exactly you have it setup.

angalf… Here’s what I did to test it

Entered the tavern ran the travus script from the console before anything happened she put the outfit on. Exit restart the module.

Went through all the conversations ( one has travus’s script in with same parameters I put in the console ) in which the order of things is… Strip companion, everything goes to a chest, run travus’s script, jump companion to hangout. These scripts are on separate conversation lines a long way apart.

I then went to the companion’s hangout, she is now naked with nothing in her inventory. I ran travus’ script from the console and she puts the outfit on. She will also put the outfit on when she’s not in the party.

I just thought one last test to do… Check script in conversation… Off I go again !

So…This all works, but when you go to the hangout afterwards she’s naked?

When she arrives at the hangout, could you maybe have a trigger there that equips her items a second time (even if that shouldn’t be necessary)? Maybe that would work?

angalf… I just tested it from a conversation before anything happens and it was weird. She puts on the outfit in the conversation, conversation stops, she’s naked, click her character icon and she gets dressed in it again.

This kind of links up to the problem Shallina mentioned with people having items but not wearing them when they get equipped, it doesn’t make sense.

Thanks for all your help but I think this is beyond logic and is some sort of NWN2 anomaly. As I said she’s staying naked now, she wont mind, I’ll write something around it.

This sounds similar to my situation when moving items to a chest. Are you using the ActionGiveItem function in your script? As you know, since you were part of that conversation, that function is buggy.

angalf… I’m just using the generic ga_give_inventory in the conversation actions and at least that part works alright.

The only issue I’m having with the item strip is that I can’t destroy two items. One is a creature hide and the other is an amulet. I unequip them on one line of the conversation and use ga_destroy_item on another but they keep appearing in the chest so aren’t getting destroyed !

I really don’t want the PC roaming around with the hide’s abilities because they’re set to cursed ! The amulet isn’t it’s just set as plot but I can’t wipe that out either. All other items set for destroy disappear normally.

ga_give_inventory uses the ActionGiveItem so I think that’s why this is buggy actually. I recommend using the CopyObject and DestroyObject instead. I mean, after I did that the problems disappeared.

EDIT: Here’s my script but a bit modified to suit your needs I think:

void UnequipAll(object oFM)
{
	object o;
	int n;
	
	for (n = INVENTORY_SLOT_HEAD; n < INVENTORY_SLOT_CWEAPON_L; n++)
	{
		o = GetItemInSlot(n, oFM);
		if (!GetItemCursedFlag(o)) AssignCommand(oFM, ActionUnequipItem(o));
	}
}



void MoveItemsToChest(object oFM)
{
	object oContainer = GetObjectByTag("newpricrate");
	object oItem = GetFirstItemInInventory(oFM);

	while (GetIsObjectValid(oItem))
	{
     if (!GetItemCursedFlag(oItem)) 
		{
		CopyItem(oItem,oContainer,TRUE);
		}
			
		oItem = GetNextItemInInventory(oFM);
	}
	

}

void DestroyInventory(object oFM)
{

	object oItem = GetFirstItemInInventory(oFM);

	while (GetIsObjectValid(oItem))
	{
     if (!GetItemCursedFlag(oItem)) 
		{
		DestroyObject(oItem);
		}
			
		oItem = GetNextItemInInventory(oFM);
	}
	

}
				
void main(string sCompaniontag)
{


	object oCompanion = GetObjectByTag(sCompaniontag);
	
	UnequipAll(oCompanion);
	
	DelayCommand(0.2f, MoveItemsToChest(oCompanion));
	DelayCommand(0.5f, DestroyInventory(oCompanion));

			
	
}

andgalf… But if you destroy the items a long time before you even touch the inventory why do they still exist ? It’s got to be about ten lines of conversation between, unequip slot and destroy and another ten before whatever’s left goes into the container with the give inventory. It doesn’t make sense. This is done with three separate scripts on three separate lines of conversation and works for everything else.

Like I said, it’s the give inventory that screws with things. You have to use CopyItem and DestroyObject instead, cause the ActionGiveItem function inside of ga_give_inventory is buggy. It may not seem buggy at first because it moves the items to the container, but then (that’s what happened to me) all kinds of weird things happened. When I used the CopyItem and DestroyObject functions instead everything went back from extremely weird behaviours to normal. So it has nothing to do with how many lines of dialogue between the scripts or that there are three separate scripts.

If you’re still in doubt, go back to my thread again and read what Shallina, kevL_s and Lance Botelle said about it: Move inventory - really weird bug - #32 by Lance_Botelle

andgalf… Unfortunately I don’t think this will help because that’s dealing with the whole inventory I just want to completely destroy two items and move what’s left of the inventory to a chest.

Alright, then do a ga_destroy first on those two items, then you can run my script. OR if you know the tags of the items, I can even include that in my script (EDIT: which I have now done)

I have a thing in there that doesn’t remove cursed items, but if you want to remove those too, then I can modify the script to accomodate for that.

Something like this could work then maybe?

void UnequipAll(object oFM)
{
	object o;
	int n;
	
	for (n = INVENTORY_SLOT_HEAD; n < INVENTORY_SLOT_CWEAPON_L; n++)
	{
		o = GetItemInSlot(n, oFM);
		if (!GetItemCursedFlag(o)) AssignCommand(oFM, ActionUnequipItem(o));
	}
}



void MoveItemsToChest(object oFM)
{
	object oContainer = GetObjectByTag("newpricrate");
	object oItem = GetFirstItemInInventory(oFM);
	
	object oItemtobedestroyed1 = GetObjectByTag("itemtobedestroyed1"); //replace with the tag of the item you want destroyed
	object oItemtobedestroyed2 = GetObjectByTag("itemtobedestroyed2"); //replace with the tag of the item you want destroyed

	while (GetIsObjectValid(oItem))
	{

		if(oItem == oItemtobedestroyed1)
		{
	
		DestroyObject(oItem);
		
		}
	
		else if(oItem == oItemtobedestroyed2)
		{
	
		DestroyObject(oItem);
	
		}	
	
		else if (!GetItemCursedFlag(oItem)) 
		{
		CopyItem(oItem,oContainer,TRUE);
		}		
			
		oItem = GetNextItemInInventory(oFM);
	}
	

}

void DestroyInventory(object oFM)
{

	object oItem = GetFirstItemInInventory(oFM);

	while (GetIsObjectValid(oItem))
	{
     if (!GetItemCursedFlag(oItem)) 
		{
		DestroyObject(oItem);
		}
			
		oItem = GetNextItemInInventory(oFM);
	}
	

}
				
void main(string sCompaniontag)
{


	object oCompanion = GetObjectByTag(sCompaniontag);
	
	UnequipAll(oCompanion);
	
	DelayCommand(0.2f, MoveItemsToChest(oCompanion));
	DelayCommand(0.5f, DestroyInventory(oCompanion));

			
	
}

andgalf… Thanks I’m going to have to make a separate copy module to test this in as my original one is getting very messed up at the moment with all this testing being done in the middle of it. I’ll see what happens.

1 Like

@Tsongo, I added a ClearAllActions line to the ga_equip_new_item script above. Maybe that will work.

1 Like

That kinda reminds me of an issue I had when I created the Valsharess outfit, when the belt and necklace didn’t show immediately.
To fix the issue, I basically forced the character to unequip and then re-equip the armor via the OnEquip script (i_objecttag_eq).

travus… Thanks, I’ll test it later when I get my testing hat back on again… I need a break from console commands.

4760… Chimneyfish’s sorceress outfit did the same and one of my companions kept showing up topless when she levelled up or changed clothes ! Taking off the belt and putting it back on fixed it… I put it in the module description, but I wonder how many people were actually concerned and did it ?

He he… that’s why I made it automatic

2 Likes

travus… Thank you, it worked with the clear all actions added. Your script will be named dated and is heading for the templates because she’s got her clothes on now when you find her.

I think it’s safe to say that your script has been well and truly tested and approved.

I’ve just got to try and remember what I did to be able to jump into the middle of a module and repair it now.

andgalf… I’ve yet to test your script as I went brutal and destroyed every instance of the two items no matter who or what had them using ga_destroy instead of ga_destroy_item which worked. Your script will get tested when I start another module on the first conversation so I can see what happens in one blank area with the full party intact and equipped.

1 Like