Jump to content

Recommended Posts

 I just opened the door to the scripting world and I feel that I am not capable atm to fully modify a script by dreaded entity. I looked through tons of BI pages and made a testing Environment ... but still can not get it right after hours of trying. There is the code I modified  so far but the lower part is not working. Can someone please help?


The helo should search for Player, turn hostile and attack. It kinda works in VR, but on a map they just hover on spot after completing the flyby.

 

private ["_player","_flyoverChance","_shootdownChance","_minutes","_variation","_helicopters"];
_player = (_this select 0);
_minutes = [_this, 1, 20, [0]] call BIS_fnc_param;
_variation = [_this, 2, 0, [0]] call BIS_fnc_param;
_flyoverChance = [_this, 3, 0.5, [0]] call BIS_fnc_param;
_shootdownChance = [_this, 4, 0.3, [0]] call BIS_fnc_param;
_helicopters = [["B_CTRG_Heli_Transport_01_tropic_F", 3],["B_Heli_Transport_03_F", 4],["B_Heli_Light_01_dynamicLoadout_F",2]];

while {true} do
{
 sleep (((_minutes - _variation) + (random (_variation * 2))) * 60); 
 if ((random 1) <= _flyoverChance) then
 {
  private["_direction","_position","_variation","_element","_obj"];
  //systemChat "You rolled the dice and you won!";
  _direction = random 360;
  _position = [getPos _player, ((random 50) + 550), _direction] call BIS_fnc_relPos;
  _variation = ((random 40) + 160);
  _element = _helicopters select (floor random (count _helicopters));
  _obj = [_position,_direction - _variation,_element select 0,east] call BIS_fnc_spawnVehicle;
  (_obj select 0) setVehicleAmmo 1;
                clearMagazineCargoGlobal (_obj select 0) ;
         clearWeaponCargoGlobal (_obj select 0);
         clearItemCargoGlobal (_obj select 0);
         clearBackpackCargoGlobal (_obj select 0);
  _position = [getPos (_obj select 0), 1200, direction (_obj select 0)] call BIS_fnc_relPos;
  (_obj select 2) move _position;
  ((waypoints (_obj select 0)) select 0) setWaypointCompletionRadius 200;
  
  if ((random 1) <= _shootDownChance) then
  {
   sleep ((random 10) + 10);
   //systemChat "Helicopter has taken critical damage!";
   (_obj select 0) setDamage 1;
   waitUntil {speed (_obj select 0) == 0};
   //hint "helicopter has stopped";
   [_obj select 0, _element] execVM "DE_createLoot.sqf";
  }else
  {
   waitUntil {moveToCompleted (_obj select 0)};
   {
    //deleteVehicle _x;
   }forEach (crew (_obj select 0));
   //deleteVehicle (_obj select 0);
                        (crew (_obj select 0)) doMove getPosATL player;
                        (_obj select 0) setCombatMode "RED";
  };
 }else
 {
  //systemChat "You rolled the dice and you lost!";

Share this post


Link to post
Share on other sites

That's the problem with scripts from other guys. So, ask the author, or try something you can understand.

You should have a look at BIKI's commands for scripting some consistent waypoints.

Btw, working on "speed 0" for helicopter is not fine. You should check for a distance, or a waypoint completion, or even unitReady on helo.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, pierremgi said:

That's the problem with scripts from other guys. So, ask the author, or try something you can understand.

You should have a look at BIKI's commands for scripting some consistent waypoints.

Btw, working on "speed 0" for helicopter is not fine. You should check for a distance, or a waypoint completion, or even unitReady on helo.

 

 

Thanks for the advice ... I will try to find out the things that you have mentioned.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×