top of page

MAKE TELEPORTS POINTS

Thanks to Babast from FOXCOM TEAM for this script

To make teleport points, follow this process :

STEP 1 - Create folder named "BAS_teleport" in your mission folder (exemple : your_mission\BAS_teleport

STEP 2 - Create a file text file in your mission folder (not BAS_teleport) and past the follow code :


/* Prevent script injection */
inGameUISetEventHandler ["PrevAction", ""];
inGameUISetEventHandler ["Action", ""];
inGameUISetEventHandler ["NextAction", ""];

/* Compile basstard's revive */
call compileFinal preprocessFileLineNumbers "BAS_teleport\BAS_teleportInit.sqf";

 

Save as init.sqf
 

STEP 3 - In the "BAS_teleport" folder, make file named BAS_teleportFunctions.sqf and past this :

/******************************************************************************************
 * This work is licensed under the APL-SA. Copyright © 2016 basstard @ BI Forums          *
 ******************************************************************************************
    Author :         basstard
    Date :             24/08/2016 (jj/mm/aaaa)
    Version :         0.1
   
    Description :    Functions collection for basstard's teleport functionnalities

    Usage :            N/A
   
    Syntax :        N/A
   
    Parameters :    None
*/


/******************************************************************************************
    Description :    Function to call from trigger's onAct. field
    Syntax :        0 = [thisTrigger, thisList] call BAS_fnc_callFromTrigger;
    Parameters :    None
    Return :        None
*******************************************************************************************/
BAS_fnc_callFromTrigger =
{
    private ["_trigger", "_playerList"];

    _trigger = _this select 0;
    _playerList = _this select 1;

    if (isServer || isDedicated) then
    {
        {
            if ((isPlayer _x) && (!(_x getVariable ["BAS_isTeleported", false]))) then
            {
                _x setVariable ["BAS_isTeleported", true, true];
                [_x, _trigger] remoteExec ["BAS_fnc_teleportServer", 2, false];
                [_x, _trigger] remoteExec ["BAS_fnc_teleportClient", [0,-2] select isDedicated, false];
            };
        } forEach _playerList;
    };
};


/******************************************************************************************
    Description :    Function to handle teleport request server side
    Syntax :        [unit, trigger] spawn BAS_fnc_teleportServer;
    Parameters :    Unit: Object
                    Trigger: Object
    Return :        None
*******************************************************************************************/
BAS_fnc_teleportServer =
{
    private ["_unit", "_trigger", "_markerPos"];
   
    _unit = _this select 0;
    _trigger = _this select 1;
       
    if (isServer || isDedicated) then
    {
        /* Make player invisible */
        _unit hideObjectGlobal true;

        /* Wait for effective teleportation */
        waitUntil
        {
            sleep 0.1;
            !(_unit inArea _trigger)
        };

        /* Make player visible again */
        _unit hideObjectGlobal false;
        _unit setVariable ["BAS_isTeleported", false, true];
    };
};


/******************************************************************************************
    Description :    Function to handle teleport request client side
    Syntax :        [unit, trigger] spawn BAS_fnc_teleportClient;
    Parameters :    Unit: Object
                    Trigger: Object
    Return :        None
*******************************************************************************************/
BAS_fnc_teleportClient =
{
    private ["_unit", "_trigger", "_markerPos", "_playerPos"];
   
    _unit = _this select 0;
    _trigger = _this select 1;
    _markerPos = [];
   
    if (local _unit) then
    {
        /* Disable damages and freeze unit */
        _unit allowDamage false;
        disableUserInput true;

        /* Get marker position from associated trigger */
        _markerPos =
        {
            if (_x select 0 == _trigger) exitWith
            {
                getMarkerPos (_x select 1)
            }
        } count BAS_teleportLocationsList;
       
        /* Check for empty position */
        if (_markerPos isEqualTo []) then
        {
            /* Show error screen */
            titleText ["ERROR EMPTY POSITION", "BLACK IN", 5];
        }
        else
        {
            /* Proceed to teleportation */
            titleText ["You are going to the location, please wait...", "BLACK FADED", 1];
//            _playerPos = [_markerPos,5,10,2,0,0,0] call BIS_fnc_findSafePos;
//            waitUntil {sleep 0.1; preloadCamera _markerPos};
//            waitUntil {!isNil "bis_fnc_init" && {bis_fnc_init}};
//            _unit setPos _playerPos;
            _unit setPos _markerPos;
            waitUntil { sleep 0.1 ; !isObjectHidden _unit };
            titleText ["", "BLACK IN", 5];
        };

        /* Enable damages and unfreeze unit */
        disableUserInput false;
        _unit allowDamage true;
    };
};

Save file

STEP 4 - In the "BAS_teleport" folder, create a file BAS_teleportInit.sqf and past the following code :

 

Note : see step 5 just below to change locations, dont hesitate to add or remove teleportations area, in following this :

[trigger_name,"spawn_point_name"]

You can already modify teleportations points here, you have just to have BAS_teleportInit.sqf to modify to add or remove location, not others files


/******************************************************************************************
 * This work is licensed under the APL-SA. Copyright © 2016 basstard @ BI Forums          *
 ******************************************************************************************
    Author :         basstard
    Date :             24/08/2016 (jj/mm/aaaa)
    Version :         0.1
   
    Description :    Initialization of basstard's teleport context

    Usage :            This script is called from init.sqf
   
    Syntax :        call compileFinal preprocessFileLineNumbers "BAS_teleportInit.sqf";
   
    Parameters :    None
*/


/* Global var that can be tweaked */
BAS_teleportLocationsList =
[
    [
trigger1,"nuclear_plant"],
    [
trigger2,"prip_1"],
    [
trigger3,"yanov"],
    [
trigger4,"pripyat2"]
];    // list of teleport locations, it consists of arrays of trigger name associated to a marker name

/* Compile functions linked to revive functionnalities */
call compile preprocessFileLineNumbers "BAS_teleport\BAS_teleportFunctions.sqf";

/* Make teleportation markers invisible on the map */
[] spawn
{
    {
        (_x select 1) setMarkerAlpha 0;
    } forEach BAS_teleportLocationsList;
};



Save file

STEP 5 - In the editor, open your mission and place trigger, name this trigger trigger1, and make spawn point (empty marker) named nuclear_plant somewhere, out of your trigger

In your trigger, on activation, past this :

0 = [thisTrigger, thisList] call BAS_fnc_callFromTrigger;

In the editor, open your mission and place trigger, name this trigger trigger2, and make spawn point (empty marker) named prip_1 somewhere, out of your trigger

In your trigger, on activation, past this :

0 = [thisTrigger, thisList] call BAS_fnc_callFromTrigger;

In the editor, open your mission and place trigger, name this trigger trigger3, and make spawn point (empty marker) named yanov somewhere, out of your trigger

In your trigger, on activation, past this :

0 = [thisTrigger, thisList] call BAS_fnc_callFromTrigger;

 

 

In the editor, open your mission and place trigger, name this trigger trigger4, and make spawn point (empty marker) named pripyat2 somewhere, out of your trigger

In your trigger, on activation, past this :

0 = [thisTrigger, thisList] call BAS_fnc_callFromTrigger;

 

 

Dont forget on all of your trigger to set on activation/detection who can activate triggers (anyone, BLUFOR, OPFOR, etc...)

Save your mission and export to multiplayers

 

 



Note : explanations about teleportation system


Go inside trigger1 teleport you to nuclear_plant

Go inside trigger2 teleport you to prip_1

Go inside trigger3 teleport you to yanov

Go inside trigger4 teleport you to pripyat

 


 

© 2016 by Alphive and Babast, by FOXCOM TEAM.  Proudly created with Wix.com

bottom of page