Question about modifying ga_move

Maybe I’m lazy now, but I would like to alter the ga_move script so that an npc first moves to one waypoint, and directly after arriving there, continues to another waypoint. Similar to when you create a waypoint set. Is there an easy way to do this by scripting, or would you have to do a lot of tiresome timing things for it to work. The ga_move stock script looks like this:

// ga_move
/*
    This moves someone to a waypoint.
        sWP             = Lists the waypoint the object is moving to. 
        nRun            = Defaults to walk, set to 1 for running
        sTagOverride    = If this is null, then OWNER runs the script. Otherwise the string is the
                          tag name of who will run it
*/
// FAB 10/5
// ChazM 6/22/05 - changed to GetTarget()
// ChazM 9/9/05	- modifed waypoint look up to also look for sWP w/o prepending "wp_"
		
#include "ginc_param_const"

void main(string sWP, int nRun, string sTagOverride)
{

    object oTarg = OBJECT_SELF;
    object oWP = GetObjectByTag( "wp_" + sWP );
	if (!GetIsObjectValid(oWP))
		oWP = GetObjectByTag(sWP );
	if (!GetIsObjectValid(oWP))
	{
		PrintString("WARNING - ga_move: couldn't find waypoint: " + sWP);	
		return;
	}

    if ( sTagOverride != "" ) 
		oTarg = GetTarget(sTagOverride);

    AssignCommand(oTarg, ActionForceMoveToObject(oWP, nRun));

}

Should I perhaps do a small trigger around the first waypoint, that when you arrive there the npc immediately walks to the next waypoint?

You could either used back-to-back ‘ga_move’ scripts on the same node, each with a different waypoint tag - or you could use this custom move chain script:

// ga_move_waypoint_chain
/*
	This moves someone to multiple waypoints.
		sWP1 			= The first waypoint the object is moving to.
		sWP2 			= The second waypoint the object is moving to. 
		sWP3 			= The third waypoint the object is moving to. 
		sWP4 			= The fourth waypoint the object is moving to. 				
		nRun 			= Defaults to walk, set to 1 for running.
		sTagOverride	= If this is null, then OWNER runs the script. Otherwise the string is the
						tag name of who will run it.
*/
		
#include "ginc_param_const"

void main(string sWP1, string sWP2, string sWP3, string sWP4, int nRun, string sTagOverride)
{
	object oTarg = OBJECT_SELF;

	if (sTagOverride != "") oTarg = GetTarget(sTagOverride);
    
	AssignCommand(oTarg, ActionForceMoveToObject(GetObjectByTag(sWP1), nRun));
	AssignCommand(oTarg, ActionForceMoveToObject(GetObjectByTag(sWP2), nRun));
	AssignCommand(oTarg, ActionForceMoveToObject(GetObjectByTag(sWP3), nRun));
	AssignCommand(oTarg, ActionForceMoveToObject(GetObjectByTag(sWP4), nRun));
}
1 Like

Do you mean writing like this?

Or perhaps you mean like this?

Like this one:

1 Like

Ok. It was that simple after all. Thank you, @travus!

1 Like