Jordan Booth 2 Posted July 18, 2019 I have a basic flagpole teleporter with 4 markers. How would you make it so that it randomly chooses one of the spawn points and send you there rather than choosing one yourself? Flagpole init: this addaction ["Rock1","Rock1.sqf"]; this addaction ["Rock2","Rock2.sqf"]; this addaction ["WindmillRock","WindmillRock.sqf"]; this addaction ["Other","Other.sqf"]; Rock1.sqf: _tele = _this select 0; _caller = _this select 1; _caller setPos (getpos (Rock1)); Share this post Link to post Share on other sites
pierremgi 4910 Posted July 18, 2019 this addaction ["Teleport","teleport.sqf"]; and in teleport.sqf params ["","_caller"]; // same as _caller = _this #1; _caller setpos getmarkerPos selectRandom ["yourmarker1", "yourmarker2","yourmarker3","yourmarker4"]; CORRECTED 4 Share this post Link to post Share on other sites
Jordan Booth 2 Posted July 19, 2019 Thanks, i just tried it but is says "error missing ] in line 1 of teleport.sqf" Share this post Link to post Share on other sites
ZaellixA 383 Posted July 19, 2019 Yep, there's a typo in pierremgi's snippet. He writes params ["",_caller"]; // same as _caller = _this #1; where it should be params ["","_caller"]; // same as _caller = _this #1; -> MISSING ONE " BEFORE _CALLER Haven't tested it, but it is simple enough to be able to say that it SHOULD work now. Please don't hesitate to ask again if you encounter any other issues. 3 Share this post Link to post Share on other sites
Jordan Booth 2 Posted July 19, 2019 Thanks that works now. I put the " before the _ at first because i'm stupid and thought it still didn't work but after moving it to before the _ it works. EDIT: After trying it a few times it doesn't teleport me to the correct position and teleports me into the sea. Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted July 19, 2019 20 minutes ago, Jordan Booth said: Thanks that works now. I put the " before the _ at first because i'm stupid and thought it still didn't work but after moving it to before the _ it works. EDIT: After trying it a few times it doesn't teleport me to the correct position and teleports me into the sea. Make sure there are no typos and upper/lower case errors in your marker array or editor placed markers. Also post the snippet that didn't work. Cheers 3 Share this post Link to post Share on other sites
Jordan Booth 2 Posted July 19, 2019 Flagpole: this addaction ["OG Castle","hmm.sqf"]; hmm.sqf: params ["","_caller"]; _caller setpos getmarkerPos selectRandom ["Rock", "Stone","Corner","Main"]; Are these compatible i am having problems. I have double checked there are no spelling mistakes or typos but could some please check. Thnx Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted July 19, 2019 2 hours ago, Jordan Booth said: Flagpole: this addaction ["OG Castle","hmm.sqf"]; hmm.sqf: params ["","_caller"]; _caller setpos getmarkerPos selectRandom ["Rock", "Stone","Corner","Main"]; Are these compatible i am having problems. I have double checked there are no spelling mistakes or typos but could some please check. Thnx What kind of problems? Besides a missing closing bracket? Always check the wiki for syntax and enable -showScriptErrors as startup parameter. Also good to use a text editor that supports .sqf syntax highlighting. Alternatively you could get rid of the .sqf file and put this into the objects init field: this addaction ["OG Castle","_this#1 setpos getmarkerPos selectRandom ['Rock', 'Stone','Corner','Main']"]; Cheers 1 Share this post Link to post Share on other sites
Jordan Booth 2 Posted July 19, 2019 58 minutes ago, Grumpy Old Man said: this addaction ["OG Castle","_this#1 setpos getmarkerPos selectRandom ['Rock', 'Stone','Corner','Main']"]; This also teleports my into the ocean in the bottom left corner of the map. Share this post Link to post Share on other sites
RCA3 593 Posted July 19, 2019 Have you tried with parenthesis? this addaction ["OG Castle","_this#1 setpos (getmarkerPos (selectRandom ['Rock', 'Stone','Corner','Main']))"]; Are "Rock, Stone, Corner, Main" markers? Share this post Link to post Share on other sites
pierremgi 4910 Posted July 19, 2019 All these solutions work. So check your markers. I guess you wrote "rock", "stone"... in the init field of markers. That's not correct. You must write the name without quote in these fields: rock, stone, ... as any object's name in editor. Then in script you need to refer at the quoted name "rock", "stone" because that's markers (with specific getMarkerPos apply to the marker string, instead of getPos for an object (not stringed)) 2 Share this post Link to post Share on other sites
Jordan Booth 2 Posted July 19, 2019 Solved, sorry for wasting everyone's time. 2 Share this post Link to post Share on other sites
ZaellixA 383 Posted July 20, 2019 Hey @Jordan Booth, would care to share your solution for other people to benefit from it in the future? In the end of the day this is one of the many purposes of the forums, for people to exchange information and benefit from it. 2 Share this post Link to post Share on other sites
Play3r 147 Posted July 21, 2019 On 7/19/2019 at 9:09 PM, Jordan Booth said: Solved, sorry for wasting everyone's time. How did you do it ?? 2 Share this post Link to post Share on other sites