katipo66 94 Posted December 6, 2011 (edited) Could this work with Mr Murrays Compositons? I know it doesnt because i tried it using the ammocaches mission, is there something more needed for compositions? Edited December 6, 2011 by Katipo66 Share this post Link to post Share on other sites
shuko 59 Posted December 6, 2011 This only returns a position (array of x, y and z info). It doesn't affect in anyway how something is created. Share this post Link to post Share on other sites
katipo66 94 Posted December 6, 2011 (edited) Ok i know it does work by grouping his composition objects to multiple markers no problem, so ive probably just left something out or not named something properly as i usually do, ill go back and double check everything, thanks. Edit* Just for the record it doesn't work, I double checked everything. Edited December 9, 2011 by Katipo66 It doesn't work on compositions Share this post Link to post Share on other sites
JacobJ 10 Posted February 21, 2012 I am not so good with the arrays and can't figure out how to use the force road position feature. Currently I have this, but I would like to move those IEDs only to road positions: { _x setpos ("citymarker" call SHK_pos) } foreach [iED1,IED2,IED3,IED4,IED5,IED6,IED7,IED8,IED9,IED10,IED11,IED12]; How would I do that? Share this post Link to post Share on other sites
kylania 568 Posted February 21, 2012 Here's the results for this code: { _pos = [getMarkerPos "mrk_center", random 800, random 359, false, [1, 800]] call SHK_pos; _x setPos _pos; } forEach [iED1, IED2, IED3, IED4, IED5, IED6, IED7, IED8, IED9, IED10]; Marker with axis of 800, 800 type border at the player's position. Share this post Link to post Share on other sites
JacobJ 10 Posted February 21, 2012 (edited) Okay, it looks like what I need, but can you clarify for me, what those parameters do? I dont get the readme file that comes with this script. And what if I want to use the markers area and not its center? THen I don't need the getmarkerpos or? Edited February 21, 2012 by JacobJ Share this post Link to post Share on other sites
kylania 568 Posted February 21, 2012 From the looks of the readme, you can't use road placement if you're using a marker area mode. So this will give you a point within a marker since you just gave it the name (string) of a marker. _pos = ["myMarker"] call SHK_pos; To use the road mode you need to give it the position based selection parameters: _pos = [[color="#FF8C00"]getMarkerPos "mrk_center"[/color], [color="#FF0000"]random 800[/color], [color="#008000"]random 359[/color], [color="#0000FF"]false[/color], [color="#800080"][1, 800][/color]] call SHK_pos; The orange value is either an object (a unit or preplaced vehicle/flagpole or something) or a position (ie, position player to center on the player). This is the center point of where the location will be searched for from. The red value is an array or a number. In this case it's a random number from 0 to 799 (random 800) so the point will be 0-800 meters from the center position. The green value is also an array or a number. In this case a random number from 0 to 359 which is going to be the direction from the center to place the position. The blue value is a boolean (true or false). If it's false you allow water position placement, otherwise you want it on land. I left it as false since we'll be on a road anyway so no need to check in this case. The violet values is an array of two numbers. This is the road position setting. The 1 means you want to find a location on a road position but if you can't give a random position. The 800 is how far to search for a road from the position. So you'll want to use this and change the three highlighted values: _pos = [[b][color="#FF0000"]myObject[/color][/b], random [color="#FF0000"][b]800[/b][/color], random 359, false, [1, [color="#FF0000"][b]800[/b][/color]]] call SHK_pos; Setting myObject to be the name of the object at the center of your area and the 800s to be whatever range you want from where that object or position is. Share this post Link to post Share on other sites
JacobJ 10 Posted February 21, 2012 Thank you very much for this explanation! Now I get it and a very nice way with the colours to show what does what. Thumbs up from here! Share this post Link to post Share on other sites
JacobJ 10 Posted February 22, 2012 Can you help me out one more time with this. I now have it all working, but is there someway to generate markers for each unit? I have done it manually with createmarker and setpos to the units position, but it looks like Shuko has something to generate those markers he shows on his screenshots. How would I do that? ---------- Post added at 12:56 PM ---------- Previous post was at 11:05 AM ---------- Maybe I should link to this thread, it builds on the SHK_pos script and maybe Shuko will use the idea for an updated script. http://forums.bistudio.com/showthread.php?131491-Random-pos-on-roofs-ONLY-(SHK-script)&p=2110140#post2110140 Share this post Link to post Share on other sites
kylania 568 Posted February 22, 2012 Here's the code I used to generate that picture above, it's not perfect though since there's a chance you'll get duplicates but it shows the concept. :) { _pos = [getMarkerPos "mrk_center", random 800, random 359, false, [1, 200]] call SHK_pos; _x setPos _pos; [color="#008000"]_name = str(_x) + str(random 100); _marker = createMarker [_name, (getpos _x)]; _marker setMarkerShape "ICON"; _marker setMarkerType "DOT";[/color] } forEach [iED1, IED2, IED3, IED4, IED5, IED6, IED7, IED8, IED9, IED10]; The part in green makes the markers. It creates a name for the marker of IED134 or something, the name of the object currently being looped plus a random number. Share this post Link to post Share on other sites
JacobJ 10 Posted February 22, 2012 Thank you for that kylania. I surely will try that out. Shuko is there any way to take out the buildings where units has been placed? Like in kylania's script, where he removes that place to put unit, when a unit is placed? That would spread the units a bit more I think. Atm I have 20 units and within a radius of 500meters in fallujah, they only get placed in 5-7 locations. ---------- Post added at 08:46 PM ---------- Previous post was at 08:38 PM ---------- And isnt there any way to make a file.sqf that contains all the possible buildings in a map, lets say fallujah, which is the one I use? Then maybe it could be made so, that each unit in the list randomly picks a spot and gets moved to that location. Wouldnt that save the server a lot of work analysing those buildings every time the mission starts? Share this post Link to post Share on other sites
logi 1 Posted April 16, 2012 From the looks of the readme, you can't use road placement if you're using a marker area mode.So this will give you a point within a marker since you just gave it the name (string) of a marker. _pos = ["myMarker"] call SHK_pos; To use the road mode you need to give it the position based selection parameters: _pos = [[color="#FF8C00"]getMarkerPos "mrk_center"[/color], [color="#FF0000"]random 800[/color], [color="#008000"]random 359[/color], [color="#0000FF"]false[/color], [color="#800080"][1, 800][/color]] call SHK_pos; The orange value is either an object (a unit or preplaced vehicle/flagpole or something) or a position (ie, position player to center on the player). This is the center point of where the location will be searched for from. The red value is an array or a number. In this case it's a random number from 0 to 799 (random 800) so the point will be 0-800 meters from the center position. The green value is also an array or a number. In this case a random number from 0 to 359 which is going to be the direction from the center to place the position. The blue value is a boolean (true or false). If it's false you allow water position placement, otherwise you want it on land. I left it as false since we'll be on a road anyway so no need to check in this case. The violet values is an array of two numbers. This is the road position setting. The 1 means you want to find a location on a road position but if you can't give a random position. The 800 is how far to search for a road from the position. So you'll want to use this and change the three highlighted values: _pos = [[b][color="#FF0000"]myObject[/color][/b], random [color="#FF0000"][b]800[/b][/color], random 359, false, [1, [color="#FF0000"][b]800[/b][/color]]] call SHK_pos; Setting myObject to be the name of the object at the center of your area and the 800s to be whatever range you want from where that object or position is. first of all... thanks for the great script shuko! kylania you made a great explanation of how the script gets called. It would be awesome if you could do the same thing with the blacklist. Share this post Link to post Share on other sites
logi 1 Posted April 23, 2012 anyone? :( All i need to know is how i call a "no spawn" area. i dont know what i am doing wrong. Share this post Link to post Share on other sites
twirly 11 Posted April 23, 2012 Just had a look for you mate. Call it like this... works fine for me. _pos = ["mkr_Airport",false,["mkr_BL1","mkr_BL2"]] call SHK_pos; Of course replace my marker names with your marker names. I made a small test for myself.... and if you need it it's here. Share this post Link to post Share on other sites
logi 1 Posted April 24, 2012 your example mission works fine. but i still got a problem. i placed a marker on the map called M1. in my init.: call compile preprocessfile "SHK_pos\shk_pos_init.sqf"; test.sqf.: _spawn = createMarker["spawn", [0, 0]]; _spawn = "spawn" setMarkerShape "RECTANGLE"; "spawn" setMarkerAlpha 1; "spawn" setMarkerSize [2000, 2000]; "spawn" setMarkerType "SOLID"; "spawn" setMarkerPos getMarkerPos "m1"; _NOspawn = createMarker["NOspawn", [0, 0]]; _NOspawn = "NOspawn" setMarkerShape "RECTANGLE"; "NOspawn" setMarkerAlpha 1; "NOspawn" setMarkerSize [1500, 1500]; "NOspawn" setMarkerType "SOLID"; "NOspawn" setMarkerPos getMarkerPos "m1"; _pos = ["spawn",false,["NOspawn"]] call SHK_pos; { _x setpos ("spawn" call SHK_pos) } foreach [Mr1, mr2, mr3 ....]; It works fine if i place this code into the test sqf.: for "_i" from 0 to 100 do { _pos = ["mkr_Base",false,["mkr_bl1","mkr_bl2"]] call SHK_pos; _mkr = format ["%1", diag_ticktime]; _m = createMarkerLocal [_mkr, _pos]; _m setMarkerColorLocal "colorBLUE"; _m setMarkerTypeLocal "mil_dot"; _m setMarkerSizeLocal [1,1]; _m setMarkerAlphaLocal 1; sleep 0.01; }; but the units "Mr1, Mr2, Mr3" use the whole spawn marker. help and ideas would be appreciated. Share this post Link to post Share on other sites
twirly 11 Posted April 24, 2012 See how this works for you.... not tested. _spawn = createMarker["spawn", getMarkerPos "m1"]; _spawn setMarkerShape "RECTANGLE"; _spawn setMarkerAlpha 1; _spawn setMarkerSize [2000, 2000]; _spawn setMarkerType "SOLID"; _NOspawn = createMarker["NOspawn", getMarkerPos "m1"]; _NOspawn setMarkerShape "RECTANGLE"; _NOspawn setMarkerAlpha 1; _NOspawn setMarkerSize [1500, 1500]; _NOspawn setMarkerType "SOLID"; {_x setpos ([_spawn,false,[_NOspawn]] call SHK_pos)} foreach [Mr1, mr2, mr3 ....]; Share this post Link to post Share on other sites
logi 1 Posted April 24, 2012 Thanks for your help mate but it dosent work either... kinda stuck here. Share this post Link to post Share on other sites
twirly 11 Posted April 24, 2012 (edited) I don't know mate.... it seems the script does not work with spawned markers for some reason. I've been trying for an hour or so and can't figure it out. Works well with placed markers.... but not if they are created by code. Tried both createMarker and createMarkerLocal.... nothing doing. Here mate.... it does work. I added rotation to the created markers and the script didn't like it. Removed it and everything is fine now. Demo here. Edited April 24, 2012 by twirly Share this post Link to post Share on other sites
logi 1 Posted April 24, 2012 I don't know mate.... it seems the script does not work with spawned markers for some reason. I've been trying for an hour or so and can't figure it out.Works well with placed markers.... but not if they are created by code. Tried both createMarker and createMarkerLocal.... nothing doing. Here mate.... it does work. I added rotation to the created markers and the script didn't like it. Removed it and everything is fine now. Demo here. you sir .... you are my hero! thank you very much! Share this post Link to post Share on other sites
hogmason 2 Posted September 16, 2012 Hi wondering how i place in a exclusion zone marker so none of my aa guns spawn inside the said marker this is my code and the marker i want as my exclusion zone is safe_zone my code _aadistance = [1000,2000,3000,4000,5000,6000] call BIS_fnc_selectRandom; _aatype = ["Ural_ZU23_TK_GUE_EP1","Ural_ZU23_TK_EP1","ZSU_INS","2S6M_Tunguska","Igla_AA_pod_East"] call BIS_fnc_selectRandom; [color="#FF0000"]//////===>thinking this _aasafespot = getMarkerPos "safe_zone"; ////====> and placing this somewere in the positions code _aasafespot[/color] _aapositions = [getMarkerPos "airpatrol", _aadistance, random 359, false, [0, 0]] call SHK_pos; _aagun = createVehicle [_aatype, _aapositions, [], 0, "NONE"]; _aagun setDir random 290; ---------- Post added at 16:15 ---------- Previous post was at 15:08 ---------- im trying to spawn a marker on the map in a random position using shk_pos but its not working Does any 1 know what i have done wrong. private ["_taskMARKERdistances","_taskMARKERnoSPAWNzone","_taskMARKERcenter","_createTASKmarker"]; if isserver then { //set up Paramaters _taskMARKERdistances = [1000,2000,3000,4000,5000,6000] call BIS_fnc_selectRandom; //_taskMARKERnoSPAWNzone = getMarkerPos "safe_zone"; _taskMARKERcenter = getMarkerPos "center"; //create task Marker _createTASKmarker = createmarker ["newtaskmarker", getMarkerPos _taskMARKERcenter, _taskMARKERdistances, random 359, false, [0, 0]] call SHK_pos; _createTASKmarker setMarkerType "mil_triangle"; _createTASKmarker setMarkerColor "ColorGreen"; sleep 0.5; //Start to spawn the Targets }; ---------- Post added at 16:56 ---------- Previous post was at 16:15 ---------- got it working with this but the marker only spawns in the bottom right hand corner of the map in the water. if isserver then { //set up Paramaters _taskMARKERdistances = [1000,2000,3000,4000,5000,6000] call BIS_fnc_selectRandom; //_taskMARKERnoSPAWNzone = getMarkerPos "safe_zone"; _taskMARKERposition = [getMarkerPos "center", _taskMARKERdistances, random 359, false, [0, 0]] call SHK_pos; //create task Marker _createTASKmarker = createmarker ["newtaskmarker", _taskMARKERposition]; _createTASKmarker setMarkerType "mil_objective"; _createTASKmarker setMarkerColor "ColorGreen"; }; dont know what is wrong this is the rpt error Error in expression < _pos select 1; _posX = _orgX + (_dst * sin _dir); _posY = _orgY + (_dst * cos _> Error position: <sin _dir); _posY = _orgY + (_dst * cos _> Error sin: Type Bool, expected Number File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_v2_23.Chernarus\shk_pos\shk_pos_fnc_getpos.sqf, line 10 Share this post Link to post Share on other sites
shuko 59 Posted September 17, 2012 Exclusion only works for marker based position generation, not the point based. _pos = ["myAreaMarker",false,"myExclusionMarker"] call SHK_pos; Share this post Link to post Share on other sites
hogmason 2 Posted September 17, 2012 thanks mate i did end up getting it to work with the following for future ref if any 1 needs it _aatype = ["Ural_ZU23_TK_GUE_EP1","Ural_ZU23_TK_EP1","ZSU_INS","2S6M_Tunguska","Igla_AA_pod_East"] call BIS_fnc_selectRandom; _aapositions = ["center",false,["safezone"]] call SHK_pos; _aagun = createVehicle [_aatype, _aapositions, [], 0, "NONE"]; _aagun setDir random 290; Also those other issues were me having a blond moment and not placing this in my main init call compile preprocessfile "SHK_pos\shk_pos_init.sqf"; Share this post Link to post Share on other sites
mrcash2009 0 Posted March 16, 2013 I have just discovered this script which has cut down 70 percent of my problems in one go :cool: But I have stumbled over syntax issue with using blacklist marker(s). I have one large marker zone called "area1" which is the limit spawn area, and within this area I then have 6 smaller markers named "nospawn1" ... 2 ..... etc. These are over 6 small hut areas where I would not like a tank to spawn or anything in my foreach list obviously. Here is the code I used: call compile preprocessfile "SHK_pos\shk_pos_init.sqf"; // Initialise the SHK_pos function. { _x setpos ("[b]area1[/b]"[color=#ff0000],false,["nospawn1","nospawn2","nospawn3","nospawn4","nospawn5","nospawn6"]][/color] call SHK_pos) } foreach [veh1,ammobox,fire1,fire2,fire3]; Its using foreach to spawn a vehicle,ammobox,and some fires randomly in the "area1" marker. This fails the entire init with this line using blackmarked listed markers. Can anyone check this and spot the format error as im unsure. It works fine without the blackmark marker lists, is it limited to only a few blackmark markers? Share this post Link to post Share on other sites
Harzach 2517 Posted March 19, 2013 Has anyone had issues using this script in a dedicated server environment? I don't find any mention/discussion of it here. I am cobbling together a randomized IED/ambush system using this script to get road positions. It works flawlessly in editor preview and hosted environments, but not in dedi - all manner of screwy things are happening. Details in my topic here: Adding-a-condition-to-a-forEach-system, but again, I'm really just looking for confirmation that SHK_pos works on dedi and that I am doing something wrong. Share this post Link to post Share on other sites