Jump to content
Sign in to follow this  
Morts

Teleporting

Recommended Posts

Hey guys, im making a map which requires a bit of teleporting to be involved, i have set it with triggers and radio commands.

E.g. Naming a trigger r1 and On Act: player setPos (getPos r1)

this works perfectly well, however when in multiplayer, it teleports EVERY human player, not just the one person, is there anyway of getting it to teleport just one player at a time, bearing in mind there are about 8 positions and would prefer not to over-script the mission. However if there is no other way, then i guess i will have to.

thanks in advance

Morts :)

Share this post


Link to post
Share on other sites

Edit: never mind, I don't know how to check who activates a radio command.

Edited by Celery

Share this post


Link to post
Share on other sites

I'll give it a try :) thanks :)

---------- Post added at 09:08 PM ---------- Previous post was at 08:22 PM ----------

Erm, that doesnt actually do anything, or do i need to name each player and put that in the target?

Share this post


Link to post
Share on other sites
I'll give it a try :) thanks :)

---------- Post added at 09:08 PM ---------- Previous post was at 08:22 PM ----------

Erm, that doesnt actually do anything, or do i need to name each player and put that in the target?

Do it from a addAction instead of a trigger.

Share this post


Link to post
Share on other sites

sorry, i'm not very experienced, how can i do this?

Share this post


Link to post
Share on other sites

So i will have to script each destination into it, and this goes in the init line?

Share this post


Link to post
Share on other sites

Put this in the players init line: id1 = unit addAction ["Teleport", "teleportScript.sqf"];

Put this in a script named teleportScript.sqf:

player setPos (getPos r1);

player removeAction id1;

This will add a action to your players action menu and can be used 1 time. If you wanna use more than 1 time remove the "player removeAction id1;" part

Share this post


Link to post
Share on other sites

Okey, and if i wanted to have more than one destination does it all go in one script, or seperate ones?

Share this post


Link to post
Share on other sites
Put this in the players init line: id1 = unit addAction ["Teleport", "teleportScript.sqf"];

Put this in a script named teleportScript.sqf:

player setPos (getPos r1);

player removeAction id1;

Oops, change unit to this

---------- Post added at 11:07 PM ---------- Previous post was at 10:56 PM ----------

For more location you could pass the location as a argument to the script:

add to players init field:

id1 = this addAction["Teleport","Teleport.sqf", r1];

Then make a script named Teleport.sqf with this in it:

_loc = _this select 3;

player setPos (getPos _loc)

So if you wanted another player to go to a different location you could add this to his init field:

id1 = this addAction["Teleport","Teleport.sqf", r2];

If you want same player to be able to teleport to both r1 & r2 then simply add to addactions to the player:

id1 = this addAction["Teleport","Teleport.sqf", r1];

id2 = this addAction["Teleport","Teleport.sqf", r2];

You could also make them teleport via map click.

Put this in the players init field: id1 = this addAction["Teleport","Teleport.sqf"];

Then make a script named Teleport.sqf with this in it:

player globalChat "Click on map to teleport";

onMapSingleClick "player setPos _pos; true; onMapSingleClick '';";

Now you can click on your map and teleport to that location.

Share this post


Link to post
Share on other sites

Sorry to ask more questions but the players name is id1, id2 etc?

Share this post


Link to post
Share on other sites
Sorry to ask more questions but the players name is id1, id2 etc?

No they are the id's of the addActions, you'll need them in case you wanna remove the addActions again.

Share this post


Link to post
Share on other sites

Oh okay :) So the names of the actions are r1 as well as the destinations??

Share this post


Link to post
Share on other sites
Oh okay :) So the names of the actions are r1 as well as the destinations??

The r1, r2 and as many as you like are locations, they are just passed on as arguments to the script. This way you can use same script for all players but decide their location by the addAction.

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  

×