JR Nova 24 Posted November 9, 2019 I'm trying to spawn a helicopter with guys on the benches that flies in and circles an area the player is in (near an empty helipad named attackPos) and kill the player. I tried using BIS_fnc_stalk, but the helicopter would just fly to the location and then just raise altitude forever. Here is the part of code that spawns the chopper and shooters. Spoiler _heliClass = "B_Heli_Light_01_F"; _posHELI = [attackPos, [1000,1300]] call SHK_pos; _posHelper = createSimpleObject ["Land_HelipadEmpty_F", _posHELI]; _HELIgrp = createGroup resistance; _HELIdir = _posHelper getRelDir attackPos; _HELIspwn = [_posHELI, _HELIdir, _heliClass, _HELIgrp] call bis_fnc_spawnvehicle; _HELI = _HELIspwn select 0; createVehicleCrew _HELI; _shooters = [_posHELI, resistance, 6] call bis_fnc_spawngroup; { _x assignAsCargo _HELI; _x moveInCargo _HELI; [_x, 'Sniper'] execVM 'loadouts.sqf'; } forEach units _shooters; {[_x] joinSilent _HELIgrp} forEach units _shooters; deleteVehicle _posHelper; _HELIgrp deleteGroupWhenEmpty true; sleep (10 + random 20); _heliWaypoint = _HELIgrp addWaypoint [attackPos, 10, 0]; _heliWaypoint setWaypointType "LOITER"; _heliWaypoint setWaypointLoiterType "CIRCLE"; _heliWaypoint setWaypointLoiterRadius 200; _heliWaypoint setWaypointSpeed "LIMITED"; _heliWaypoint setWaypointBehaviour "COMBAT"; _heliWaypoint setWaypointCombatMode "RED"; _HELIgrp setCurrentWaypoint _heliWaypoint; _HELI flyInHeight 40; This code does not work at all, nothing spawns in. If I remove just this one line _heliWaypoint setWaypointLoiterRadius 200; everything spawns and the chopper flies to the correct location, but then raises altitude and flies away to the edge of the map. Any idea how to get this to work properly? Share this post Link to post Share on other sites
Mr H. 400 Posted November 9, 2019 2 hours ago, JR Nova said: chopper flies to the correct location, but then raises altitude and flies away to the edge of the map. I've noticed that sometimes helis behave like that if there's a trigger on the way. 1 Share this post Link to post Share on other sites
JR Nova 24 Posted November 9, 2019 1 hour ago, Mr H. said: I've noticed that sometimes helis behave like that if there's a trigger on the way. Ah that could be it, I do have a trigger around the area the player is in. I guess I'll just have to deal with it then because I kinda need the trigger more than I need the heli lol Share this post Link to post Share on other sites
Mr H. 400 Posted November 9, 2019 You can maybe try to lower the height of the trigger Share this post Link to post Share on other sites
Larrow 2797 Posted November 9, 2019 Spoiler _heliPos = attackPos getPos[ 1000 + random 300, random 360 ]; _heliDir = _heliPos getDir attackPos; [ _heliPos, _heliDir, "B_Heli_Light_01_F", resistance ] call BIS_fnc_spawnVehicle params[ "_heli", "", "_heliGrp" ]; _heliGrp deleteGroupWhenEmpty true; _heli flyInHeight 40; _shooters = [ [0,0,100], resistance, 6 ] call BIS_fnc_spawnGroup; { _x assignAsCargo _heli; _x moveInCargo _heli; [ _x, 'Sniper' ] execVM 'loadouts.sqf'; }forEach units _shooters; units _shooters joinSilent _heliGrp; sleep (10 + random 20); _heliWaypoint = _heliGrp addWaypoint[ attackPos, 10 ]; //Removed index, waypoint is just added to the end of the groups waypoints instead _heliWaypoint setWaypointType "LOITER"; _heliWaypoint setWaypointLoiterType "CIRCLE"; _heliWaypoint setWaypointLoiterRadius 200; _heliWaypoint setWaypointSpeed "LIMITED"; _heliWaypoint setWaypointBehaviour "COMBAT"; _heliWaypoint setWaypointCombatMode "RED"; _heliGrp setCurrentWaypoint _heliWaypoint; //Sets the created waypoint as the current Removed all the unnecessary stuff, simpleObject, createVehicleCrew etc. Used alternative syntax of some commands to do the same thing, SHK_pos, getRelDIr etc. Never use index 0 for waypoints. Index 0 is not the same as waypoint 0 in the editor. Index 0 is the position the group was spawned at, and is set by the engine when spawning. Waypoint 0 is in fact index 1. The above code works, but if you change the waypoint creation back to index 0 the heli will buzz past the waypoint position and head off the map. 3 2 Share this post Link to post Share on other sites
JR Nova 24 Posted November 9, 2019 10 minutes ago, Larrow said: Removed all the unnecessary stuff, simpleObject, createVehicleCrew etc. Used alternative syntax of some commands to do the same thing, SHK_pos, getRelDIr etc. Never use index 0 for waypoints. Index 0 is not the same as waypoint 0 in the editor. Index 0 is the position the group was spawned at, and is set by the engine when spawning. Waypoint 0 is in fact index 1. The above code works, but if you change the waypoint creation to index 0 the heli will buzz past the waypoint position and head off the map. Thanks a ton, this worked out perfectly! 2 Share this post Link to post Share on other sites
engima 327 Posted November 10, 2019 20 hours ago, Larrow said: Reveal hidden contents _heliPos = attackPos getPos[ 1000 + random 300, random 360 ]; _heliDir = _heliPos getDir attackPos; [ _heliPos, _heliDir, "B_Heli_Light_01_F", resistance ] call BIS_fnc_spawnVehicle params[ "_heli", "", "_heliGrp" ]; _heliGrp deleteGroupWhenEmpty true; _heli flyInHeight 40; _shooters = [ [0,0,100], resistance, 6 ] call BIS_fnc_spawnGroup; { _x assignAsCargo _heli; _x moveInCargo _heli; [ _x, 'Sniper' ] execVM 'loadouts.sqf'; }forEach units _shooters; units _shooters joinSilent _heliGrp; sleep (10 + random 20); _heliWaypoint = _heliGrp addWaypoint[ attackPos, 10 ]; //Removed index, waypoint is just added to the end of the groups waypoints instead _heliWaypoint setWaypointType "LOITER"; _heliWaypoint setWaypointLoiterType "CIRCLE"; _heliWaypoint setWaypointLoiterRadius 200; _heliWaypoint setWaypointSpeed "LIMITED"; _heliWaypoint setWaypointBehaviour "COMBAT"; _heliWaypoint setWaypointCombatMode "RED"; _heliGrp setCurrentWaypoint _heliWaypoint; //Sets the created waypoint as the current Removed all the unnecessary stuff, simpleObject, createVehicleCrew etc. Used alternative syntax of some commands to do the same thing, SHK_pos, getRelDIr etc. Never use index 0 for waypoints. Index 0 is not the same as waypoint 0 in the editor. Index 0 is the position the group was spawned at, and is set by the engine when spawning. Waypoint 0 is in fact index 1. The above code works, but if you change the waypoint creation back to index 0 the heli will buzz past the waypoint position and head off the map. I didn’t know that. So in general, if you have a group with waypoints and deletes them all the way down to index 0, what will happen? I expect nothing, but apperently something can get wrong. Will the Arma engine get confused? Obviously in this case...? Share this post Link to post Share on other sites
Larrow 2797 Posted November 10, 2019 3 hours ago, engima said: if you have a group with waypoints and deletes them all the way down to index 0, what will happen? I expect nothing, but apperently something can get wrong. Yep this. Although I have seen index 0 used with no problems, I have also seen it cause problems like in this topic. Best option is to never use index 0 and leave it as default spawn position. TBH I rarely ever delete waypoints and only ever add to the end of the list and use setCurrentWaypoint to get the group to follow the new path. The only time I delete waypoints is when its a group that exists for along time and is repeatedly given new paths, just so as the waypoint list does not get to long ( does a long list cause problems, not really, but they must be stored somewhere and its always a good idea to clean up now and again ). Share this post Link to post Share on other sites