exikutioner 10 Posted June 1, 2014 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
KC Grimes 79 Posted June 1, 2014 Could count the number of emptyPositions, and if its at max then deleteVehicle. Share this post Link to post Share on other sites
SilentSpike 84 Posted June 1, 2014 {if ((crew _x) isEqualTo []) then { deleteVehicle _x; };} forEach _arrayOfKartObjects; Share this post Link to post Share on other sites
KC Grimes 79 Posted June 1, 2014 {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
exikutioner 10 Posted June 1, 2014 {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
SilentSpike 84 Posted June 1, 2014 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
tomturner 10 Posted June 1, 2014 (edited) {if ((crew _x) isEqualTo []) then { deleteVehicle _x; };} forEach _arrayOfKartObjects; use instead: if ((crew _x) == []) then {{deleteVehicle _x;} forEach _arrayOfKartObjects;}; Edited June 2, 2014 by tomturner Share this post Link to post Share on other sites
SilentSpike 84 Posted June 1, 2014 isEqualTo is quicker, your snippet is also missing the closing } Share this post Link to post Share on other sites