Jump to content
Sign in to follow this  
Cold Evil

Condition of Placement Only When players are inside the Vehicle

Recommended Posts

Hi

I’m making CooP mission were there are some vehicles spawning as playable in the player team. BUT if the players don’t choose to play the crewman of the vehicle. The vehicle in turn should do not be spawned.

How do I set up the condition right to make this happen?

Share this post


Link to post
Share on other sites

By "spawning is as playable" I am assuming that you mean you are selecting the vehicle from the BLUFOR catagory in the editor, not Empty, thus it spawns with an AI crew (that can be replaced by taking their spot, if Playable).

Didn't know this occurred, but I suppose it makes sense. Anyway, here's a fix.

In the init.sqf, make sure the player has loaded by adding a sleep or waitUntil {player == player};

Then, add the following code, where tank1 is the name of the vehicle you want deleted if empty (just change the name for other vehicles, or make an array to be used in forEach).

if (({_x in (crew tank1)} count playableUnits) == 0) then {deleteVehicle tank1};

Note: If on low enough difficulty where map shows friendly units, the vehicle will still show up on the initial map/briefing page, but once you pass that page it will be deleted, and obviously no longer shown on the map.

Another way to do this is to place Playable crewmen in the editor and then make a script so that if they are !isNil && alive then spawn an empty tank and put them in the desired position via moveInDesiredpositionhere and assignAsDesiredpositionhere. But I suggest the first option, if this is a simple mission.

Edited by Grimes [3rd ID]

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  

×