Custom Waypoints: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "Category:Take On Helicopters: Editing Custom waypoints are a new feature introduced in Take On Helicopters. It enables community coders to add a new waypoint with all it...")
 
m (Some wiki formatting)
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Take On Helicopters: Editing]]
{{TOC|side}}
Custom waypoints are a new feature introduced in {{GameCategory|tkoh|link= y}}.
It enables community coders to add a new waypoint with all its complex functionality to easily accessible [[Mission_Editor: Waypoints|waypoint menu]].


Custom waypoints are a new feature introduced in [[Take On Helicopters]]. It enables community coders to add a new waypoint with all its complex functionality to easily accessible [[Mission_Editor:_Waypoints|waypoint menu]].
Custom waypoints are a shell for already existing [[Mission Editor: Waypoints#Scripted|scripted waypoints]], where path to the executed script had to be typed in manually.
New system avoids using any abolute path and wraps all the functionality in simple-to-use user interface.


Custom waypoints are a shell for already existing [[Mission_Editor:_Waypoints#Scripted|scripted waypoints]], where path to the executed script had to be typed in manually. New system avoids using any abolute path and wraps all the functionality in simple-to-use user interface.
Note that when you select a custom waypoint, ''Script'' field changes to ''Arguments'', where you can pass additional data to the waypoint.
 
 
== List ==
 
{{Columns|4|
* [[BIS_fnc_wpLand TKOH|LAND]]
* [[BIS_fnc_wpTimed|COUNTDOWN]]
* [[BIS_fnc_wpCheckpoint|CHECKPOINT]]
* [[BIS_fnc_wpAngle|CIRCLE]]
* [[BIS_fnc_wpSteady|FLY STEADY]]
* [[BIS_fnc_wpFormation|FORMATION]]
* [[BIS_fnc_wpTransport|TRANSPORT]]
* [[BIS_fnc_wpWinchLoad|WINCH LOAD]]
* [[BIS_fnc_wpSlingLoadAttach|ATTACH SLINGLOAD]]
* [[BIS_fnc_wpSlingLoadDetach|DETACH SLINGLOAD]]
* [[BIS_fnc_wpSlingLoadDrop|DROP SLINGLOAD]]
* [[BIS_fnc_wpFastRope|FAST-ROPE]]
* [[BIS_fnc_wpAerobatics|AEROBATICS]]
* [[BIS_fnc_wpRestricted|RESTRICTED]]
* [[BIS_fnc_wpHover|HOVER]]
}}


Notice when you select a custom waypoint, ''Script'' field changes to ''Arguments'', where you can pass additional data to the waypoint.


== Config ==
== Config ==
class cfgWaypoints
 
{
<syntaxhighlight lang="cpp">
{{codecomment|//--- Waypoints category class}}
class CfgWaypoints
class HSim
{
{
//--- Waypoints category class
{{codecomment|//--- Waypoints category description (visible in menu)}}
class HSim
displayName = $STR_HSIM_cfgWaypoints_HSim;
{
//--- Waypoints category description (visible in menu)
{{codecomment|//--- Waypoint class}}
displayName = "$STR_HSIM_cfgWaypoints_HSim";
class wpLand
 
{
//--- Waypoint class
{{codecomment|//--- Waypoint description (visible in menu)}}
class wpLand
displayName = "Land";
{
//--- Waypoint description (visible in menu)
{{codecomment|//--- Path to executed scripts}}
displayName = "Land";
file = hsim\Modules_H\functions\waypoints\fn_wpLand.sqf;
 
};
//--- Path to executed scripts
};
file = "hsim\Modules_H\functions\waypoints\fn_wpLand.sqf";
};
};
};
};
</syntaxhighlight>
 


== Scripts ==
== Scripts ==
By default, all official waypoints are executing [[Functions_Library_(Take_On_Helicopters)|functions]] that can be also called manually, outside of waypoint structure. To achieve it, all of these functions are [[PreProcessor_Commands#.23include|including]] custom header, which recognizes execution type and initializes params correctly:
 
#include "\HSim\Modules_H\functions\Waypoints\variableSettings.hpp"
By default, all official waypoints are executing [[Take On Helicopters: Functions Library|Functions]] that can be also called manually, outside of waypoint structure.
To achieve it, all of these functions are [[PreProcessor Commands#.23include|including]] custom header, which recognises execution type and initialises params correctly:
<syntaxhighlight lang="cpp">
#include "\HSim\Modules_H\functions\Waypoints\variableSettings.hpp"
</syntaxhighlight>


=== Execution Methods ===
=== Execution Methods ===


==== Waypoint (Editor)====
==== Waypoint (Editor) ====
[[File:tkoh editor waypoints custom.jpg|thumb|Custom waypoint settings]]
[[File:tkoh editor waypoints custom.jpg|thumb|Custom waypoint settings]]
Default use. Waypoint is selected in menu, arguments are typed in ''Arguments'' field (see attached picture).
Default use. Waypoint is selected in menu, arguments are typed in ''Arguments'' field (see attached picture).
Line 41: Line 72:


For example, for [[BIS_fnc_wpTimed]] (COUNTDOWN), it can look like this:
For example, for [[BIS_fnc_wpTimed]] (COUNTDOWN), it can look like this:
[{[[hintC]] "You failed!"},60,[[true]]]
<sqf>[{ hintC "You failed!" }, 60, true]</sqf>
If no arguments are set, default values are used.
If no arguments are set, default values are used.


 
==== Waypoint (Script) ====
==== Waypoint (Script)====
Attach function to given waypoint. Function waits until waypoint becomes active
Attach function to given waypoint. Function waits until waypoint becomes active
  [group,id,<arguments>] [[spawn]] <functionName>;
  [group,id,<arguments>] [[spawn]] <functionName>;
* group: [[Group]]
* '''group''': [[Group]]
* id: [[Number]] - [[Waypoint]] id
* '''id''': [[Number]] - [[Waypoint]] id
Code is [[scriptDone|done]] when waypoint conditions were met.
Code is [[scriptDone|done]] when waypoint conditions were met.


==== Function ====
==== Function ====
Run function with given params.
Run function with given params.
  [object,target,completionRadius,<arguments>] [[spawn]] <functionName>;
  [object,target,completionRadius,<arguments>] [[spawn]] <functionName>;
* object: [[Object]]
* '''object''': [[Object]] - object to which waypoint belongs
* target: [[Array]] or [[Object]]
* '''target''': [[Array]] or [[Object]] - position or target where waypoint is placed
* completionRadius: [[Number]]
* '''completionRadius''': [[Number]] - completion radius in which waypoint is finished
* '''<arguments>''' - arguments specific for every waypoint type
Code is [[scriptDone|done]] when waypoint conditions were met.
Code is [[scriptDone|done]] when waypoint conditions were met.


==== Action ====
==== Action ====
Executed by [[addAction]] command.
Executed by [[addAction]] command.
  OBJECT addaction [
  OBJECT [[addAction]] [
  "Action Name",
  "Action Name",
  "<functionName>" [[call]] [[BIS_fnc_functionPath]],
  "<functionName>" [[call]] [[BIS_fnc_functionPath]],
Line 85: Line 114:
* '''_isExpired''': [[Code]] - code for checking if waypoint is still valid. Exit when true in every loop. Always false for Function and Action execution
* '''_isExpired''': [[Code]] - code for checking if waypoint is still valid. Exit when true in every loop. Always false for Function and Action execution
* '''_fnc_addRating''': [[Code]] - adds rating to all waypoint group members. Passed argument is [[Number]] - added rating, later multiplied by bis_wpRating
* '''_fnc_addRating''': [[Code]] - adds rating to all waypoint group members. Passed argument is [[Number]] - added rating, later multiplied by bis_wpRating
{{GameCategory|tkoh|Editing}}

Latest revision as of 21:27, 23 April 2024

Custom waypoints are a new feature introduced in Take On Helicopters. It enables community coders to add a new waypoint with all its complex functionality to easily accessible waypoint menu.

Custom waypoints are a shell for already existing scripted waypoints, where path to the executed script had to be typed in manually. New system avoids using any abolute path and wraps all the functionality in simple-to-use user interface.

Note that when you select a custom waypoint, Script field changes to Arguments, where you can pass additional data to the waypoint.


List


Config

class CfgWaypoints
{
	//--- Waypoints category class
	class HSim
	{
		//--- Waypoints category description (visible in menu)
		displayName = "$STR_HSIM_cfgWaypoints_HSim";

		//--- Waypoint class
		class wpLand
		{
			//--- Waypoint description (visible in menu)
			displayName = "Land";

			//--- Path to executed scripts
			file = "hsim\Modules_H\functions\waypoints\fn_wpLand.sqf";
		};
	};
};


Scripts

By default, all official waypoints are executing Functions that can be also called manually, outside of waypoint structure. To achieve it, all of these functions are including custom header, which recognises execution type and initialises params correctly:

#include "\HSim\Modules_H\functions\Waypoints\variableSettings.hpp"

Execution Methods

Waypoint (Editor)

Custom waypoint settings

Default use. Waypoint is selected in menu, arguments are typed in Arguments field (see attached picture).

Arguments are passed as Array, whose content differs for every waypoint.

For example, for BIS_fnc_wpTimed (COUNTDOWN), it can look like this:

[{ hintC "You failed!" }, 60, true]

If no arguments are set, default values are used.

Waypoint (Script)

Attach function to given waypoint. Function waits until waypoint becomes active

[group,id,<arguments>] spawn <functionName>;

Code is done when waypoint conditions were met.

Function

Run function with given params.

[object,target,completionRadius,<arguments>] spawn <functionName>;
  • object: Object - object to which waypoint belongs
  • target: Array or Object - position or target where waypoint is placed
  • completionRadius: Number - completion radius in which waypoint is finished
  • <arguments> - arguments specific for every waypoint type

Code is done when waypoint conditions were met.

Action

Executed by addAction command.

OBJECT addAction [
	"Action Name",
	"<functionName>" call BIS_fnc_functionPath,
	<arguments>,
	...
];

Header Variables

Header declares local variables, which can be used by waypoint script:

  • _params: Array - passed arguments
  • _group: Group
  • _wp: Array - assigned waypoint (current waypoint for Function and Action activation)
  • _wpID: Number - waypoint ID
  • _wpPos: Array - waypoint position
  • _target: Object - waypoint target. objNull if none was set (e.g. when position is used only)
  • _veh: Object - vehicle of group leader
  • _completionRadius: Number - waypoint completion radius (Default: 420 m)
  • _statements: Array - waypoint statements (Default: ["true","",""])
  • _condition: Code - waypoint condition from _statements (Default: {true})
  • _isExpired: Code - code for checking if waypoint is still valid. Exit when true in every loop. Always false for Function and Action execution
  • _fnc_addRating: Code - adds rating to all waypoint group members. Passed argument is Number - added rating, later multiplied by bis_wpRating