Jump to content
Sign in to follow this  
madrussian

setWaypointName quandary (+ advanced WP idea)

Recommended Posts

Hey all, for my AI system I'd like to store some (additional) info on a group's WP (see the P. S. below for why), and don't necessarily see a dedicated command for that.  (I do see setWaypointStatements, which is for condition and activation so doesn't necessarily fit the bill.)

 

Meanwhile, I had this idea to use setWaypointName / waypointName for this purpose, as I don't seem to recall ever seeing any "waypoint name" showing up in-game in A3.  Wondering if "waypoint name" can be made to show up in-game in A3?  Otherwise, perhaps "waypoint name" is basically an old concept that is now unused?  I tried several things in editor to see and haven't managed to display "waypoint name" yet... which makes me think it may very well be unused.  Perhaps I'm just missing a setting though, etc.

 

Anyone know something about this?  Thanks!

 

P. S. My plan is to make a scripted solution so that user code triggers once as soon as a group starts working on a new WP.  Again we have setWaypointStatements which covers condition (which gets checked repeatedly, and only once unit is in range) and statement (which runs upon condition being fulfilled) but no command that directly sets up code to run one time upon group starting work on a new WP (and regardless of range).

Share this post


Link to post
Share on other sites
1 hour ago, RCA3 said:

How about using WaypointComplete EH, and as soon that triggers, you know the next WP was activated, unless there's a timeout but you can check the waypointTimeout/waypointTimeoutCurrent through the EH _waypointIndex?

 

Very nice indeed.  Cool, looks like there's lots of ways to skin this.

 

I wish there was a way to store data on a WP too though (outside the condition and activation strings), like via setVariable or similar.  In my particular use case, player is selecting group icons and/or icons of those groups' WPs on main map and then pressing KB shortcut buttons to Add WP, Delete WP, and/or Delete All WPs.  Also drag/dropping the WPs.  If all the WPs are essentially the same, likely many approaches (inc WaypointComplete EH) would potentially work.  If some WPs are special for one reason or another, then it still seems important to be able to record specifics to each WP, in a string (like waypointName) or similar.  That way when new WPs are added and/or deleted, the info on each remaining WP persists.

 

Ok still curious then, anyone know if "waypoint name" can be made to show up in-game in A3? (or is otherwise unused?)

 

Also regarding WaypointComplete EH, would be nice if we had events for new WP being added, deleted, or moved too.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, madrussian said:

Also regarding WaypointComplete EH, would be nice if we had events for new WP being added, deleted, or moved too.

You'll only get lucky going on Discord and ask Dedmen or Killzone Kid for it for the next update (circa 6 months).

Share this post


Link to post
Share on other sites
On 11/9/2023 at 5:48 AM, madrussian said:

Ok still curious then, anyone know if "waypoint name" can be made to show up in-game in A3? (or is otherwise unused?)

 

I think it's displayed for players when the waypoint is for their group and they have 3d markers for waypoints enabled in the difficulty options.

 

On 11/9/2023 at 5:48 AM, madrussian said:

I wish there was a way to store data on a WP too though (outside the condition and activation strings), like via setVariable or similar. 

 

Remember waypoints are just an array of [ group ref, waypoint index ]. We can use this to setVariable into the group to store extra data. We just have to remember to manage the data whenever we delete waypoints since that reindexes the waypoints array.

 

Something like this.

Note: Untested due to silly things like work and stuff 😛

// I skipped error checks since this is just an example

// Macro for the variable names
#define WP_DATA_VAR(ind) ( "TAG_wpData_" + str (ind) )

// Setter: [_wp, _data] call TAG_fnc_setWaypointData;
TAG_fnc_setWaypointData = {
	params ["_wp", "_data"];
	_wp params ["_grp", "_index"];
	
	_grp setVariable [ WP_DATA_VAR( index ), _data ];
};

// Getter: _wp call TAG_fnc_getWaypointData;
TAG_fnc_getWaypointData = {
	params ["_grp", "_index"];
	
	_grp getVariable WP_DATA_VAR( index );
};

// Since waypoints are reindexed when one is deleted we need to call this after a waypoint is removed.
// This could be extended to support deleting multiple waypoints in one call fairly easily
// _deletedWp call TAG_fnc_deleteWaypointData;
TAG_fnc_deleteWaypointData = {
	params ["_grp", "_index"];
	private _n = count waypoints _grp;

	// Update data by shifting them down a step
	for "_i" from _index to _n-1 do {
		// Move data from the higher index to the lower
		private _var0 = WP_DATA_VAR( _i );
		private _var1 = WP_DATA_VAR( _i + 1 );
	
		_grp setVariable [ _var0, _grp getVariable _var1 ];
	}
};

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×