Jump to content
  • 0

Spawning scenery from a location array


chipsandcheese

Question

I'm using bits of code to spawn scenery (then possibly other things) at defined locations, but at random. Currently it's using code from a couple of other mods and working fine when random selecting safe positions via BIS_fnc_findsafePos. I'd like to modify it so that picks from an array of co-ords instead of using findsafePos. Ran into trouble at this point. Anyone know how to correctly set this up?

 

					waitUntil{!isNil "BIS_fnc_selectRandom"};
					_position = RoadList call BIS_fnc_selectRandom;
					_position = _position modelToWorld [0,0,0];
					waitUntil{!isNil "BIS_fnc_findSafePos"};
					_position = [_position,5,40,5,0,5,0] call BIS_fnc_findSafePos;

Tried many times already but no joy.

 

Thanks

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
_markers = [];
waitUntil { sleep 1; !isNil "sm_done" };
{
	for [{_i=0}, {_i<(_x select 0)}, {_i=_i+1}] do {
		private ["_position", "_found_position", "_j", "_near_trader","_positions"];
		waitUntil { !isNil "BIS_fnc_findSafePos" };
		_found_position = false;
		_j = 0;
		while {!_found_position} do {
			_j = _j + 1;
			if ((_x select 1) == "boat.sqf") then {
				_position = [getMarkerPos 'center',0,DynamicVehicleArea,50,0,20,1] call BIS_fnc_findSafePos;
			} else {
					_positions = [[10185,10306,0],[11180,18313,0],[10049,18488,0],[1185,10306,0],[1180,18313,0],[1049,18488,0],[19185,10306,0],[19180,18313,0],[19049,18488,0]];
					_position = _positions call BIS_fnc_selectRandom;				
					};
			};

This is what I'm trying at the moment but the RPT constantly saying I have a missing ; on the line near the bottom ending in BIS_fnc_selectRandom; and I have nothing spawning in-game. The code is currently a lot like a dynamic trader script, but altering it to use defined locations is my main hurdle before editing what actually spawns.

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
  • Advertisement
  • Discord

×
×
  • Create New...