Jump to content
Sign in to follow this  
shuko

SHK_pos

Recommended Posts

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?

Looks like you're missing a bracket mrcrash2009. Try this:

{ _x setpos ([color="#FF0000"][[/color]"area1",false,["nospawn1","nospawn2","nospawn3","nospawn4","nospawn5","nospawn6"]] call SHK_pos) } foreach [veh1,ammobox,fire1,fire2,fire3];

Share this post


Link to post
Share on other sites
Looks like you're missing a bracket mrcrash2009. Try this:

Thanks, how on earth I missed that bracket is beyond me, seeing the wood for trees and late edits I guess thanks, all works as it should (have!) :)

---------- Post added at 01:32 ---------- Previous post was at 01:30 ----------

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.

Maybe PM Shuko, depending on if he's around lately, its quite a specific thing and possibly be something this needs updating for.

Share this post


Link to post
Share on other sites
Maybe PM Shuko, depending on if he's around lately, its quite a specific thing and possibly be something this needs updating for.

He's posted recently, so hopefully he'll see the activity here and pop in.

Share this post


Link to post
Share on other sites

I hope recently he didn't pop in and see my activity, becuase if he was me reading my editing posts I would be : FPDR:sulkoff:

:)

Share this post


Link to post
Share on other sites

Anyone got this working in A3 ?

I get the following error

Error in expression <y)} else {_cy+_ty};
_pos = [_xo,_yo,0];
if (_water) then {
_loop = false;
} else>
 Error position: <if (_water) then {
_loop = false;
} else>
 Error if: Type Number, expected Bool

code using

_spos = ["base1",random 360,[100,200]] call SHK_pos;

Share this post


Link to post
Share on other sites
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.

Works like a charm here. Running a fully fledged AI system that is 100% dedicated serverside.

Sarge

Share this post


Link to post
Share on other sites
Works like a charm here. Running a fully fledged AI system that is 100% dedicated serverside.

Sarge

Yeah, it turns out my problem was a lot more complicated and not related to SHK_pos, which is indeed working perfectly.

Share this post


Link to post
Share on other sites
Anyone got this working in A3 ?

I get the following error

Error in expression <y)} else {_cy+_ty};
_pos = [_xo,_yo,0];
if (_water) then {
_loop = false;
} else>
 Error position: <if (_water) then {
_loop = false;
} else>
 Error if: Type Number, expected Bool

code using

_spos = ["base1",random 360,[100,200]] call SHK_pos;

You're using the marker-based paramaters, right? Then those numbers "[100,200]" are being read to the script as blacklisted markers, which probably don't exist.

Share this post


Link to post
Share on other sites

Anyone else getting error:

Error in expression <ect 1)-(_dist select 0)));

};

[((_origo select 0) + (_dist * sin _dir)),((_origo>

Error position: <select 0) + (_dist * sin _dir)),((_origo>

Error select: Type Number, expected Array,Config entry

I'm using SHK through the SLP script.

Share this post


Link to post
Share on other sites
Anyone else getting error:

I'm using SHK through the SLP script.

The key part in that error message is this: Error select: Type Number, expected Array

It wants an array but is given just a number instead. Check the parameters.

Share this post


Link to post
Share on other sites

It was the params.. I had ["location",1],1] instead of ["location"],1] somehow... it was me not the script. I made that small change right when the patch occurred.. so I assumed that it was a code change that broke the script.. yep.. assumptions..

Share this post


Link to post
Share on other sites

The thing that confused me here is your link to images with examples because the non-marker one has the parameters incorrect in all of the examples. In your images it shows the direction as the 2nd parameter and distance as third. Yet the scripts and instruction point out that the distance is the 2nd parameter and direction 3rd. I was getting all sorts of odd results and once I figured that out all was fine.

I should have read the instructions but when looking at the examples I figured I would just copy one of them that was similar to what I wanted to do.

Share this post


Link to post
Share on other sites
The thing that confused me here is your link to images with examples because the non-marker one has the parameters incorrect in all of the examples. In your images it shows the direction as the 2nd parameter and distance as third. Yet the scripts and instruction point out that the distance is the 2nd parameter and direction 3rd. I was getting all sorts of odd results and once I figured that out all was fine.

I should have read the instructions but when looking at the examples I figured I would just copy one of them that was similar to what I wanted to do.

Damn, you are right. Thanks for pointing it out. :)

Share this post


Link to post
Share on other sites

No problem. Great script BTW. I was using my own that calls one of the BIS functions for a safe position but wasn't working out the way I wanted. This works much better.

Share this post


Link to post
Share on other sites

Great Script man.

Currently using it to randomly position a downed pilot :D

10/10

make more plz

Share this post


Link to post
Share on other sites

I have just run into your set up. I put it right to work in Arma 3. As Delta99 pointed out, a few little speed bumps to figure things out but... the scripts..., what an amazing collection.

Beautiful work, Shuko !!

My very appreciative thanks :)

Share this post


Link to post
Share on other sites

Hey Shuko, I started using your old Random Start position script in A3 Beta, but it only looks like it's moving one person at startup and everyone else is spawning at their original placement location in the editor.. Any thoughts? I've not made any mods to it.

Share this post


Link to post
Share on other sites

Which script are you using and where (editor/host/dedicated) are you testing the mission? Also, how are you calling the script?

Share this post


Link to post
Share on other sites

Love this script, and trying to use it on Stratis with the following call:

_rMLoc = [_mapCenter, random 360,random 4000,true,[1,1000]] call SHK_pos;

The problem is, this still frequently dumps the spot out into the water. Shouldn't this always end up on land since the water flag is set to true? (Which is find closest land)

Edited by Meatball

Share this post


Link to post
Share on other sites

Meatball,

I would like to point out a few things on your script above: the SECOND parameter should be the distance from your _mapCenter and the THIRD the direction. Last, try "false" if you DON'T want water positions.

The example pictures are wrong and Shuko has made a correction comment on his first post.

I also find out Land ONLY positions are happening when the parameter is FALSE. The comments on the first .sqf are backwards.

However, it is an amazing collection of scripts. It gives the mission designer an ingredible tool for applying randomness.

Many thanks again Shuko :)

Share this post


Link to post
Share on other sites
Meatball,

I would like to point out a few things on your script above: the SECOND parameter should be the distance from your _mapCenter and the THIRD the direction. Last, try "false" if you DON'T want water positions.

I've tried it the with the parameter's ordered distance,direction and I keep getting points with 360m of my _mapCenter, so the way I've show it above is the only way I can get it to work right.

And I've tried both false and true and neither of them work all the time and I end up with points in the water. My guess is the road variable is overriding the false/true and if the script can't find a road within the distance specified, it's dropping back to the originally found location, regardless of whether it's water or not.

Share this post


Link to post
Share on other sites

Hmm, I have all shorts of Array variations, including one that is very similar to yours (with the order stated in my post) and I don't have any issues at all. I have been at it for the last month or so. How is your _mapCenter defined? Stratis does not have a heck of road network. Is it possible the scripts executes in those road barren areas?

I am assuming you have the latest script package.

Also, try _rMLoc = [ _mapCenter, random 4000, random 360, false, [2, 1000] ] call SHK_pos; to see if an empty array returns if the search does not produce a road location.

Edited by KadinX

Share this post


Link to post
Share on other sites

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;
	};

Share this post


Link to post
Share on other sites

I am using version Version 0.21 and I have a hunch that you are using Version 0.1.

Check file shk_pos_init.sqf .

The first post has a link right at the top. The bottom link is the older one.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×