Making companions jump

I’ve got a bit of an issue involving ga_roster_party_remove and ga_jump from a conversation. I can remove the companions but they don’t jump they just disappear right in front of you in the cutscene and they’re not finishing where they should be.

I was removing them, then jumping them but obviously it doesn’t work so can I jump them before removing them ? I thought you can jump anybody anywhere, companion or npc but it seems that you can’t.

You can, but jump is an action that can be cancelled or overwritten by an other action, like a player input, or IA in game.

You need to clearallactions(TRUE) and if you want to keep them in the party you need to root them or do something so they won’t run back to the player controlled character.

Also they won’t jump is they are freezed, rooted or whatever. there is actionjump which in at the end of the queeu, and jump that is put on top of tue queeu of actions.

1 Like

That’s odd. That should work. I mean, jumping is them disappearing of course, if they are jumping to another area, or in the same area too, actually, but it sounds weird that they don’t end up where they should be. How is the whole thing set up? Are the one jumping the owner of the conversation? Maybe there’s some glitch with that. I’ve never had any problems with this kind of thing (I think), at least I don’t remember it ever being a problem. In the module I’m working on now I have a script where at the end of the conversation all the party members are removed and jumps to different waypoints as well as the PC, and it never fails for me.

EDIT: Maybe I could do a custom script for you?

EDIT2: Here’s a modification of my script (can’t take all the credit since it’s based on two original scripts by kevL_s and travus). I tested it ingame and it works for me, so I think it should work for you too. It removes the companion from the roster and then teleports him/her to a new waypoint. Put the script at the end node of a conversation:

const string sDEST_COMPANION = "companion_wp"; // waypoint tag of the Companions' destination

void main()
{
    object oPC = GetPCSpeaker();
			
    object oDestCompanion = GetWaypointByTag(sDEST_COMPANION);

    string sRoster;

    object oFaction = GetFirstFactionMember(oPC, FALSE);
    while (GetIsObjectValid(oFaction))
    {
        sRoster = GetRosterNameFromObject(oFaction);
		
		if (sRoster == "companiontag")
        {
            
           if (GetIsPC(oFaction))
                SetOwnersControlledCompanion(oFaction);

            RemoveRosterMemberFromParty(sRoster, oPC, FALSE);

            AssignCommand(oFaction, ClearAllActions());
            AssignCommand(oFaction, JumpToObject(oDestCompanion));


            oFaction = GetFirstFactionMember(oPC, FALSE);
		}	
		

	
        else
            oFaction = GetNextFactionMember(oPC, FALSE);
    }

    
}

Shallina… Thank you that explains a lot, I was also wondering why they don’t move out of the way and keep coming back when they are in the party. I’ve got them leaving now using the ga_hangout set and go to scripts. But they still wont go off to their waypoints to disappear from !

andgalf… Your post arrived as I was replying to Shallina. What happens is…

1st conversation… One companion walks off, but doesn’t because she comes back !

2nd conversation… The companion that was supposed to be on the other side of the room, leaves the party and goes to her waypoint ( this bit works fine )

3rd conversation… Next companion walks off to another part of the tavern ( but doesn’t leave ! ) she then gets stripped ( fine and things in right place ), given an outfit ( doesn’t work she’s naked ) and goes to her waypoint which works fine.

Last companion… Stripped and jumped to waypoint, no problem all works because he never walks off and he’s not naked without armour on.

This is the script for the equipping of the naked companion and it’s taken from one of yours it compiles but does nothing.

	Chopped up script by andgalf with excerpts from a script by travus,saving my brain once again 4/9/21.
*/

void main(string sCompaniontag)
{
	object oPC = GetFirstPC();

	object oCompanion = GetObjectByTag(sCompaniontag);
	
	CreateItemOnObject("reaper_outfit",oCompanion,1,"reaper_outfit",FALSE);
	
	object oItem = GetObjectByTag("reaper_outfit");
	
DelayCommand(0.2, AssignCommand(oCompanion, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST)));

}

I can’t get the whole script in a box it all went mad ! Thanks for your one ( masterfully looking neat and tidy in the right sort of box ) but I’m alright as it is at the moment apart from naked companions and ones that are stuck to the player when they should be walking off for a bit ( still in party just elsewhere ).

edit… Fixed the script thanks andgalf !

To get the script in a box I always do like this:

(Can’t get the explanation to show up right, one moment)

At the front of the box I write ```C and then I write ``` at the end
1 Like

That sounds like she hasn’t left the party. If she’s still part of the party she runs back because…well, that’s the way the game wants it, I believe.

So here there are no problems then? Or…?

So here the problem is that she doesn’t equip the item/armor? Have you checked the tag of the armor so that’s correct?
EDIT: Could it be that you have several scripts after one another here with the walking and stuff? It could be that the jumping interupts the equipping of armor here. When it’s a sequence of scripts like these I always tend to create a new script with everything gathered so that I have control in which order things happen with delays and whatnot.

EDIT2: I’m trying to make a new script for you. Just a few moments…

andgalf… The equipping of the naked companion is a long time after she’s supposed to walk off but doesn’t. Her inventory is stripped way before she’s supposed to be equipped.

I’ve made a duplicate area of the tavern next door to the original where the player is so I can run a cutscene without the party in it. The last two companions are stripped, equipped and jumped off camera. This is done bit by bit very slowly as the cutscene progresses. The tag, and resource name of the item are fine, it’s also clothing that anyone can wear, it just doesn’t get worn.

Ok. When trying to do this script: In which order exactly do you need things to happen (just so I understand perfectly)?

Here’s a script now (untested but maybe could work, probably could use some adjustments):

const string sDEST_COMPANION = "companion_wp"; // waypoint tag of the Companions' destination

void WalkToWP(string sCompanion, int nRun)
{
	
	object oWP = GetObjectByTag("walkingtowaypoint");
	object oCompanion = GetObjectByTag(sCompanion);
	AssignCommand(oCompanion, ClearAllActions()); 
	AssignCommand(oCompanion, ActionForceMoveToObject(oWP, nRun));


}

void Stripping(object oCompanion)
{

	object o;
	int n;
	
	for (n = INVENTORY_SLOT_HEAD; n < INVENTORY_SLOT_CWEAPON_L; n++)
	{
		o = GetItemInSlot(n, oCompanion);
	
	}
}	

void EquipCompanion(object oCompanion)
{

CreateItemOnObject("reaper_outfit",oCompanion,1,"reaper_outfit",FALSE);

object oItem = GetObjectByTag("reaper_outfit");

DelayCommand(0.2, AssignCommand(oCompanion, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST)));	

}

void Jumpthecompanion(object oCompanion)
{

AssignCommand(oCompanion, ClearAllActions());
object oDestCompanion = GetWaypointByTag(sDEST_COMPANION);
AssignCommand(oCompanion, JumpToObject(oDestCompanion));	

}

void main()
{
    object oPC = GetPCSpeaker();
			
    object oDestCompanion = GetWaypointByTag(sDEST_COMPANION);

    string sRoster;

    object oFaction = GetFirstFactionMember(oPC, FALSE);
    while (GetIsObjectValid(oFaction))
    {
        sRoster = GetRosterNameFromObject(oFaction);
		
		if (sRoster == "companiontag")
        {
            
           if (GetIsPC(oFaction))
                SetOwnersControlledCompanion(oFaction);

            RemoveRosterMemberFromParty(sRoster, oPC, FALSE);

            


            oFaction = GetFirstFactionMember(oPC, FALSE);
		}	
		

	
        else
            oFaction = GetNextFactionMember(oPC, FALSE);
    }

	object oCompanion = GetObjectByTag("companiontag");
	
	DelayCommand(0.2, WalkToWP("companiontag",1));
	DelayCommand(5.0, Stripping(oCompanion));
	DelayCommand(6.0, EquipCompanion(oCompanion));
	DelayCommand(6.5, Jumpthecompanion(oCompanion));
	
    
}

EDIT: I tested it ingame and I think everything works. You’ll maybe need to adjust the delays a bit.

1 Like

andgalf… Thanks for the script I’m going to chop it up a bit and make separate scripts because I can’t do this all at once. I can’t move a companion, strip them as they walk off and then make them disappear in the middle of a conversation when they are in full view.

I’ll see what happens and get back to you in a bit.

I think the chopping up might cause problems, that’s why I made this script but…ok. Try it out on your end.
If you could tell me exactly how you want it to play out, and in what order, I think I can adjust the script for you. For now I’m too tired though. I have to go to bed now. It’s late here where I live (almost 1 o’clock in the morning). I’ll check by here tomorrow and try and help out some more if I can.

andgalf… You’re right the chopping up doesn’t work at all !

All I need is two scripts, one to make a companion definitely walk off and one to equip them. The jumping and stripping already work fine separately.

It’s just that it looks silly when someone says they have to go and don’t or when you find them they’re naked !

I’ve done the moving part, not very glamorously but it works. I jumped the first companion straight to her hangout as soon as she said she was going to see someone and later jumped the second one into a locked room so she’s not hanging around having said she’s going somewhere.

Only issue now is the naked companion ! She still wont put her clothes on !

One other minor thing is one companion’s got creature properties and they get put in her chest when she gets stripped, how can I get around that I don’t really want anybody to be able to use them and you can’t set them for a specific class.

I’m assuming the item has no restrictive properties preventing the armor from being equipped.
I’m curious to see if this will work for equipping the item. It’s an All-In-One create and equip script:

// ga_equip_new_item
/*
	Creates a new item on a creature and then equips it.

	sCreatureTag = the tag of the creature to create the item on. If blank, the OWNER will be used.		
	sResRef = the Template ResRef of the item to create.
	nSlot = the inventory slot to equip the item to. 
	bDestroyPrevious = 	0 (FALSE) DEFAULT - Any item already in that slot will be moved to their inventory.
						1 (TRUE) - Any item already in that slot will be destroyed first. 
	
	HEAD      = 0
	CHEST     = 1
	BOOTS     = 2
	ARMS      = 3
	RIGHTHAND = 4
	LEFTHAND  = 5
	CLOAK     = 6
	LEFTRING  = 7
	RIGHTRING = 8
	NECK      = 9
	BELT      = 10
	ARROWS    = 11
	BULLETS   = 12
	BOLTS     = 13
	
	CWEAPON_L = 14	creature left claw
	CWEAPON_R = 15	creature right claw
	CWEAPON_B = 16	creature bite
	CARMOUR   = 17	creature skin
*/

#include "ginc_item"
#include "ginc_param_const"

void main(string sCreatureTag, string sResRef, int nSlot, int bDestroyPrevious=FALSE)
{
	object oTarget = GetTarget(sCreatureTag);

	AssignCommand(oTarget, ClearAllActions());	 
	EquipNewItem(oTarget, sResRef, nSlot, bDestroyPrevious);
}
1 Like

So the walking off works now then? I’m not sure I understand you correctly here. Do you still need a “definitely walk off” script?

I am curently running into a similar 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

RIGHTHAND = 4
and

LEFTHAND  = 5

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 ?

andgalf… Thanks but I’m not doing a walk off now it’s too much hassle, I’m just jumping the companion into a locked room and the other one’s just going straight to the hangout.

travus… Testing it now and crossing fingers !

Shallina… I have an issue similar to this when a companion should get dressed in a disguise but wont put it all on. Sometimes she does and sometimes she doesn’t. If you click her when she’s not wearing it ( or part of it ) she puts it on so it is definitely there and if she is the owner of the conversation she swaps it perfectly.

It could be something to do with it happening but you can’t see it unless you control the person or they are in control.

Alright. Then travus should be able to help you (I bet his script will work. His scripts almost always do). He’s 10000 times better at scripting than I am.

1 Like

andgalf… You’d have lost your money, the script didn’t work. I’m going to test it in different situations and see what happens.

OK here’s a puzzle…

If I run the script from the console with exactly the same parameters before the companion goes to her hangout she put the outfit on.

If I run the script when I find her naked later in her hangout she puts the outfit on.

It seems that fast traveling to a hangout tears your clothes off and destroys them !

Since yesterday I’ve trashed my module doing this, opened doors, put people in places they shouldn’t be in at the start, typed loads into the console to adjust things, wiped out blockers and moved waypoints to test this thing.

She’s staying naked ! It’s not like anybody hasn’t seen her do it before.

I will run travus’ script from a conversation when you find her again, if she appears with nothing on I’ll change the conversation to suit it.

This is probably the most complicated thing I’ve ever done in a module and now know never to do this sort of thing again.

Oh? I’m surprised. :open_mouth: His scripts usually work.

EDIT: I wrote this at the same time as your previous post so now I know more after you explained things. :slightly_smiling_face: