Jump to content
Sign in to follow this  
bangabob

get vehicle Positions

Recommended Posts

I am writing a script which will spawn a vehicle and automatically spawn the driver,gunner and commander.

However if the vehicle has no gunner position or commander position the unit will be spawned outside the vehicle.

	_unitType=_pool select (floor(random(count _pool)));
	_s1 = _grp createUnit [_unitType, _pos, [], 0, "FORM"];   	
	_s1 moveindriver _veh; 

	_s2 = _grp createUnit [_unitType, _pos, [], 0, "FORM"]; 
	_unitType=_pool select (floor(random(count _pool)));
	_s2 moveingunner _veh;

	_unitType=_pool select (floor(random(count _pool)));
	_s3 = _grp createUnit [_unitType, _pos, [], 0, "FORM"];  
	_s3 moveincommander _veh; 

So what i need is a condition which will detect whether the commander position/gunner position exists.

Thanks for reading

Share this post


Link to post
Share on other sites

createVehicleCrew will spawn gunners in turret positions as well. (Really complex to work out turret positions by hand).

Share this post


Link to post
Share on other sites

Nice one 5133p39. Not seen that command before. Certainly seems to do the job and is much simpler than counting the available positions. :)

Share this post


Link to post
Share on other sites
emptyPositions generally does the job

http://community.bistudio.com/wiki/emptyPositions

Thanks that was exactly what i was looking for.

---------- Post added at 15:01 ---------- Previous post was at 15:00 ----------

createVehicleCrew will spawn gunners in turret positions as well. (Really complex to work out turret positions by hand).

Yes i didnt know that command. It may well be useful for another script

Share this post


Link to post
Share on other sites

BIS_fnc_vehicleRoles returns array of roles & indexes, like: [["Driver",[]],["Turret",[0,1]],["Cargo",[0]]]

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  

×