Kjeksen1987 0 Posted March 17, 2021 Hm, unit wont go in chopper with this script. Can anyone point me in the right direction? Needless to say, I am very new to scripting but having a blast nonetheless. Quote if (isServer) then { _crew1 = creategroup EAST; _airframe1 = [getMarkerPos "marker1", 220, "CUP_O_MI6T_TKA", _crew1] call BIS_fnc_spawnVehicle; _plane = _airframe1 select 0; //SPAWN HVT AND PUT IN CHOPPER hvt = "CUP_O_TK_INS_Commander" createVehicle getmarkerpos "hvtSpawn"; hvt moveInCargo [ _plane, 3]; hvt assignAsCargoIndex [ _plane, 3]; //WP FOR CHOPPER, MAKE IT LAND IN DESIGNATED AREA _wp1 = _crew1 addWaypoint [(getmarkerpos "marker2"), 0]; _wp1 setWaypointType "TR UNLOAD"; _wp1 setWaypointSpeed "LIMITED"; _wp1 setwaypointstatements [ "true" ,"this land 'land'"]; sleep 2; //MOVE CHOPPER AWAY AFTER TRANSPORT UNLOAD AND DELETEVEHICLE _wp2 = _crew1 addWaypoint [(getmarkerpos "marker4"), 0]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointSpeed "LIMITED"; _wp2 setWaypointStatements ["true", "deleteVehicle (vehicle this);{deleteVehicle _x} forEach thislist; deleteGroup (group this)"]; }; I made hvt a global variable for it to be available in another script. Any help is much appreciated Share this post Link to post Share on other sites
7erra 629 Posted March 17, 2021 22 minutes ago, Kjeksen1987 said: hvt = "CUP_O_TK_INS_Commander" createVehicle getmarkerpos "hvtSpawn"; for AI you have to use createUnit instead of createVehicle Share this post Link to post Share on other sites
Kjeksen1987 0 Posted March 17, 2021 But createUnit does not have a return value? I would like to check later if hvt is dead with !alive hvt Share this post Link to post Share on other sites
7erra 629 Posted March 17, 2021 only the alternative syntax does not have a return value, the first one does: Quote Syntax: group createUnit [type, position, markers, placement, special] Parameters: group: Group - Existing group new unit will join [type, position, markers, placement, special]: Array type: String - Class name of unit to be created as per CfgVehicles position: Position, Position2D, Object or Group - Location unit is created at. In case of Group position of the group leader is used markers: Array - Placement markers placement: Number - Placement radius special: String - Unit placement special, one of: "NONE" - The unit will be created at the first available free position nearest to given position "FORM" - Not implemented, currently functions the same as "NONE". "CAN_COLLIDE" - The unit will be created exactly at passed position "CARGO" - The unit will be created in cargo of the group's vehicle, regardless of the passed position (see Example 5). If group has no vehicle or there is no cargo space available, the unit will be placed according to "NONE". To check available cargo space use: _hasCargo = _veh emptyPositions "CARGO" > 0; Return Value: Object - The created unit https://community.bistudio.com/wiki/createUnit 1 Share this post Link to post Share on other sites
Joe98 91 Posted March 17, 2021 Another option is to place the HVT and the chopper on the map and give a command that has him enter the chopper as a passenger. . Share this post Link to post Share on other sites
Kjeksen1987 0 Posted March 21, 2021 Spawning in chopper works like a charm now! Thanks alot. No onward to next thing I have tinkered with that I cant seem to understand. Just a simple "isTouchingGround". I want to check if HVT has landed on ground from the chopper and then do a "doMove" so he doesnt stand still like a retard waiting to get shot. Here is the code: //CHECK IF HVT HAS LANDED _hvtWalking = isTouchingGround hvt; //SIMPLE CHECK IF SYNTAX WORKING if(_hvtWalking) then { hint "HVT IS TOUCHING GROUND"; hvt doMove (getMarkerPos "markerHvtGo" ); }; // SIMPLE CHECK IF SYNTAX IS NOT WORKING if (isNil "_hvtWalking") then { hint "NOT REGISTRATING HVT LANDED"}; I cant seem to get a return from either the "it worked" check nor the "it didnt work" check. I dont understand. This should be really simple 😂 No errors when I start the mission. Share this post Link to post Share on other sites
pierremgi 4853 Posted March 21, 2021 4 hours ago, Kjeksen1987 said: //CHECK IF HVT HAS LANDED _hvtWalking = isTouchingGround hvt; //SIMPLE CHECK IF SYNTAX WORKING if(_hvtWalking) then { hint "HVT IS TOUCHING GROUND"; hvt doMove (getMarkerPos "markerHvtGo" ); }; // SIMPLE CHECK IF SYNTAX IS NOT WORKING if (isNil "_hvtWalking") then { hint "NOT REGISTRATING HVT LANDED"}; I cant seem to get a return from either the "it worked" check nor the "it didnt work" check. IsTouchingGround is for the helo. So, you can test isTouchingGround vehicle hvt but... There are 3 modes for landing an helo: get out, get in and land (complete stop). If you perform a complete stop, there is some chance for touching ground. The 2 first, no. The helo is hovering at very slow altitude. Use something like (getPosATL vehicle hvt select 2 < 2) isNil "_hvtWalking" is false because you just defined it above! this local variable can be false or true but it exists. You want to test: if (_hvtWalking) then {..} simple as that. This variable returns false or true. Next step: landing in combat ambiance ? Share this post Link to post Share on other sites
Kjeksen1987 0 Posted March 21, 2021 I would like to check if the officer (HVT) has disembarked the chopper and are on the ground. IsTouchingGround cannot be used for him? If he has exited the chopper then I would like to continue. Not landing in combat ambiance this chopper 🙂 Here is what is used to make the chopper land: _wp1 = _crew1 addWaypoint [(getmarkerpos "marker2"), 0]; _wp1 setWaypointType "TR UNLOAD"; _wp1 setWaypointSpeed "LIMITED"; _wp1 setwaypointstatements [ "true" ,"this land 'land'"]; Share this post Link to post Share on other sites
pierremgi 4853 Posted March 21, 2021 1 hour ago, Kjeksen1987 said: I would like to check if the officer (HVT) has disembarked the chopper and are on the ground. IsTouchingGround cannot be used for him? If he has exited the chopper then I would like to continue. Not landing in combat ambiance this chopper 🙂 Here is what is used to make the chopper land: _wp1 = _crew1 addWaypoint [(getmarkerpos "marker2"), 0]; _wp1 setWaypointType "TR UNLOAD"; _wp1 setWaypointSpeed "LIMITED"; _wp1 setwaypointstatements [ "true" ,"this land 'land'"]; Your waypoint "TR UNLOAD" seems to me useless without a "GETOUT" waypoint for your HVT , but it's not mandatory. You can write a simple "move" wpt as you order a complete landing. IsTouchingGround on HVT means your HVT is on ground, so should work on complete landing. But... your HVT is perhaps not created. Use createUnit as already said. Something like: 0 = [] spawn { if (isServer) then { _crew1 = creategroup EAST; _airframe1 = [getMarkerPos "marker1", 220, "CUP_O_MI6T_TKA", _crew1] call BIS_fnc_spawnVehicle; _plane = _airframe1 select 0; hvt = createGroup EAST createUnit ["CUP_O_TK_INS_Commander",[0,0,0],[],0,"NONE"]; hvt moveInCargo [ _plane, 3]; hvt assignAsCargoIndex [ _plane, 3]; _wp1 = _crew1 addWaypoint [(getmarkerpos "marker2"), 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "LIMITED"; _wp1 setWaypointStatements [ "true","vehicle this land 'land'"]; waitUntil {isTouchingGround _plane}; doGetOut hvt; unassignVehicle hvt; sleep 2; _wp2 = _crew1 addWaypoint [(getmarkerpos "marker4"), 0]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointSpeed "LIMITED"; _wp2 setWaypointStatements ["true", "private _helo = vehicle this; private _grp = group this; {_helo deleteVehicleCrew _x} count crew _helo; deleteVehicle _helo; deleteGroup _grp"]; }; }; Share this post Link to post Share on other sites