Jump to content

Scriptings doing my head in...


kennychr

Recommended Posts

Som im creating a pvp mission need a marker 500x500 size to mark the location of a squad( simulates a beacon of sorts) and the problem is that its to accurate, so i have had no luck adding some randomness to the script i wrote and was wondering if anyone has some input and or a soulution:

 

 
_unit = _this select 0;
_marker = _this select 1;
 
 
while {alive _unit} do
{
_hm = createMarker ["_marker",position _unit];
"_marker" setmarkershape "RECTANGLE";
"_marker" setMarkerBrush "DIAGGRID";
"_marker" setMarkerSize [500, 500];
"_marker" setmarkercolor "ColorRed";
 
 
sleep 5;
deleteMarker "_marker";
 
};
 
 
Kenny
Link to comment
Share on other sites

that will always put it in the center because it's always referencing exactly where they are.

 

after you create that marker think about adding or subtracting to the x/y co-ordinates to throw it off centre like a random less than 500 on the x and the y co-ordinates

getmarkerpos and setmarkerpos would work.

 

Also think about updating it a bit less than once every 5 seconds! how about a couple of minutes?

 

I hope this helps.

Link to comment
Share on other sites

I think he has the loop there every 5 seconds to "simulate" the distress beacon effect. (i.e. so it blinks on the map)

 

my question to you is this...

 

are you wanting to spawn the group in the marker area? This is what I thought you were trying to do in TS earlier. But now that I read this i am having second thoughts.

 

Are you wanting the marker to just be "around" the group. (i.e. follow the group around, but not accurately, just and approximation)?

 

I need this info to try to better help you out, because both ways would be completely different.

 

lastly, how are you calling this script you have now? in the units init? in the init.sqf?

Link to comment
Share on other sites

i want it to follow the group "around". im calling the script via the squad leaders init-line with null = [this,marker1] execVM "marker.sqf"; also the 5 serconds was put there to check for randomness faster, the marker ingame will have 2-4minutes update time. 

Link to comment
Share on other sites

try this out....

https://community.bistudio.com/wiki/fn_vbs_randomPos_(VBS2)

 

so basically something like this....

_unit = _this select 0;
_marker = _this select 1;
 
 
while {alive _unit} do
{
_pos = [_unit, 50, 200] call fn_vbs_randomPos
_hm = createMarker ["_marker",_pos];
"_marker" setmarkershape "RECTANGLE";
"_marker" setMarkerBrush "DIAGGRID";
"_marker" setMarkerSize [500, 500];
"_marker" setmarkercolor "ColorRed";
 
 
sleep 5;
deleteMarker "_marker";
 
};

tweak it to your needs. where 50 is the min distance from the center and 200 is the max distance from the center (or _unit). 50 can = 0 meaning directly on the units pos.

 

this will update every 5 seconds as is and will never stay centered on the unit. I would recommend that you change it to like 10 seconds though so that players do not see a pattern of where the zone is and pinpoint the center.

Link to comment
Share on other sites

that will always put it in the center because it's always referencing exactly where they are.

 

after you create that marker think about adding or subtracting to the x/y co-ordinates to throw it off centre like a random less than 500 on the x and the y co-ordinates

getmarkerpos and setmarkerpos would work.

 

Also think about updating it a bit less than once every 5 seconds! how about a couple of minutes?

 

I hope this helps.

 
Just in case my post was invisible
Link to comment
Share on other sites

Jester yours didnt work as its a VBS2 script, but  you got me on the right track. I got it to work now, it uses a cba function, because i couldt find any good documentation on the BIS_fnc_randompos, it kept spamming me with errors.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Forum Statistics

    11.1k
    Total Topics
    66.4k
    Total Posts
×
×
  • Create New...