Home   Help Search Login Register  

Author Topic: Problems deleting CH53  (Read 457 times)

0 Members and 1 Guest are viewing this topic.

sans-pareil

  • Guest
Problems deleting CH53
« on: 09 Sep 2003, 19:33:57 »
Hello everyone,
Haven't been around for a while. I have made a simple script (using 1.92beta)  that grabs a pre-defined dude, creates a CH53, at a pre-defined (marker) location, and then the guy flies the ch53 to a place clicked by the players (using the onmapsingleclick command), and then some vehicles get created behind and under the CH53, making it look like they have been pushed out the open ramp. So far so good. It all works, the choppers are relatively good at dodging obstacles and mountains, and it looks real cool. Now comes the problem. When the chopper flies away, after a bit, the pilot is transported to a pre-defined safezone (all my missions have a "safeW" market), and the chopper is moved away and then I would like it deleted. Now, there's the problem... using the deletevehicle command... it always causes a crash to desktop. If anyone has any idea how to solve this,

here's how the script is called:

In the On Activation field of a radio alpha present repeatedly trigger covering the whole map:

pilot sidechat "Where do you want your gear, grunts?"; onmapsingleclick {"HMMWV",1,_pos,pilot] exec "vehicledrop.sqs"

And the whole script follows below. I have left the "deletevehicle _para" command out from just before the "exit" at the bottom, because it works like this. It just causes a broken CH53 to be added to the pile of broken choppers at the bottom of the sea each time it's called. I suppose I could just use a named ch53 which is repaired at the beginning of each script, but I would prefer not to, it's a last ditch solution. If anyone knows a solution it would be very helpful. I was thinking of reconfigging a version of the CH53 without all the bells and whistles, but if there's a simpler solution, that would be great.

Code: [Select]
_type = _this select 0
_number = _this select 1
_drop = _this select 2
_pilot = _this select 3
_planetype = "SPC_CH53"
_dropX = _drop select 0
_dropZ = _drop select 1
_inbound = getmarkerpos "taskforce"
_para = _planetype createvehicle _inbound
_pilot moveindriver _para
_para setdir 180
_para setvelocity [0,-100,100]
_para sidechat "Roger that, we are inbound, out."
_logic = "logic" createvehicle _drop
_para domove _drop
_para flyinheight _approachheight
_para setspeedmode "FULL"
_height = 7
_approachheight = 50
_topheight = 80
_speedmod = 0.65
_amount = 0
_preplapes = 0
_para animate ["nosegearanim", 1]
_para animate ["leftgearanim", 1]
_para animate ["rightgearanim", 1]
_para animate ["lgdooranim", 1]
~5
goto "check"

#check
?(getpos _para select 2)<8 and (velocity _para select 2)<0: _para setvelocity [velocity _para select 0, velocity _para select 1, 0]
?(_para distance _logic)<200: _para flyinheight _height
?(_logic distance _para)<100 and (_preplapes == 0): goto "preplapes"
?(_logic distance _para)<50: goto "lapes"
?!(alive _para): goto "delpara"
goto "check"

#preplapes
_para setspeedmode "LIMITED"
_para animate ["Dvere1", 1]
_para animate ["nosegearanim", 0]
_para animate ["leftgearanim", 0]
_para animate ["rightgearanim", 0]
_para animate ["lgdooranim", 0]
_preplapes = 1
goto "check"

#lapes
?(_amount == _number): goto "leave"
_amount = _amount +1
_voiture = _type createvehicle getmarkerpos "safew"
_voiture setdir getdir _para
_pp = getpos _para
_ppX = _pp select 0
_ppZ = _pp select 1
_ppY = _pp select 2
_voiture setpos [_ppX, _ppZ, (_height -5)]
_voiture setvelocity [velocity _para select 0, velocity _para select 1, (velocity _para select 2) * _speedmod]
_voiture domove [_ppX,_ppZ,0]
[_voiture] exec "\l3escripts\coolstuff.sqs"
~2
goto "lapes"

#leave
_para domove _inbound
_para flyinheight _approachheight
_para setspeedmode "FULL"
~5
_para animate ["nosegearanim", 1]
_para animate ["leftgearanim", 1]
_para animate ["rightgearanim", 1]
_para animate ["lgdooranim", 1]
_para animate ["Dvere1", 0]
_para flyinheight _topheight
~45
_para sidechat "Returning to base, out."
goto "delpara"

#delpara
deletevehicle _logic
_pilot setpos markerpos "safew"
_para setammocargo 0
_para setfuel 0
_para setdamage 1
_para setpos [50,50,0]
exit