Jump to content
Sign in to follow this  
exikutioner

Check player script help

Recommended Posts

I am trying to set a script/init for playable vics. Basically I want to check if there is a player in the slot (driver for a kart), and delete if there is not. No point in cluttering the start line with karts that have no driver! Thanks for the help.

Share this post


Link to post
Share on other sites

Could count the number of emptyPositions, and if its at max then deleteVehicle.

Share this post


Link to post
Share on other sites
{if ((crew _x) isEqualTo []) then {
deleteVehicle _x;
};} forEach _arrayOfKartObjects;

Share this post


Link to post
Share on other sites
{if ((crew _x) isEqualTo []) then {
deleteVehicle _x;
};} forEach _arrayOfKartObjects;

Or the reciprocal of what I said, yes :P

Share this post


Link to post
Share on other sites
{if ((crew _x) isEqualTo []) then {
deleteVehicle _x;
};} forEach _arrayOfKartObjects;

I get a local variable error with that. I am probably deploying it incorrectly though. Tried as an init on a kart, but cant even click ok with that. Then tried it in as a script, but got an error on the first line; something about encountering a { instead of =.

Share this post


Link to post
Share on other sites

If you want to put it in the init field of the karts then you'd need to use this format:

if ((crew this) isEqualTo []) then {
deleteVehicle this;
};

If you want to use my original format than you'd need to replace _arrayOfKartObjects with an array of the kart objects :p If you already did that then I'm not entirely sure what's going wrong.

Share this post


Link to post
Share on other sites

{if ((crew _x) isEqualTo []) then {
deleteVehicle _x;
};} forEach _arrayOfKartObjects; 

use instead:

if ((crew _x) ==  []) then {{deleteVehicle _x;} forEach _arrayOfKartObjects;}; 

Edited by tomturner

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  

×