Thamu 10 Posted June 7, 2011 (edited) Editing Topic for People with same problem: IF YOU ARE USING MARKERS: // To use: Add this script as an action on an item in it's init field. EG: // //this addAction ["Teleport - Talon","teleport.sqf",["FOB_Talon"]]; //this addAction ["Teleport - Base","teleport.sqf",["Base"]]; //this addAction ["Teleport - Airfield","teleport.sqf",["Airstrip"]]; // Where "Teleport - Base" is what the action will read and ["Base"] is the name of a pre-placed marker. // Get the destination. _dest = (_this select 3) select 0; // Get a random direction _dir = random 359; // Move the person 15 meters away from the destination (in the direction of _dir) player SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir)]; IF YOU ARE USING GAMELOGICS: // To use: Add this script as an action on an item in it's init field. EG: // //this addAction ["Teleport - Talon","teleport.sqf",[FOB_Talon]]; (without [b]" "[/b]) //this addAction ["Teleport - Base","teleport.sqf",[base]]; //this addAction ["Teleport - Airfield","teleport.sqf",[Airstrip]]; // Where "Teleport - Base" is what the action will read and ["Base"] is the name of a pre-placed marker. // Get the destination. _dest = (_this select 3) select 0; // Get a random direction _dir = random 359; // Move the person 15 meters away from the destination (in the direction of _dir) player SetPos [(getPos _dest select 0)-10*sin(_dir),(getPos _dest select 1)-10*cos(_dir)]; _____________________________________________________________________________________________ Hi all. I have a small question. On my training mission, I need to teleport people instead of making them walk. But the problem is that for each place I have a "teleporter" I have a new script: player setPos (getPos base1); player setPos (getPos tank_battle); player setPos (getPos campo_tiro2); ... I think that I can create a variable,and send to only one script: player setPos (getPos "_wheretoteleport"); But I don't know how to do it. To teleport,I created a bike and "addAction": this addAction ["Go to Arty Field","teleport_campo_arty.sqf"]; Thats it. Thanks. Edited June 7, 2011 by Thamu Share this post Link to post Share on other sites
kylania 568 Posted June 7, 2011 // To use: Add this script as an action on an item in it's init field. EG: // //this addAction ["Teleport - Talon","teleport.sqf",["FOB_Talon"]]; //this addAction ["Teleport - Base","teleport.sqf",["Base"]]; //this addAction ["Teleport - Airfield","teleport.sqf",["Airstrip"]]; // Where "Teleport - Base" is what the action will read and ["Base"] is the name of a pre-placed marker. // Get the destination. _dest = (_this select 3) select 0; // Get a random direction _dir = random 359; // Move the person 15 meters away from the destination (in the direction of _dir) player SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir)]; This is what I use in my missions. Share this post Link to post Share on other sites
Thamu 10 Posted June 7, 2011 (edited) Oh!That works! Thx! EDIT: Too soon! Sometimes,it teleports me to sea,other times too far from my gamelogic. Edited June 7, 2011 by Thamu Share this post Link to post Share on other sites
riouken 15 Posted June 7, 2011 You need to use the argument parameters for addAction's. this addAction ["Go to Arty Field","teleport.sqf",1]; this addAction ["Go to Mars","teleport.sqf",2]; this addAction ["Go Home","teleport.sqf",3]; then in teleport.sqf: _telepos = _this select 3; switch (true) do { case (_telepos == 1) : { player setPos (getPos base1);}; case (_telepos == 2) : { player setPos (getPos tank_battle);}; case (_telepos == 3) : { player setPos (getPos campo_tiro2);}; default {hint "Please select a location.";}; }; ------ Lol too slow, thats what I get for afking during my post. Share this post Link to post Share on other sites
Thamu 10 Posted June 7, 2011 (edited) I'm gonna test yours.Back soon. EDIT:Doesnt works... :( On the first teleport script,it moves me to a marker,there is any way to move me to a game logic? Edited June 7, 2011 by Thamu Share this post Link to post Share on other sites
kylania 568 Posted June 7, 2011 Oh, if you're using gamelogics for the position you'll need different code. My code was to be used with markers. If you're using gamelogics instead change all getMarkerPos to read getPos and remove the " " around the name of the gamelogic. Share this post Link to post Share on other sites
demonized 20 Posted June 7, 2011 @kylania whats the purpose of the sin(_dir) and cos(_dir) in your teleport? Share this post Link to post Share on other sites
kylania 568 Posted June 7, 2011 Just gets a point in a random direction from the marker, so not everyone teleports onto each other. Spreads them out a bit. Share this post Link to post Share on other sites
Thamu 10 Posted June 7, 2011 Oh, if you're using gamelogics for the position you'll need different code. My code was to be used with markers.If you're using gamelogics instead change all getMarkerPos to read getPos and remove the " " around the name of the gamelogic. It works now. Thanks. Share this post Link to post Share on other sites