cookies2432 105 Posted September 3, 2015 So what i wanna do is to make an ai join my group when i'm at a certain distance away from him. Problem is, it could be random where he is. I've tried the "Attatch To" script but it doesn't seem to work for me and i've also tried to use "if (_x distance <5) but that doesn't work either. I'm not very good at scripting : /. Any help with this would be appriciated. Share this post Link to post Share on other sites
davidoss 552 Posted September 3, 2015 we could script it for you but you need to be more specify about that scenario Share this post Link to post Share on other sites
cookies2432 105 Posted September 3, 2015 Well. A pilot is ejecting from a plane and then the player needs to find him and when he does, the pilot will join his group. Thing is, he could parachute out anywhere. Share this post Link to post Share on other sites
davidoss 552 Posted September 3, 2015 Ok there are marker for pilot waitUntil {(getPos pilot select 2) < 2 }; _markerpilot = createMarker ["pilotmarker", getPos pilot]; _markerpilot setMarkerType "hd_objective"; _markerpilot setMarkerColor "ColorGrey"; _markerpilot setMarkerText "PILOT"; _markerpilot setMarkerSize [0.5,0.5]; _pilotpos = [] spawn { while {alive pilot} do { "pilotmarker" setMarkerPos getpos pilot; sleep 2; }; }; Next is the ask is that for MP or SP? Share this post Link to post Share on other sites
cookies2432 105 Posted September 3, 2015 SP and wow, thanks! I understand what the script does but i don't like, understand the scripting language. Share this post Link to post Share on other sites
cookies2432 105 Posted September 3, 2015 I gotta learn arma scripting at some point, it's just the fact that there are around 1700 scripting commands O____O Share this post Link to post Share on other sites
R3vo 2654 Posted September 3, 2015 waitUntil{sleep 0.5; ((player distance PILOTNAME) < 2)}; [PILOTNAME] join player; //at the end of your init.sqf (easiest way) You could also use a trigger for that Condition:(player distance PILOTNAME) < 2 OnActivation: [PILOTNAME] join player; Replace PILOTNAME with the name you gave the pilot in the editor. https://community.bistudio.com/wiki/join I gotta learn arma scripting at some point, it's just the fact that there are around 1700 scripting commands O____O Don't get intimidated by the amount of script commands, the language is mostly very simple, and most of the command you'll never use. Share this post Link to post Share on other sites
cookies2432 105 Posted September 3, 2015 Thanks! :) Share this post Link to post Share on other sites
davidoss 552 Posted September 3, 2015 private ["_markerpilot", "_pilotpos", "_pilot"]; waitUntil {(getPos pilot select 2) < 2 }; _markerpilot = createMarker ["pilotmarker", getPos pilot]; _markerpilot setMarkerType "hd_objective"; _markerpilot setMarkerColor "ColorGrey"; _markerpilot setMarkerText "PILOT"; _markerpilot setMarkerSize [0.5,0.5]; _pilotpos = [] spawn { while {alive pilot} do { "pilotmarker" setMarkerPos getpos pilot; sleep 2; }; }; waitUntil {({isPlayer _x AND (_x distance pilot) < 10} count switchableUnits) != 0}; [_pilot] joinSilent (group player); terminate _pilotpos; deleteMarker _markerpilot; Test it!! Share this post Link to post Share on other sites
cookies2432 105 Posted September 3, 2015 I will! I can't today tho : / Share this post Link to post Share on other sites
anton_st 1 Posted September 3, 2015 if you're like me (a scripting noob) and use the editor triggers alot this is what I do for SP; Give the pilot a name then just make a trigger with the condition... Player distance INSERT_NAME_HERE < 5 in the ACT of the trigger paste this... INSERT_NAME_HERE joinAsSilent [player, 2]; works every time in SP even if you have 10 teammates already. Good luck! :) Share this post Link to post Share on other sites
drunken officer 18 Posted September 4, 2015 waitUntil {({isPlayer _x AND (_x distance pilot) < 10} count switchableUnits) != 0}; This make no sense. In SP there is only ONE Player. And if the player in game, switchableUnits more the 0. You can use this code in MP. But you have to change switchable to playable Btw: Waituntil checks per frame. Slow it down and use sleep-command inside. You do not need frame checks in this case For singleplayer is this enough: waituntil {sleep 1; player distance pilotname < 10}; [pilotname] joinsilent group player; Or use a trigger. R3vo wrote a example Share this post Link to post Share on other sites
cookies2432 105 Posted September 4, 2015 I will try them all. Thanks a lot people! :D Bohemia has such a nice community, that's a big reason why i love this game! Share this post Link to post Share on other sites
cookies2432 105 Posted September 4, 2015 It works perfectly! Thanks a ton! Share this post Link to post Share on other sites