BLACK CROW
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
-29%
Le deal à ne pas rater :
PC portable Gamer ERAZER DEPUTY P60 – 15,6” FHD 144Hz – i7-12è ...
999.99 € 1399.99 €
Voir le deal

[SCRIPT] IED

Aller en bas

[SCRIPT] IED Empty [SCRIPT] IED

Message par DÄZ Jeu 3 Sep - 20:47

[SCRIPT] IED


Voici un petit script qui permet de faire spawn aléatoirement des IED divers.

dans l'init.sqf:

Code:
iedcounter = 0;
_null = ["ied1", 1, 10, "WEST", TRUE, FALSE] execVM "Script\IED\ied.sqf";
_null = ["ied2", 1, 10, "WEST", TRUE, FALSE] execVM "Script\IED\ied.sqf";
_null = ["ied3", 1, 10, "WEST", TRUE, FALSE] execVM "Script\IED\ied.sqf";
_null = ["ied4", 1, 10, "WEST", TRUE, FALSE] execVM "Script\IED\ied.sqf";

IED_Disarm = {
    _unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
    _IED = [_this, 1, objNull, [objNull]] call BIS_fnc_param;
 _unit addAction["<t color='#F90000'>Désamorcer</t>", "Script\IED\Disarm.sqf", _IED, 0, false, true, "", "(_target distance _this) < 3"];
};        

IED_removeAct = {
    _unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
    _unit removeaction 0;
};

Dans votre dossier mission crée un dossier Script\IED et crée les fichiers:
disarm.sqf

Code:
//private ["t_%1"];

t = (_this select 0);

_array_item = items player;


if (_array_item find "ACE_DefusalKit" > -1) then {

player switchMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 5.5;
deletevehicle (_this select 3);
[[t],"IED_removeAct", true, true] spawn BIS_fnc_MP;
hint "Engin explosif désamorcé !";

}

 else {

  
  player switchMove "AinvPknlMstpSlayWrflDnon_medic";
  sleep 2;
  "M_Mo_82mm_AT_LG" createVehicle (position t);
  "M_Mo_82mm_AT_LG" createVehicle (position t);
  "M_Mo_82mm_AT_LG" createVehicle (position t);
  deletevehicle (_this select 3);
  [[t],"IED_removeAct", true, true] spawn BIS_fnc_MP;
  deletevehicle t;
  };  

ied.sqf

Code:
//                                    |--------------------------------------------|  
//                                    | Dynamic IED script by - Mantis and MAD_T - |  
//                                    |        Modified by kylania                 |  
//                                    |        Version 2cMod1 - 25.8.2013          |  
//                                    | Check out TACO at www.nss-gamers.com       |  
//                                    |--------------------------------------------|  

// USAGE:
//        1. Create a Marker called "Center" somewhere on Map
//        2. Set Parameters in script.
//        3. Call it however you want (Init, trigger, addaction, etc...)
//
//
//        NOTE: The more Roads in an area the higher the probability of IEDs spawning there.

//null = [] execVM "IED\ied.sqf";
// Optionally:
// _null = ["myMarker", 100, 1000, "EAST", TRUE, TRUE] execVM "IED\ied.sqf";
// Would call 100 IEDs within 1000m of "myMarker" triggered by EAST units and all would be marked on the map.


if (!isserver) exitwith {};


_centermrk = [_this, 0, "center", [""]] call BIS_fnc_param;  // Your Centerpoint Default: "center"
_amount = [_this, 1, 10, [123]] call BIS_fnc_param;  // Amount of IEDS on Map Default: 10 IEDs    
_dist = [_this, 2, 500, [123]] call BIS_fnc_param; // distance from road Default: 500m
_side = [_this, 3, "WEST", [""]] call BIS_fnc_param;  // side to trigger IEDs Default: "WEST"
_cleanup = [_this, 4, TRUE, [TRUE]] call BIS_fnc_param;  // Clean up? true/false Default: TRUE
_debug = [_this, 5, FALSE, [FALSE]] call BIS_fnc_param;  // Debug Markers? true/false Default: FALSE

_center = getmarkerpos _centermrk;    
_counter = 0;
_rdist = 5.75;

// Objects used as IEDs
_iedarray =["Land_Wreck_HMMWV_F","Land_WoodPile_F","Land_Pallets_F","Land_WheelCart_F","Land_Wreck_Van_F","Land_Wreck_Car2_F","Land_GarbagePallet_F","Land_CanisterFuel_F","Land_GarbageWashingMachine_F","Land_JunkPile_F","Land_CanisterPlastic_F","Land_Tyres_F","Land_GarbageBags_F","Land_Wreck_Truck_F","Land_CratesPlastic_F","Land_Sacks_heap_F","Land_BucketNavy_F","Land_GarbageContainer_closed_F"];
                  

if (_cleanup) then {
  while {_counter < _amount} do {
    _force = random 100;
    _list = _center nearRoads _dist;
    //["list: %1",_list] call BIS_fnc_error;
    _iedtype = _iedarray select (floor random (count _iedarray));
    //_road = _list select (round random (count _list));
    _road = [_list, (round random (count _list)), objNull, [objNull]] call BIS_fnc_param;
    _roadDir = getDir _road;
    _chance = random 100;
    _newDir = _roadDir;
    if (_chance < 50) then {_newDir = (_NewDir + 180)};        
    _dir = _newdir;
    _pos = getpos _road;
    _posx = _pos select 0;
    _posy = _pos select 1;
    _tx = (_posx + (_rdist * sin(_dir)));
    _ty = (_posy + (_rdist * cos(_dir)));
    _iedpos = [_tx,_ty,0];

    
    _ied = createVehicle [_iedtype, _iedpos, [], 0, ""];
    _ied setDir (random 360);
    _ied setPos getPos _ied;
    _ied enableSimulation false;
    _iedName = format["ied%1", iedcounter];
    missionNameSpace setVariable [_iedName, _ied];
    
    _junktype = _iedarray select (floor random (count _iedarray));
    //_road2 = _list select (round random (count _list));
    _road2 = [_list, (round random (count _list)), objNull, [objNull]] call BIS_fnc_param;
    while { _road2 == _road} do {
      //_road2 = _list select (round random (count _list));
      _road2 = [_list, (round random (count _list)), objNull, [objNull]] call BIS_fnc_param;
    };  

    _pos = getpos _road2;
    _posx2 = _pos select 0;
    _posy2 = _pos select 1;
    _tx2 = (_posx2 + (_rdist * sin(_dir)));
    _ty2 = (_posy2 + (_rdist * cos(_dir)));
    _junkpos = [_tx2,_ty2,0];
    _junk = createvehicle [_junktype, _junkpos, [], 0, ""];
  
    if (_force >= 0 && _force < 33) then {

      call compile format ['
      t_%1 = createTrigger ["EmptyDetector", %2];
      t_%1 setTriggerArea [8,8,0,true];
      t_%1 setTriggerActivation [_side,"PRESENT",false];
      t_%1 setTriggerStatements ["this && {speed _x >= 4.8} foreach thislist && {((position  _x) select 2) < 3} foreach thislist && (alive ied%1)","""M_Mo_82mm_AT_LG"" createVehicle %2;""M_Mo_82mm_AT_LG"" createVehicle %2; deletevehicle ied%1",""];
      ', iedcounter, getPos _ied];
    };  


    if (_force >= 33 && _force < 70) then {

      call compile format ['
      t_%1 = createTrigger ["EmptyDetector", %2];
      t_%1 setTriggerArea [8,8,0,true];
      t_%1 setTriggerActivation [_side,"PRESENT",false];
      t_%1 setTriggerStatements ["this && {speed _x >= 4.8} foreach thislist && {((position  _x) select 2) < 3} foreach thislist && (alive ied%1)","""M_Mo_82mm_AT_LG"" createVehicle %2;""M_Mo_82mm_AT_LG"" createVehicle %2;""M_Mo_82mm_AT_LG"" createVehicle %2; deletevehicle ied%1",""];
      ', iedcounter, getPos _ied];
    };

    if (_force >= 70 && _force <= 100) then {

      call compile format ['
      t_%1 = createTrigger ["EmptyDetector", %2];
      t_%1 setTriggerArea [8,8,0,true];
      t_%1 setTriggerActivation [_side,"PRESENT",false];
      t_%1 setTriggerStatements ["this && {speed _x >= 4.8} foreach thislist && {((position  _x) select 2) < 3} foreach thislist && (alive ied%1)","""M_Mo_82mm_AT_LG"" createVehicle %2;""M_Mo_82mm_AT_LG"" createVehicle %2;""M_Mo_82mm_AT_LG"" createVehicle %2;""M_Mo_82mm_AT_LG"" createVehicle %2;""M_Mo_82mm_AT_LG"" createVehicle %2;""M_Mo_82mm_AT_LG"" createVehicle %2; deletevehicle ied%1",""];
      ', iedcounter, getPos _ied];
    };

    // Add disarm action.
    call compile format ['
    [[ied%1, t_%1],"IED_Disarm", true, true] spawn BIS_fnc_MP;', iedcounter];

    //[[ied_%1, t_%1],"explosive", true, true] spawn BIS_fnc_MP;

    // Print markers where IEDs are
    if (_debug) then {
      call compile format ['                                            
      bombmarker_%1 = createmarker ["bombmarker_%1", %2];
      "bombmarker_%1" setMarkerTypeLocal "hd_warning";
      "bombmarker_%1" setMarkerColorLocal "ColorRed";
      "bombmarker_%1" setMarkerTextLocal "Bomb %1";', iedcounter, getPos _ied];
 
      call compile format ['                                            
      tbombmarker_%1 = createmarker ["tbombmarker_%1", getPos t_%1];
      "tbombmarker_%1" setMarkerTypeLocal "hd_warning";
      "tbombmarker_%1" setMarkerColorLocal "ColorGreen";
      "tbombmarker_%1" setMarkerTextLocal "Trigger %1";', iedcounter];
    };
    
    // Increment
    _counter = _counter + 1;
    iedcounter = iedcounter + 1;
  }; // end of while
}; // end of _cleanup

if (!_cleanup) then {
  _counter = -1;
  while {iedcounter != _counter} do {
    call compile format ['
      deletevehicle t_%1;
      deletevehicle ied%1;
      deletemarker "bombmarker_%1";', iedcounter];
  
    iedcounter = iedcounter - 1;
  };
  _counter = 0;
    iedcounter = 0;
};  

Maintenant dans votre mission crée un/des Marker/s que vous nommerez comme dans l'init.sqf

ex:
Code:
_null = ["MonMarker", 1, 10, "WEST", TRUE, FALSE] execVM "Script\IED\ied.sqf";

pour plus d info consulter le ied.sqf
DÄZ
DÄZ
Reporter de guerre

Messages : 584
Date d'inscription : 29/09/2014
Age : 39
Localisation : Sud Ouest

Revenir en haut Aller en bas

Revenir en haut

- Sujets similaires

 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum