Jump to content
Sign in to follow this  
mr_shadow

Teleport to player

Recommended Posts

Hello there, I would like to ask how should look the "addaction" on the object which was created by player.

 

So that object have an action which will teleport any other player right to the postion of the owner of this object.

Share this post


Link to post
Share on other sites


this addAction ["Teleport", "player setpos (getpos unit_01)"]; //unit_01 created object

Share this post


Link to post
Share on other sites

ObjectName addAction ["Teleport",
{
    param [1] setPos getPos objectNameToTeleportTo; //param [1] is the player who uses the addAction
}];

 

right to the postion of the owner of this object.

 

 

I'd need more details about that. What do you mean by "owner of this object".

Share this post


Link to post
Share on other sites

is there a way to make like 

_this select 

I can't give names for every units like unit_1.

 

 

I want the player to createvehicle object on key press, and add the action to this object so everybody will be able teleport to this player by using this object.

Share this post


Link to post
Share on other sites

So, if I get it right, this might be what you want (untested code!):

_object = createVehicle ["Land_Calvary_02_V1_F", screenToWorld [0.5, 0.5], [], 0, "NONE"];
_object setVariable ["unit", player, true];
[
    [
        _object,
        {
            _this addAction [format ["Teleport to %1", name player], {player setPosATL getPosATL ((_this select 0) getVariable "unit");}, [], 6, false, true, "", "!isNull (_target getVariable ['unit', objNull])"];
        }
    ],
    "BIS_fnc_call",
    true,
    true,
    true
] call BIS_fnc_MP;

Share this post


Link to post
Share on other sites

Seems like it is, but sadly it doesn't work. Not adding an action.

Share this post


Link to post
Share on other sites

OK, there were two errors I did not see right away. This here works when I execute it on the client in multiplayer:

_object = createVehicle ["Land_Calvary_02_V1_F", screenToWorld [0.5, 0.5], [], 0, "NONE"];
_object setVariable ["unit", player, true];
[
    [
        _object,
        [format ["Teleport to %1", name player], {player setPosATL getPosATL ((_this select 0) getVariable "unit");}, [], 6, false, true, "", "!isNull (_target getVariable ['unit', objNull])"]
    ],
    "addAction",
    true,
    true,
    true
] call BIS_fnc_MP;

Share this post


Link to post
Share on other sites

Gonna test this in MP and then reply.

 

It shows the action in the local mission.

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  

×