{"name":"moveInCargo","title":"moveInCargo","type":"command","url":"https://community.bistudio.com/wiki/moveInCargo","revid":351994,"updated":"2024-02-01T23:23:57Z","groups":["Unit Control"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","locality":{"argument":"local","effect":"global"},"description":"Moves a unit into a vehicle cargo position (immediately and without animation).\n\n> [!NOTE]\n> See AI Group Vehicle Management for more information.\n\n> [!IMPORTANT]\n> If the unit is already in a vehicle, nothing will happen. You should use moveOut to move the unit out of his vehicle before trying to move him into a new (or same) vehicle.","syntaxes":[{"syntax":"unit moveInCargo vehicle","params":[{"name":"unit","type":"Object","type_expr":"Object"},{"name":"vehicle","type":"Object","type_expr":"Object"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"unit"},"right":{"text":"vehicle"}},{"syntax":"unit moveInCargo [vehicle, cargoIndex, canReassign]","params":[{"name":"unit","type":"Object","type_expr":"Object"},{"name":"vehicle","type":"Object","type_expr":"Object"},{"name":"cargoIndex","type":"Number","type_expr":"Number"},{"name":"canReassign","type":"Boolean","optional":true,"default":"true","description":"try to move *unit* into the first free *vehicle* cargo seat if *cargoIndex* is already occupied","type_expr":"Boolean","since":"arma3 2.08","text":"canReassign: Boolean - (Optional, default true) try to move *unit* into the first free *vehicle* cargo seat if *cargoIndex* is already occupied"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"unit"},"right":{"text":"[vehicle, cargoIndex, canReassign]"}}],"examples":[{"code":["_soldierOne moveInCargo _jeepOne;"]},{"code":["_soldierOne moveInCargo [_jeepOne, 1];"]}],"multiplayer":"> [!NOTE]\n> The command should execute where the **unit** (not **vehicle**) is local.","see_also":["moveInAny","moveInCommander","moveInDriver","moveInGunner","moveInTurret","assignAsCargo","assignAsCommander","assignAsDriver","assignAsGunner","getCargoIndex"],"notes":[{"user":"Hardrock","date":"2006-08-04T14:42:00Z","text":"*Notes from before the conversion*\nIf you place a soldier in a vehicle with the moveInCargo command, he wont \"know\" he's in the vehicle, and thus he won't disembark properly when the vehicle reaches a Transport Unload waypoint.\nTherefore you have to use the assignAsCargo command, in order for the AI to catch on. Something like this:\n\n```sqf\n_soldier moveInCargo helo1; _soldier assignAsCargo helo1;\n```"},{"user":"Ceeeb","date":"2007-02-02T07:00:00Z","text":"In **OFP v1.96**, the moveIn commands will not trigger an associated getIn event. To ensure the getIn event is fired, use the \"getIn Cargo\" action command."},{"user":"Killzone_Kid","date":"2014-03-18T19:08:00Z","text":"In Arma 3 when using the alternative syntax of moveInCargo, it is necessary to call assignAsCargoIndex because it is not called automatically.\n\n```sqf\nunit1 moveInCargo [heli, 3];\nunit1 assignAsCargoIndex [heli, 3];\n```\n\nAlternatively avoid this broken syntax all together and use:\n\n```sqf\nunit1 assignAsCargoIndex [heli, 3];\nunit1 moveInCargo heli;\n```"}]}