S.Newbould 1 Posted January 4, 2014 Hi guys newbie to coding here :confused: Just playing around trying to teach myself a few things and reading materials and what not and decided I would try to make a vehicle spawner with a simple addAction command on a AI unit. I have noticed when I click on the action to spawn in my vehicle it spawns it however say I wanted to spawn another one it would spawn it next to the previous vehicle I spawned. Essentially what I am trying to find out is how to stop say another vehicle spawning if one is already on the spawn point so when its moved another one can be spawned in the same position without being spawned next to it... Thanks in advanced for your help! Code so far: _newPlane = "I_Plane_Fighter_03_CAS_F" createVehicle (position planeSpawn); _newPlane setDir 205; Share this post Link to post Share on other sites
joejoe87577 10 Posted January 5, 2014 You could use this: _vehCheck= nearestObjects[position planeSpawn,["landVehicle","Air","Ship"],radius] select 0; //Checks for vehicles at the given Position with inside the radius if(!isNil "_vehCheck") then { deleteVehicle _vehCheck; } else { _newPlane = "I_Plane_Fighter_03_CAS_F" createVehicle (position planeSpawn); _newPlane setDir 205; }; Share this post Link to post Share on other sites
KC Grimes 79 Posted January 5, 2014 Rather than deleting the vehicle that's in the way, could warn the player of its presence and not allow the spawn by just replacing the deleteVehicle line in the above code with a hint or chat message. Share this post Link to post Share on other sites
S.Newbould 1 Posted January 5, 2014 Thanks to both it got me what I wanted! Grimes thats what I wanted in the first place! haha... Share this post Link to post Share on other sites