PELHAM 10 Posted March 19, 2011 (edited) I have created a path of helper object spheres using the following code. It creates 1 sphere on each marker at ground level.: {"Sign_sphere100cm_EP1" createVehicle getMarkerPos _x;} forEach[ "L01","L02","L03","L04","L05","L06","L07","L08","L09","L10", "L11","L12","L13","L14","L15","L16","L17","L18","L19","L20", "L21","L22","L23","L24","L25","L26","L27","L28","L29","L30", "L31","L32","L33","L34","L35","L36"]; The problem: I would like to set each sphere 30m above the ground with setPosATL. As there is no array for the spheres how would I do that? Is it even possible or do I have to create all the spheres and setpos each one in the editor? I have tried various combinations of the setposATL syntax combined with _x and I had an {sp = "Sign_sphere100cm_EP1" createVehicle getMarkerPos _x;} forEach[ and tried using a {setposATL [blah blah]} for each units sp; but that did not work either. Am I going about this in the right way or would you not start from here lol. Edited March 19, 2011 by PELHAM Share this post Link to post Share on other sites
galzohar 31 Posted March 19, 2011 (edited) Doesn't work as in it isn't on the correct height? Or? If you are already managing to create them at ground level, you could simply use: { _tempSign = "Sign_sphere100cm_EP1" createVehicle getMarkerPos _x; _tempSign setPosASL [getPosASL _x select 0, getPosASL _x select 1, (getPosASL _x select 2) + 30]; } forEach [ "L01","L02","L03","L04","L05","L06","L07","L08","L09","L10", "L11","L12","L13","L14","L15","L16","L17","L18","L19","L20", "L21","L22","L23","L24","L25","L26","L27","L28","L29","L30", "L31","L32","L33","L34","L35","L36" ]; The ASL commands always seem to work exactly as one would expect, while the regular setPos/getPos and the ATL variation seem dodgy... EDIT: Fixed the code. Edited March 19, 2011 by galzohar Share this post Link to post Share on other sites
Lonestar 11 Posted March 19, 2011 Ok, I'm rather new to this but first you should declare your array. _array = [elementOne, elementTwo, ..., lastElement] Then use a forEach loop. http://community.bistudio.com/wiki/Control_Structures#forEach-Loop I don't know how to do the last part. Share this post Link to post Share on other sites
PELHAM 10 Posted March 19, 2011 (edited) Ok, I'm rather new to this but first you should declare your array.Then use a forEach loop. http://community.bistudio.com/wiki/Control_Structures#forEach-Loop I don't know how to do the last part. The problem is there is no array to declare: The spheres are created 1 on each marker at ground level with the code in post 1. If that creates an array of spheres how do I call that information? ---------- Post added at 12:16 ---------- Previous post was at 12:02 ---------- Doesn't work as in it isn't on the correct height? Or?If you are already managing to create them at ground level, you could simply use: { "Sign_sphere100cm_EP1" createVehicle getMarkerPos _x; _x setPosASL [getPosASL _x select 0, getPosASL _x select 1, (getPosASL _x select 2) + 30]; } forEach [ "L01","L02","L03","L04","L05","L06","L07","L08","L09","L10", "L11","L12","L13","L14","L15","L16","L17","L18","L19","L20", "L21","L22","L23","L24","L25","L26","L27","L28","L29","L30", "L31","L32","L33","L34","L35","L36" ]; The ASL commands always seem to work exactly as one would expect, while the regular setPos/getPos and the ATL variation seem dodgy... Yes the code I use creates 1 sphere on each marker at ground level, the problem is how to alter their position, I tried this one, didn't work: { "Sign_sphere100cm_EP1" createVehicle getMarkerPos _x; _x setPosASL [ getPosASL _x select 0, getPosASL _x select 1, (getPosASL _x select 2) +100] } forEach ["L02","L03","L04","L05","L06","L07"]; It only creates 1 sphere at ground level - is it because we are nesting several _x values in one code block and it's getting confused? Edited March 19, 2011 by PELHAM Share this post Link to post Share on other sites
galzohar 31 Posted March 19, 2011 Sorry, my bad, not _x setPosASL, _x is the marker. Instead use the fixed code in my original post (which is now edited). Share this post Link to post Share on other sites
shuko 59 Posted March 19, 2011 If it doesn't want to move up with setposasl, create an invisible helipad or game logic at the position and then attachto the spere to it, at right height. Of course, it might be better to just replace the markers with the hpads. Share this post Link to post Share on other sites
PELHAM 10 Posted March 19, 2011 I think I am going to go back and start again. I was attempting a shortcut but of course the best way is scripting each sphere individually so you have more options and control. I am going to use a combination of markers and Hpads so I can move/delete spheres and task hints along the track at will. There does not seem to be a method of either setPos or deleting objects created in this way. See you all much, much later. My father always told me there were no shortcuts in life lol. Thank you for your help. Share this post Link to post Share on other sites
CarlGustaffa 4 Posted March 19, 2011 (edited) Hmm, this works for me when I try it from a trigger: {_obj = "Sign_sphere100cm_EP1" createVehicle getMarkerPos _x; _obj setPos [getPos _obj select 0, getPos _obj select 1, (getPos _obj select 2)+1.2]} forEach ["L01","L02","L03"] But, a bunch of helpers? Won't that look kinda weird? Edit: Oh, I did have some problems, and I see I ended up pretty much with the same stuff galzohar showed. The point is, give it a reference so you can move it after creation. I'm using _obj in my example. ATL or not didn't seem to matter in my test. Edited March 19, 2011 by CarlGustaffa Share this post Link to post Share on other sites
PELHAM 10 Posted March 20, 2011 Hmm, this works for me when I try it from a trigger: {_obj = "Sign_sphere100cm_EP1" createVehicle getMarkerPos _x; _obj setPos [getPos _obj select 0, getPos _obj select 1, (getPos _obj select 2)+1.2]} forEach ["L01","L02","L03"] But, a bunch of helpers? Won't that look kinda weird? Edit: Oh, I did have some problems, and I see I ended up pretty much with the same stuff galzohar showed. The point is, give it a reference so you can move it after creation. I'm using _obj in my example. ATL or not didn't seem to matter in my test. Excellent, thanks Carl! Why didn't I think of that!? Probably because _x has done so many wonderful things for me lately I was convinced it would be the answer lol. I need the markers for a low level confidence course in my helicopter training mission between houses, trees and telephone poles. It stretches accross the entire island of Utes and they are 50m apart so does not look too bad. The conditions to win the task are no slower than 130kts and no higher than 20/25m. You need a line for reference so you know where to go. A single helper isn't enough. I am thinking of scripting the whole thing individually so it looks a bit more professional and I can hideObject, show and setObjectTexture etc to change the colours / alpha. Hopefully after someone sees the enormous effort put into this, some of the admins will let me fly in Domination :D. Share this post Link to post Share on other sites