{"name":"moveInCargo","operator":null,"title":"moveInCargo","type":"command","url":"https://community.bistudio.com/wiki/moveInCargo","revid":351994,"updated":"2024-02-01T23:23:57Z","groups":["Unit Control"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"unit","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"unit: Object"},{"name":"vehicle","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"vehicle: Object"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"unit","types":["Object"]},"right":{"text":"vehicle","types":["Object"]}},{"syntax":"unit moveInCargo [vehicle, cargoIndex, canReassign]","since":null,"effect":null,"exec":null,"params":[{"name":"unit","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"unit: Object"},{"name":"vehicle","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"vehicle: Object"},{"name":"cargoIndex","type":"Number","optional":false,"default":null,"description":null,"types":["Number"],"since":null,"text":"cargoIndex: 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","types":["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","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"unit","types":["Object"]},"right":{"text":"[vehicle, cargoIndex, canReassign]","types":["Array"]}}],"examples":[{"text":"```sqf\n_soldierOne moveInCargo _jeepOne;\n```","code":["_soldierOne moveInCargo _jeepOne;"]},{"text":"```sqf\n_soldierOne moveInCargo [_jeepOne, 1];\n```","code":["_soldierOne moveInCargo [_jeepOne, 1];"]}],"multiplayer":"> [!NOTE]\n> The command should execute where the **unit** (not **vehicle**) is local.","problems":null,"aliases":[],"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*\n\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```"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Unit Control","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}