PS: I put Some faces around where I think it might be possible to change the rope's position.
-----------
It all starts in the "chop1" 's Init field:
[] exec "CargoVariables.sqs"; [0, 1, Chop1, Chute1, Rope1, Logic1, a1] exec "CargoInit.sqs"
-----------------------------------------------
CargoVariables.sqs:
IsEmpty =
-----------------------------------------------
CargoInit.sqs:
; Usage: [_Loaded, _ID, _Chopper, _Chute, _Rope, _GlobalData(, _Cargo)] Exec "CargoInit.sqs"
; Example: [1, 5, this, chute1, rope1, gameLogic1, jeep3] exec "CargoInit.sqs" (put this in the INIT field of the chopper)
_Loaded = _This Select 0
_ID = _This Select 1
_Chopper = _This Select 2
_Chute = _This Select 3
_Rope = _This Select 4
_GlobalData = _This Select 5
; This one is a logic unit of which I'm using the position variables to store information: X=ActionID (used when
; removing action), Y=1(Has Cargo) or 0(No Cargo)
; If chopper has cargo at init then Loaded = 1, Else Loaded = 0
? (_Loaded == 1) : GoTo "HasCargo"
? (_Loaded == 0) : GoTo "NoCargo"
#HasCargo
_Cargo = _This Select 6
_GlobalData SetPos [0, 5, 0]
[_ID, _GlobalData, _Chopper, _Chute, _Cargo] Exec "CargoLoaded.sqs"
[_ID, _GlobalData, _Chopper, _Chute, _Rope] Exec "CargoRope.sqs"
GoTo "Exit"
#NoCargo
_GlobalData SetPos [0, 0, 0]
IsEmpty = IsEmpty + [_ID]
[_ID, _GlobalData, _Chopper, _Chute, _Rope] Exec "CargoRope.sqs"
[_GlobalData, _Chute] Exec "CargoChuteSaver.sqs"
#Exit
------------------------------------------------
CargoRope.sqs
_ID = _This Select 0
_GlobalData = _This Select 1
_Chopper = _This Select 2
_Chute = _This Select 3
_Rope = _This Select 4
_RopeC = -2.9
:)THIS MOVES THE ROPE FORWARDS/BACKWARDS
_XC = 0
???I TRIED TO CHANGE THAT HERE BUT WITHOUT SUCCESS
_YC = 0
???I TRIED TO CHANGE THAT HERE BUT WITHOUT SUCCESS
_AttachAvailable = 0
#Update
_ChopperPos = GetPos _Chopper
_ChopperPosX = _ChopperPos Select 0
_ChopperPosY = _ChopperPos Select 1
_ChopperPosZ = _ChopperPos Select 2
_Heading = GetDir _Chopper
? (_Heading > 90 && _Heading <= 180) : _XC = (Cos (90-(180-_Heading)))*_RopeC ; _YC = (Sin (90-(180-_Heading)))*_RopeC; _Rope SetPos [_ChopperPosX - _XC, _ChopperPosY +_YC - 0.2, _ChopperPosZ - 3.25] ; GoTo "RopeCDone"
? (_Heading > 180 && _Heading <= 270) : _XC = (Cos (90-(180-(360-_Heading))))*_RopeC ; _YC = (Sin (90-(180-(360-_Heading))))*_RopeC; _Rope SetPos [_ChopperPosX +_XC, _ChopperPosY +_YC - 0.2, _ChopperPosZ - 3.25] ; GoTo "RopeCDone"
? (_Heading > 270 && _Heading < 360) : _XC = (Cos (90-(360-_Heading)))*_RopeC ; _YC = (Sin (90-(360-_Heading)))*_RopeC; _Rope SetPos [_ChopperPosX +_XC, _ChopperPosY -_yC - 0.2, _ChopperPosZ - 3.25] ; GoTo "RopeCDone"
_XC = (Cos (90-_Heading))*_RopeC ; _YC = (Sin (90-_Heading))*_RopeC; _Rope SetPos [_ChopperPosX - _XC, _ChopperPosY - _YC - 0.2, _ChopperPosZ - 3.25]
#RopeCDone
_Rope SetDir _Heading
? (_ID In IsEmpty): GoTo "FindCargo"
? ((GetPos _GlobalData select 1) == 0): _GlobalData SetPos [(GetPos _GlobalData Select 0), 1, 0]; [_ID, _GlobalData, _Chopper, _Chute, _Cargo] Exec "CargoLoaded.sqs"
GoTo "NoAddAction"
#FindCargo
_RopePos = GetPos _Rope
_RopePosX = _RopePos Select 0
_RopePosY = _RopePos Select 1
_RopePosZ = _RopePos Select 2
? (_RopePosZ > 4.2 || _RopePosZ < 0.
: GoTo "NoAddAction"
_Cargo = NearestObject [_Rope, "Jeep"]
? ((_Rope Distance _Cargo) < 3.8 && (_Rope Distance _Cargo) > 3.4) : ActionText = "Attach Jeep"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "JeepMG"]
? ((_Rope Distance _Cargo) < 2.5) : ActionText = "Attach Jeep with Machine Gun"; goto "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "Truck5t"]
? ((_Rope Distance _Cargo) < 4.8 && (_Rope Distance _Cargo) > 4.4) : ActionText = "Attach M-939 5t Truck"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "Truck5tOpen"]
? ((_Rope Distance _Cargo) < 2.95 && (_rope Distance _Cargo) > 2.55) : ActionText = "Attach Open M-939 5t Truck"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "UAZ"]
? ((_Rope Distance _Cargo) < 3.4 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach UAZ 469B"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "Ural"]
? ((_Rope Distance _Cargo) < 4.3 && (_Rope Distance _Cargo) > 3.9) : ActionText = "Attach URAL 375 6x6"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "TruckV3SG"]
? ((_Rope Distance _Cargo) < 4.5 && (_Rope Distance _Cargo) > 4.1) : ActionText = "Attach PV3S truck"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "GJeep"]
? ((_Rope Distance _Cargo) < 3.3 && (_Rope Distance _Cargo) > 2.9) : ActionText = "Attach M151 A2 Jeep"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "UAZG"]
? ((_Rope Distance _Cargo) < 3.4 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach UAZG"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "HMMWV"]
? ((_Rope Distance _Cargo) < 3.4 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach HMMWV"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "AshHMMWVSnow"]
? ((_Rope Distance _Cargo) < 3.4 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach arctic HMMWV"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "LRDBLACKHMMWV"]
? ((_Rope Distance _Cargo) < 3.4 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach black HMMWV"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "M113"]
? ((_Rope Distance _Cargo) < 3.58 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach M113"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "AshM113Snow"]
? ((_Rope Distance _Cargo) < 3.58 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach arctic M113"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "Vulcan"]
? ((_Rope Distance _Cargo) < 3.58 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach M-163 Vulcan"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "AshSnowVulcan"]
? ((_Rope Distance _Cargo) < 3.58 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach arctic M-163 Vulcan"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "BRDM"]
? ((_Rope Distance _Cargo) < 3.55 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach BRDM-2"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "KEGSUAZ"]
? ((_Rope Distance _Cargo) < 3.4 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach arctic UAZ 469B"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "KEGSUAZG"]
? ((_Rope Distance _Cargo) < 3.4 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach arctic UAZG"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "KEGSUral"]
? ((_Rope Distance _Cargo) < 4.3 && (_Rope Distance _Cargo) > 3.9) : ActionText = "Attach arctic URAL 375 6x6"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "KEGSTruck5t"]
? ((_Rope Distance _Cargo) < 4.8 && (_Rope Distance _Cargo) > 4.4) : ActionText = "Attach arctic M-939 5t Truck"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "KEGSJeep"]
? ((_Rope Distance _Cargo) < 3.8 && (_Rope Distance _Cargo) > 3.4) : ActionText = "Attach arctic Jeep"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "KEGSJeepMG"]
? ((_Rope Distance _Cargo) < 2.5) : ActionText = "Attach arctic Jeep with Machine Gun"; GoTo "DetailedPosCheck"
_Cargo = nearestObject [_Rope, "KEGSTruckV3SG"]
? ((_Rope Distance _Cargo) < 4.5 && (_Rope Distance _Cargo) > 4.1) : ActionText = "Attach arctic PV3S truck"; GoTo "DetailedPosCheck"
_Cargo = NearestObject [_Rope, "LincolnWhite"]
? ((_Rope Distance _Cargo) < 4.8 && (_Rope Distance _Cargo) > 3) : ActionText = "Attach Lincoln"; GoTo "DetailedPosCheck"
GoTo "NoAddAction"
#DetailedPosCheck
_CargoPos = GetPos _Cargo
_CargoPosX = _CargoPos Select 0
_CargoPosY = _CargoPos Select 1
_CargoPosZ = _CargoPos Select 2
_Heading = GetDir _Rope
_HeadingCargo = GetDir _Cargo
? (_Heading > 345 && _HeadingCargo < 15) : _Heading = _Heading - 360
? (_HeadingCargo > 345 && _Heading < 15) : _HeadingCargo = _HeadingCargo - 360
_HeadingOffset = Abs (_Heading - _HeadingCargo)
? ((Abs (_RopePosX - _CargoPosX)) < 0.75 && (Abs (_RopePosY - (_CargoPosY + 0.37))) < 10 && _HeadingOffset < 40) : GoTo "DoAddAction"
GoTo "NoAddAction"
#DoAddAction
? (_AttachAvailable == 0 && (GetPos _GlobalData Select 1) == 0) : _Chopper AddAction [ActionText, Format ["CargoAttach01.sqs", _ID]] ; _AttachAvailable = 1
GoTo "Done"
#NoAddAction
? (_AttachAvailable == 1) : _Chopper RemoveAction (GetPos _GlobalData Select 0) ; _GlobalData SetPos [(GetPos _GlobalData Select 0)+1, (getpos _GlobalData Select 1), 0]; _AttachAvailable = 0
#Done
? (!Alive _Chopper) : GoTo "Exit"
~0.005
GoTo "Update"
#Exit
; Kill chutesaver and rope
_GlobalData SetPos [0, 1, 0]
_Rope SetPos [0, 0, 3]
-----------------------------------------------