meatball 25 Posted August 12, 2013 Nope, using .21 It's working regardless now with a few checks, so I'm not too worried about it. :) Share this post Link to post Share on other sites
delta99 34 Posted August 12, 2013 Hmm, no idea why, but I have to do direction first, then distance second :) Regardless, I think I got it working. _mapCenter = getMarkerPos "mapCenter"; _rMLoc = [_mapCenter, random 360, random 4000, false, [2, 1000] ] call SHK_pos; while {(surfaceIsWater _rMLoc)} do { _rMLoc = [_mapCenter, random 360, random 4000, false, [2, 1000] ] call SHK_pos; }; 2nd parameter is distance, 3rd parameter is direction. Been using these scripts a lot and they work great. You must be doing something wrong. See this post as to why this is likely causing confusion. Not sure if Shuko has fixed this in his examples yet. Share this post Link to post Share on other sites
kadinx 12 Posted August 12, 2013 ok then, Meatball. :) Maybe one day we will get an "ah!" moment that would explain everything. Share this post Link to post Share on other sites
hatifnat 1 Posted September 7, 2013 (edited) Whoa, good work! This is just what I need, a way to get a random position with parameters and a blacklist. Just a feature request: maybe add an option to only find a position on water? As for right now, you can only choice between "find position on land" or "find position on land or water". It would be great if you did that so I (or other people) don't have to edit the function just to make a boat spawn on water around a pier. EDIT: Figured out having my edit of shk_pos_getposmarker.sqf might help. It is compatibility with the old water parameter and have a option to use numbers for my change. (If I did everything right. I didn't test this 100% yet) Marker Based Selection, new water parameter: Optional Parameters: 1 Boolean or Number Allow water positions? Default is false. 0 = false (only land), 1 = true (land and water), 2 = only allow water positions (only water) Change in shk_pos_getposmarker.sqf: Removed the old water parameter statements and added this (including line numbers): 41 if(typeName _water == "SCALAR") then { 42 // Water position is not allowed 43 if (_water == 0) then { 44 // Position is on land, try to exit script. 45 if !(surfaceIsWater _pos) then { 46 _exit = true; 47 }; 48 }; 49 50 // Doesn't matter if position is on water or land. 51 if (_water == 1) then { 52 _exit = true; 53 }; 54 55 // Only water position is allowed 56 if (_water == 2) then { 57 // Position is on water, try to exit script. 58 if (surfaceIsWater _pos) then { 59 _exit = true; 60 }; 61 }; 62 } else { // For backward compatibility 63 // Water position is not allowed 64 if !_water then { 65 // Position is on land, try to exit script. 66 if !(surfaceIsWater _pos) then { 67 _exit = true; 68 }; 69 // Doesn't matter if position is on water or land. 70 } else { 71 _exit = true; 72 }; 73 }; I haven't added my edit of shk_pos_getpos.sqf with this feature because I don't use it, and therefor didn't code it. Edited September 7, 2013 by Hatifnat Added my edit of shk_pos_getposmarker.sqf with the feature Share this post Link to post Share on other sites
shuko 59 Posted September 8, 2013 Good to hear to got it to work. I've made the change to the 0.22 version, which is now up on the A3 thread. It's the same script, but I'm going to just update one location. Share this post Link to post Share on other sites
CommuneCode 10 Posted January 28, 2014 I am having an issue with this script, it is not working when I preprocess it in my init.sqf, it is loading, but not linking to the marker I set to the pos variable, I think it may be that I am not putting the pos variable with the parameters and stuff in the right place, my code is on GitHub Share this post Link to post Share on other sites
zyg0tic 12 Posted February 26, 2015 Download link is dead. Revived as a possible solution to my "i want to spawn vehicles randomly across the map" problem, as directed from http://forums.bistudio.com/showthread.php?143979-Dynamic-Placement-CreateVehicle Share this post Link to post Share on other sites
sttosin 67 Posted March 22, 2015 Hi Shuko, I am using this in my West To East mission and have a question/request if it does not work that way. I use this to spawn enemies. I want to have them be at a minimum distance from the player. Is this doable at this point as is with the script? Share this post Link to post Share on other sites
shuko 59 Posted March 22, 2015 Hi Shuko,I am using this in my West To East mission and have a question/request if it does not work that way. I use this to spawn enemies. I want to have them be at a minimum distance from the player. Is this doable at this point as is with the script? Give the distance parameter as min and max. myPos = [getpos player,direction,[minDistance,maxDistance]] execvm "SHK_pos.sqf"; for example: myPos = [getpos player,random 360,[200,500]] execvm "SHK_pos.sqf"; Share this post Link to post Share on other sites
sttosin 67 Posted March 22, 2015 Give the distance parameter as min and max.myPos = [getpos player,direction,[minDistance,maxDistance]] execvm "SHK_pos.sqf"; for example: myPos = [getpos player,random 360,[200,500]] execvm "SHK_pos.sqf"; Excellent! Thanks for the fast response. Share this post Link to post Share on other sites
sttosin 67 Posted April 5, 2015 (edited) Shuko, I am back again. ;) Is there a way to have a timeout for the script? Is there a timeout parameter? So say I wanted to spawn a Tank but script can't find big enough position, I then want to just terminate the script. That way I can spawn something else instead. The way it works now it will hold in memory the tank spawn and perform eventually when I no longer want it. Edited April 8, 2015 by sttosin Share this post Link to post Share on other sites