draoth 13 Posted January 13, 2018 Hello everyone i'm trying to create a unit that spawns in a vehicle and goes to a random location. But when i spawn the unit with createvehicle it won't move... *I tried waypoints and domove* I've done a lot of trial and error and can't figure it out. It's probably something very stupid since i'm not that familiar with scripTing in general. this is my code that is being called with an addaction: _Location = [] call BIS_fnc_randomPos; _Road = [_Location, 1000, []] call BIS_fnc_nearestRoad; _Destination = getPos _Road; _group = createGroup civilian; _AI = nil; _AI2 = nil; _AI3 = nil; _Pass = selectrandom [1,2,3]; _AIChoose = selectRandom ["C_man_1","C_man_polo_1_F_euro","C_man_polo_6_F_euro","C_Nikos_aged","C_Nikos_aged","C_man_sport_1_F_afro"]; _VEHChoose = selectRandom ["C_Offroad_01_F","C_Offroad_01_repair_F","C_Truck_02_covered_F","C_Truck_02_transport_F","C_Hatchback_01_F","C_Hatchback_01_sport_F","C_SUV_01_F","C_Van_01_transport_F","C_Van_01_box_F","C_Van_01_fuel_F","C_Offroad_02_unarmed_F"]; _veh = createVehicle [_VEHChoose, position Pris1, [], 0,""]; //Add passengers _AI = createVehicle [_AIChoose, position Pris1, [], 0, "CAN_COLLIDE"]; _AI setBehaviour "Aware"; _AI doMove (_Destination); _AI enableSimulation true; if (_Pass > 1) then { _AIChoose = selectRandom ["C_man_1","C_man_polo_1_F_euro","C_man_polo_6_F_euro","C_Nikos_aged","C_Nikos_aged","C_man_sport_1_F_afro"]; _AI2 = createVehicle [_AIChoose, position Pris1, [], 0, "CAN_COLLIDE"]; _AI2 setBehaviour "Aware"; _AI2 enableSimulation true; }; if (_Pass > 2) then { _AIChoose = selectRandom ["C_man_1","C_man_polo_1_F_euro","C_man_polo_6_F_euro","C_Nikos_aged","C_Nikos_aged","C_man_sport_1_F_afro"]; _AI3 = createVehicle [_AIChoose, position Pris1, [], 0, "CAN_COLLIDE"]; _AI3 setBehaviour "Aware"; _AI3 enableSimulation true; }; //Add Movein _AI moveInAny _veh; if (_Pass > 1) then { _AI2 moveInAny _veh; }; if (_Pass > 2) then { _AI3 moveInAny _veh; }; I hope someone can help me with this rookie problem. Draoth Share this post Link to post Share on other sites
panther42 40 Posted January 13, 2018 do NOT use createVehicle for units... You could use createVehicleCrew, or BIS_fnc_spawnVehicle, with same. Alternate: createUnit 2 Share this post Link to post Share on other sites
pierremgi 4739 Posted January 13, 2018 bis_fnc_spawnGroup can spawn a vehicle with its standard crew, just with the vehicle class. Simple, and you can addWaypoint on group in the next line. 1 Share this post Link to post Share on other sites
draoth 13 Posted January 13, 2018 11 hours ago, panther42 said: do NOT use createVehicle for units... You could use createVehicleCrew, or BIS_fnc_spawnVehicle, with same. Alternate: createUnit Hey panther thanks for your response, I want to create the vehicle with a random amount of units in it. And i don't want them to look the same so i went with createUnit I switched this line : _AI = createVehicle [_AIChoose, position Pris1, [], 0, "CAN_COLLIDE"]; With this line : _AI = _group2 createUnit ["_AIChoose", position Pris1, [], 0, "FORM"]; But now they won't even appear. It doesn't even throw an error. Any idea what i'm doing wrong?: or is there a better way to accomplish what i want to create? Draoth Share this post Link to post Share on other sites
gc8 970 Posted January 13, 2018 8 minutes ago, draoth said: _AI = _group2 createUnit ["_AIChoose", position Pris1, [], 0, "FORM"]; Take the quotation marks away from _AIChoose Share this post Link to post Share on other sites
pierremgi 4739 Posted January 13, 2018 As panther42 said, you can create vehicle with createVehicle, but this command produces wax Ais (no movement) for units. You'll fail to addWaypoint or move this kind of wax museum. 1 Share this post Link to post Share on other sites
draoth 13 Posted January 13, 2018 10 hours ago, gc8 said: Take the quotation marks away from _AIChoose 4 hours ago, pierremgi said: As panther42 said, you can create vehicle with createVehicle, but this command produces wax Ais (no movement) for units. You'll fail to addWaypoint or move this kind of wax museum. Thanks guys! I lol'd at the wax museum. Have a good day! Share this post Link to post Share on other sites