RudyRedTop 0 Posted January 10, 2024 (edited) Hi there, I'm a relative newbie to SQF scripting. I also have ADHD which presents other challenges when I'm trying to code things. I learn best by looking at examples of working scripts to learn how they function. A friend of mine gave me this script to use for a simple teleport addAction. I genuinely don't know what anything after the "teleportVariableName" bracket does, but it doesn't seem to work without it. this addAction [ "Teleport", { [player setPosAtl (getPosAtl teleportVariableName)]; }, nil, 5, true, true, "", "true", 5, false, "", "" ]; I've used it quite a bit to great effect, however on the current campaign I'm running it doesn't exactly work how I need. Normally we'll put down a flag pole or something simple for the re-insert point for players to teleport too so they can get back in the action. However with our current campaign my players are taking a vehicle around with them from our base so I figured it might be cool for them to just use that as the re-insert point instead of a flag pole or something else that I would need to move around manually. However upon testing I realized that it teleported them directly into the middle of the vehicle, and not like into a seat or anything. It simply puts them on the ground in the middle of the vehicle so that they're clipping through. I'm looking for something that would allow me to use the vehicle's position but like 5-10 meters behind it or something that would actually put them in a seat in the vehicle or anything like that. I was looking into using the regular SetPos function as it looks like you can modify it to fit this kind of purpose but I'm having trouble figuring out how to make that work. Any tips or advice are welcome as I'm trying to learn more about scripting to improve my missions. Thanks in advanced! Edited January 10, 2024 by RudyRedTop clarification Share this post Link to post Share on other sites
LittleAndy 5 Posted January 10, 2024 not on my PC at the moment (and I'm a noob at SQF) so I can't give any advanced examples but maybe I can help a bit. my code might not be the best but yeahif you want to teleport the player 5-10 metres behind it (warning: if the vehicle isn't on relatively flat ground, it may teleport them in the air)if you want to teleport the player inside of the vehicle (warning: will not teleport them if the vehicle is full) // to teleport 5-10m behind the vehicle // ! warning ! may teleport the player in the air if the vehicle is not on relatively flat ground player setPosWorld (teleportVariableName modelToWorld [0,5,0]); // to teleport inside of the vehicle // ! warning ! may not teleport the player if the vehicle is full player moveInAny (teleportVariableName); Quote I genuinely don't know what anything after the "teleportVariableName" bracket does, but it doesn't seem to work without it ^ they are the parameters of addAction. they're basically the settings for the command "addAction". have a look at https://community.bistudio.com/wiki/addAction for more documentation 1 Share this post Link to post Share on other sites
Harzach 2518 Posted January 10, 2024 You can also use getRelPos. To set the player 5 meters from the center point of the vehicle and in a random direction: [player setPosAtl (teleportVariableName getRelPos [5, random 360])]; 3 Share this post Link to post Share on other sites
j0nes 194 Posted January 10, 2024 Heres the info for addAction, it should be: (the last couple parameters can be omitted because theyre optional & default, but you've decreased the radius down to 5, so everything up until then has to be included) this addAction [ "Teleport", //Action Name { _caller setPosAtl (teleportVariableName getRelPos [5, random 360]); //Code }, nil, //Arguments 5, //priority true, //showWindow true, //hide On Use "", //shortcut "true", //condition 5 //radius ]; 1 Share this post Link to post Share on other sites
RudyRedTop 0 Posted January 11, 2024 19 hours ago, LittleAndy said: not on my PC at the moment (and I'm a noob at SQF) so I can't give any advanced examples but maybe I can help a bit. my code might not be the best but yeahif you want to teleport the player 5-10 metres behind it (warning: if the vehicle isn't on relatively flat ground, it may teleport them in the air)if you want to teleport the player inside of the vehicle (warning: will not teleport them if the vehicle is full) // to teleport 5-10m behind the vehicle // ! warning ! may teleport the player in the air if the vehicle is not on relatively flat ground player setPosWorld (teleportVariableName modelToWorld [0,5,0]); // to teleport inside of the vehicle // ! warning ! may not teleport the player if the vehicle is full player moveInAny (teleportVariableName); ^ they are the parameters of addAction. they're basically the settings for the command "addAction". have a look at https://community.bistudio.com/wiki/addAction for more documentation Honestly the tp in vehicle option might work just fine since it's a large transport with many seats. I'll give both a try though. Thank you so much! Share this post Link to post Share on other sites