VN_ms_fnc_aiHeliTransportSkip

From Savage Game Design Wiki
Revision as of 21:14, 20 January 2021 by Lou Montana (talk | contribs) (Text replacement - "]]; |p1n=" to "]] |p1n=")
Jump to navigation Jump to search
← back to Functions Introduced in S.O.G. Prairie Fire v1.00
by Wyqer, veteran29
Argument(s): n/a
Effect(s): unknown

Description

/*
    Author: Wyqer, veteran29
    Date: 2020-02-28

    Description:
        Skip AI insertion travel.

    Parameter(s):
        _group - Group doing the insertion [GROUP, defaults to grpNull]

    Returns:
        Function reached the end [BOOL]
*/

if (!canSuspend) exitWith {
    _this spawn (missionNamespace getVariable _fnc_scriptName);
};

params [
    ["_group", grpNull, [grpNull]],
    ["_delay", 0, [0]]
];

private _vehicle = vehicle leader _group;

private _canSkip = _vehicle getVariable ['vn_aiHeliTransport_canSkip', false];
_vehicle setVariable ['vn_aiHeliTransport_canSkip', false, true];
if (!_canSkip) exitWith {};

private _playerCrew = (crew _vehicle select {isPlayer _x});
[[localize "STR_VN_MISSIONS_MISC_TELEPORTTITLE", "BLACK", 1]] remoteExec ["titleText", _playerCrew];

sleep 3 + _delay;

private _synchronizedGroups = synchronizedObjects leader _group apply {group _x};
{
    [_x, 8 * (_forEachIndex+1)] spawn (missionNamespace getVariable _fnc_scriptName);
} forEach _synchronizedGroups;

private _routeWps = _group getVariable ["vn_aiHeliTransport_routeWps", []];
// get last route waypoint (or LZ if no route)
private _lastWp = nil;
if (_routeWps isEqualTo []) then {
    _lastWp = [_group, currentWaypoint _group];
} else {
    _lastWp = _routeWps deleteAt (count _routeWps - 1);
};

private _skipPos = waypointPosition _lastWp;
_skipPos set [2, 50];

// skip waypoints
private _firstRouteWp = _routeWps select 0;
{
    // the waypoint index decrements with every deleted WP
    // So we're always deleting currently first WP of the route
    deleteWaypoint _firstRouteWp;
} forEach _routeWps;

private _velocity = velocityModelSpace _vehicle;
// move vehicle
(Placeholder description extracted from the function header by LM_exportFunctionsToWiki.sqf)

Syntax

Syntax
[] call vn_ms_fnc_aiHeliTransportSkip
Return value
Nothing

Examples

Example 1
-