rasmith1030 10 Posted August 30, 2015 I wrote some simple scripts to support my own missions a while ago. Now, after the latest update, the scripts are not working. For example, when I spawn a helicopter unit about 50 meters above the ground, and let it fly to a waypoint - it worked fine in the past. Now, the helicopter spawns and spins into the ground. Has anyone else noticed that older scripts are now not working, and is there a fix? Thanks!! Share this post Link to post Share on other sites
jw custom 56 Posted August 30, 2015 If you show us the script it would be a lot easier to help you :) Share this post Link to post Share on other sites
rasmith1030 10 Posted August 30, 2015 I can't seem to post the script. How do I do it? Share this post Link to post Share on other sites
rasmith1030 10 Posted August 30, 2015 Here it is: ////////////////////////////////////////////////////////////////// // Function file for Armed Assault // Created by: RASmith1030 // // RAS_insertion_v2.sqf // // Description: A new and clean version of the insertion script. ////////////////////////////////////////////////////////////////// if (!isServer) exitWith {}; hint "Helicopter Inbound"; _spawnPos = getMarkerPos "heliSpawnMrk"; _extractPos = getMarkerPos "baseMrk"; _basePos = getMarkerPos "dropMrk"; _spawnDir = [_spawnPos, _extractPos] call BIS_fnc_dirTo; _helisv = [_spawnPos, _spawnDir, "UH60M", blufor] call BIS_fnc_spawnVehicle; heli = _helisv select 0; heliGroup = _helisv select 2; { _x disableAI "AUTOTARGET"; _x disableAI "TARGET"; _x allowFleeing 0; _x setCaptive _captive; } forEach (units heliGroup); _dir = direction heli; heli setVelocity [sin(_dir)*60,cos(_dir)*60,0]; heli setPosATL [getPos heli select 0, getPos heli select 1, 500]; _wp0 = heliGroup addWaypoint [_extractPos, 0]; _wp0 setWaypointType "MOVE"; _wp0 setWaypointSpeed "FULL"; _wp0 setWaypointBehaviour "CARELESS"; _wp0 setWaypointStatements ["true", "(vehicle this) land 'GET IN'; {(vehicle this) animate[_x, 1]} forEach ['MoveCargoDoor','MoveCargo2Door']"]; waituntil {{_x in heli} count (units _groupPlayer) == {alive _x} count (units _groupPlayer)}; sleep 5; {heli animate[_x, 0]} forEach ['MoveCargoDoor','MoveCargo2Door']; _wp1 = heliGroup addWaypoint [_basePos, 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FULL"; _wp1 setWaypointBehaviour "COMBAT"; _wp1 setWaypointStatements ["true", "(vehicle this) land 'GET OUT'; {(vehicle this) animate[_x, 1]} forEach ['MoveCargoDoor','MoveCargo2Door']"]; waituntil {{_x in heli} count (units _groupPlayer) == 0}; sleep 5; {heli animate[_x, 0]} forEach ['MoveCargoDoor','MoveCargo2Door']; Share this post Link to post Share on other sites
R3vo 2654 Posted August 30, 2015 There are tons of undefined variables in that script. Share this post Link to post Share on other sites
f2k sel 164 Posted August 30, 2015 I wouldn't say tons two or three, I'm not sure about vehicle type unless it's an addon. I changed vehicle for a UH80 and then made changes to the door animations to match. It is working now for me. ////////////////////////////////////////////////////////////////// // Function file for Armed Assault // Created by: RASmith1030 // // RAS_insertion_v2.sqf // // Description: A new and clean version of the insertion script. ////////////////////////////////////////////////////////////////// if (!isServer) exitWith {}; hint "Helicopter Inbound"; _spawnPos = getMarkerPos "heliSpawnMrk"; _extractPos = getMarkerPos "baseMrk"; _basePos = getMarkerPos "dropMrk"; _spawnDir = [_spawnPos, _extractPos] call BIS_fnc_dirTo; _helisv = [_spawnPos, _spawnDir, "B_Heli_Transport_01_F", BLUFOR] call BIS_fnc_spawnVehicle;// "UH60M" heli = _helisv select 0; heliGroup = _helisv select 2; { _x disableAI "AUTOTARGET"; _x disableAI "TARGET"; _x allowFleeing 0; _x setCaptive true;// _captive } forEach (units heliGroup); _dir = direction heli; heli setVelocity [sin(_dir)*60,cos(_dir)*60,0]; heli setPosATL [getPos heli select 0, getPos heli select 1, 500]; _wp0 = heliGroup addWaypoint [_extractPos, 0]; _wp0 setWaypointType "MOVE"; _wp0 setWaypointSpeed "FULL"; _wp0 setWaypointBehaviour "CARELESS"; _wp0 setWaypointStatements ["true", "(vehicle this) land 'GET IN'; {(vehicle this) animatedoor [_x, 1]} forEach ['door_R','door_L']"];// amnimate , 'MoveCargoDoor','MoveCargo2Door' waituntil {{_x in heli} count (units group Player) == {alive _x} count (units group Player)};// _groupplayer sleep 5; {heli animatedoor [_x, 0]} forEach ['door_R','door_L'];// amnimate , 'MoveCargoDoor','MoveCargo2Door' _wp1 = heliGroup addWaypoint [_basePos, 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FULL"; _wp1 setWaypointBehaviour "COMBAT"; _wp1 setWaypointStatements ["true", "(vehicle this) land 'GET OUT'; {(vehicle this) animatedoor [_x, 1]} forEach ['door_R','door_L']"];// amnimate , 'MoveCargoDoor','MoveCargo2Door' waituntil {{_x in heli} count (units group Player) == 0};// _groupplayer sleep 5; {heli animatedoor [_x, 0]} forEach ['door_R','door_L'];// // amnimate , 'MoveCargoDoor','MoveCargo2Door' Share this post Link to post Share on other sites
R3vo 2654 Posted August 30, 2015 The hint command can also be removed, since it's running on the server. Share this post Link to post Share on other sites
rasmith1030 10 Posted August 30, 2015 ok, thanks f2k and others. This information is good. The "UH60M" is a mod helicopter. I am also trying to use the Takistan map. I will try one of the vanilla maps, and a basic helicopter and work from there. Maybe it has something to do with the flight model (original or updated?)? I will try some different things. Anyway, thanks for checking it. Share this post Link to post Share on other sites
dreadedentity 278 Posted August 30, 2015 I've had this issue with BIS_fnc_spawnVehicle before, I decided to just use createVehicle to make the heli and the crew and move them into the heli with script Share this post Link to post Share on other sites
f2k sel 164 Posted August 30, 2015 I've had this issue with BIS_fnc_spawnVehicle before, I decided to just use createVehicle to make the heli and the crew and move them into the heli with script You may be right, it may not work with mods so of course it will crash with no crew. Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted August 30, 2015 I've had this issue with BIS_fnc_spawnVehicle before, I decided to just use createVehicle to make the heli and the crew and move them into the heli with script Agree with this, would definitely avoid the BIS_fnc_spawnX functions if you can, they are quite dated last time I checked. Share this post Link to post Share on other sites
rasmith1030 10 Posted August 31, 2015 Thanks again for all the posts. Truly unbelievable, however, since this exact script snippet worked only a few short updates ago. From the behavior, the modded helicopter may in fact not have a crew, I did not look at that specifically yet, I will check. However I must emphasize, and that was the jist of my original post, this code did at one time work!! Is anyone else seeing trusted old scripts that once worked, and now do not? Share this post Link to post Share on other sites
R3vo 2654 Posted August 31, 2015 This script could not have worked before: _x setCaptive _captive; This is just one of many reasons why. Share this post Link to post Share on other sites
rasmith1030 10 Posted August 31, 2015 The code above was ripped out of a more extensive script, I just forgot to initialize some of the variables. The plan was to just clean it up, and make it more portable to other scenarios. The undefined variable _captive would not affect the function of the overall script even in the form above, that line would have been ignored, with setCaptive left at its default. Share this post Link to post Share on other sites