Phenosi

[Sci-fi+] Astartes Pod TEST

Nov 11th, 2024 (edited)
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 18.09 KB | Gaming | 0 0
  1. if (!isNil "ScifiSupportPlus_SM_dropPod" && {ScifiSupportPlus_SM_dropPod}) then {
  2.     ["[Sci-Fi+] Warhammer 40K", "[TEST] Astartes Drop Pod",
  3.         {
  4.             params [["_pos", [0, 0, 0], [[]], 3], ["_logic", objNull, [objNull]]];
  5.            
  6.             _factionsFound = [];
  7.            
  8.             {
  9.                 // Get all factions but ignore story and virtual groups.
  10.                 if !(gettext (configFile >> "CfgEditorSubcategories" >> (gettext (_x >> "editorSubcategory")) >> "displayname") in ["Men (Story)", "Men (Virtual Reality)"]) then {
  11.                     _factionsFound pushBackUnique [
  12.                         getNumber (_x >> "side"),
  13.                         gettext (configFile >> "CfgfactionClasses" >> (gettext (_x >> "faction")) >> "displayname"),
  14.                         gettext (configFile >> "CfgEditorSubcategories" >> (gettext (_x >> "editorSubcategory")) >> "displayname"),
  15.                         gettext (_x >> "faction"),
  16.                         gettext (_x >> "editorSubcategory")
  17.                     ];
  18.                 };
  19.             } forEach ("(configname _x isKindOf 'CAManBase') && (getNumber (_x >> 'side') in [0, 1, 2]) && getNumber(_x >> 'scope') == 2 && gettext (_x>>'faction') in ['TIOW_ChaosSpaceMarines', 'TIOW_SpaceMarines']" configClasses (configFile >> "Cfgvehicles"));
  20.            
  21.             _factionsFound sort true;
  22.             _factionindex = 0;
  23.             _factions = _factionsFound;
  24.             _factionspretty=[];
  25.             {
  26.                 _x params ["_side", "_factname", "_catname", "_factClass", "_catClass"];
  27.                 _factionspretty pushBack [_catname, _factname, "", switch (_side) do {
  28.                     case 0: {
  29.                         [255, 0, 0, 255]
  30.                     };
  31.                     case 1: {
  32.                         [0, 0, 255, 255]
  33.                     };
  34.                     case 2: {
  35.                         [0, 255, 0, 255]
  36.                     };
  37.                     case 3: {
  38.                         [255, 0, 255, 255]
  39.                     };
  40.                     default {
  41.                         [0, 0, 0, 255]
  42.                     };
  43.                 }];
  44.             } forEach _factionsFound;
  45.            
  46.             ["spawn Pod", [
  47.                 ["sideS", ["Side select (ONLY ONE!)", "The side the dropped unit will be on."], [east]],
  48.                 ["COMBO", ["faction", ""], [_factions, _factionspretty, 0]]
  49.                 ], {
  50.                     params["_values", "_arguments"];
  51.                     _dropside=_values select 0;
  52.                     _selection=_values select 1;
  53.                    
  54.                     _pos=_arguments select 0;
  55.                    
  56.                     _pos= (ASLtoATL _pos);
  57.                    
  58.                     _spawnpos = _pos vectorAdd [random [-500, 0, 500], random [-500, 0, 500], 1500];
  59.                    
  60.                     _mainprojectile=createvehicle ["Sh_125mm_APFSDS", _spawnpos, [], 0, "NONE"];
  61.                     _mainprojectile setShotParents [player, player];
  62.                    
  63.                     _angle = [(_pos vectorFromTo _spawnpos)#0, (_pos vectorFromTo _spawnpos)#1, ((_pos vectorFromTo _spawnpos)#2)];
  64.                    
  65.                     _projectile = createvehicle [switch (_selection#4) do {
  66.                         case "EdSubcat_AlphaLegion": {
  67.                             "TIOW_drop_Pod_AL"
  68.                         };
  69.                         case "EdSubcat_BlackLegion": {
  70.                             "TIOW_drop_Pod_BL"
  71.                         };
  72.                         case "EdSubcat_DeathGuard": {
  73.                             "TIOW_drop_Pod_DG"
  74.                         };
  75.                         case "EdSubcat_EmperorsChildren": {
  76.                             "TIOW_drop_Pod_EC"
  77.                         };
  78.                         case "EdSubcat_IronWarriors": {
  79.                             "TIOW_drop_Pod_IW"
  80.                         };
  81.                         case "EdSubcat_NightLords": {
  82.                             "TIOW_drop_Pod_NL"
  83.                         };
  84.                         case "EdSubcat_ThousandSons": {
  85.                             "TIOW_drop_Pod_TS"
  86.                         };
  87.                         case "EdSubcat_WordBearers": {
  88.                             "TIOW_drop_Pod_WB"
  89.                         };
  90.                         case "EdSubcat_WorldEaters": {
  91.                             "TIOW_drop_Pod_WE"
  92.                         };
  93.                         case "EdSubcat_BlackTemplars": {
  94.                             "TIOW_drop_Pod_BT"
  95.                         };
  96.                         case "EdSubcat_BloodAngels": {
  97.                             "TIOW_drop_Pod_BA"
  98.                         };
  99.                         case "EdSubcat_BloodRavens": {
  100.                             "TIOW_drop_Pod_BR"
  101.                         };
  102.                         case "EdSubcat_DarkAngels": {
  103.                             "TIOW_drop_Pod_DA"
  104.                         };
  105.                         case "EdSubcat_ImperialFists": {
  106.                             "TIOW_drop_Pod_IF"
  107.                         };
  108.                         case "EdSubcat_IronHands": {
  109.                             "TIOW_drop_Pod_IH"
  110.                         };
  111.                         case "EdSubcat_RavenGuard": {
  112.                             "TIOW_drop_Pod_RG"
  113.                         };
  114.                         case "EdSubcat_Salamanders": {
  115.                             "TIOW_drop_Pod_SAL"
  116.                         };
  117.                         case "EdSubcat_SpaceWolves": {
  118.                             "TIOW_drop_Pod_SW"
  119.                         };
  120.                         case "EdSubcat_Ultramarines": {
  121.                             "TIOW_drop_Pod_UM"
  122.                         };
  123.                         case "EdSubcat_WhiteScars": {
  124.                             "TIOW_drop_Pod_WS"
  125.                         };
  126.                         default {
  127.                             "TIOW_drop_Pod_BT"
  128.                         };
  129.                     }, [0, 0, 0], [], 0, "NONE"];
  130.                    
  131.                     _randomDirNumber = (random 360);
  132.                     [_projectile, -90, 0] call BIS_fnc_setPitchBank;
  133.                     _projectile setPosATL (getPosATL _mainprojectile);
  134.                     [_projectile, _mainprojectile] call BIS_fnc_attachtorelative;
  135.                     _projectile allowdamage false;
  136.                    
  137.                     _mainprojectile setvectorDirAndUp [_angle, [0, 0, 1]];
  138.                    
  139.                     [_projectile] spawn {
  140.                         params ["_projectile"];
  141.                        
  142.                         _projectile say3D ["Cov_dropPod_Thruster", 2000, random [0.5, 1, 1.5]];
  143.                        
  144.                         // 3.5 default z
  145.                         _RayPos1 = _projectile modeltoWorld [0, 0, 5];
  146.                        
  147.                         [[_projectile, _RayPos1], {
  148.                             params ["_projectile", "_RayPos1"];
  149.                            
  150.                             private _ps1 = "#particlesource" createvehiclelocal _RayPos1;
  151.                             _ps1 setParticleParams [
  152.                                 ["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
  153.                                 1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [4, 12, 20],
  154.                                 [[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]],
  155.                             [0.25], 1, 0, "", "", _ps1];
  156.                             _ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
  157.                             _ps1 setDropInterval 0.05;
  158.                             _ps1 attachTo [_projectile];
  159.                             [_ps1, _projectile] spawn {
  160.                                 params ['_ps1', '_projectile'];
  161.                                 waitUntil {
  162.                                     (!alive _projectile) || ((getPosATL _projectile # 2) < 5)
  163.                                 };
  164.                                 deletevehicle _ps1;
  165.                             };
  166.                            
  167.                             private _ps2 = "#particlesource" createvehiclelocal _RayPos1;
  168.                             _ps2 setParticleParams [
  169.                                 ["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 10, 32], "", "Billboard",
  170.                                 1, (random 5), [0, 0, 0], [0, 0, 0.5], 0, 1, 1, 3, [3, 8], // made it very big
  171.                                 [[1, 1, 1, 0.4], [1, 1, 1, 0.2], [1, 1, 1, 0]],
  172.                             [0.25, 1], 1, 1, "", "", _ps2];
  173.                             _ps2 setParticleRandom [0.2, [0.5, 0.5, 0.25], [0.125, 0.125, 0.125], 0.2, 0.2, [0, 0, 0, 0], 0, 0];
  174.                             _ps2 setDropInterval 0.01;
  175.                             _ps2 attachTo [_projectile];
  176.                             [_ps2, _projectile] spawn {
  177.                                 params ['_ps2', '_projectile'];
  178.                                 waitUntil {
  179.                                     (!alive _projectile) || ((getPosATL _projectile # 2) < 5)
  180.                                 };
  181.                                 deletevehicle _ps2;
  182.                             };
  183.                         }] remoteExec ["spawn"];
  184.                     };
  185.                    
  186.                     [_mainprojectile, _pos, _projectile] spawn {
  187.                         params ["_mainprojectile", "_pos", "_projectile"];
  188.                         while {alive _mainprojectile} do {
  189.                             _mainprojectile setvelocity ((_pos vectorFromTo (getPosATL _mainprojectile)) vectorMultiply -150);
  190.                         };
  191.                     };
  192.                    
  193.                     [_mainprojectile, _pos, _dropside, _projectile, _selection, _randomDirNumber] spawn {
  194.                         params ["_mainprojectile", "_pos", "_dropside", "_projectile", "_selection", "_randomDirNumber"];
  195.                        
  196.                         _factionsFound = [];
  197.                        
  198.                         {
  199.                             // Get all factions but ignore story and virtual groups.
  200.                             if !(gettext (configFile >> "CfgEditorSubcategories" >> (gettext (_x >> "editorSubcategory")) >> "displayname") in ["Men (Story)", "Men (Virtual Reality)"]) then {
  201.                                 _factionsFound pushBack [
  202.                                     getNumber (_x >> "side"),
  203.                                     gettext (configFile >> "CfgfactionClasses" >> (gettext (_x >> "faction")) >> "displayname"),
  204.                                     gettext (configFile >> "CfgEditorSubcategories" >> (gettext (_x >> "editorSubcategory")) >> "displayname"),
  205.                                     gettext (_x >> "faction"),
  206.                                     gettext (_x >> "editorSubcategory"),
  207.                                     configname _x
  208.                                 ];
  209.                             };
  210.                         } forEach ("(configname _x isKindOf 'CAManBase') && (getNumber (_x >> 'side') in [0, 1, 2]) && getNumber(_x >> 'scope') == 2 && gettext (_x>>'faction') in ['TIOW_ChaosSpaceMarines', 'TIOW_SpaceMarines']" configClasses (configFile >> "Cfgvehicles"));
  211.                        
  212.                         _factionsFound sort true;
  213.                        
  214.                         _side = (_dropside select 0);
  215.                         _list = _factionsFound select {
  216.                             (_x#2)==(_selection#2)
  217.                         };
  218.                        
  219.                         _listout=[];
  220.  
  221.                         for "_i" from 1 to 5 do{
  222.                             _listout pushBack ((selectRandom _list)#5);
  223.                         };
  224.                        
  225.                        
  226.  
  227.                          _unitArray = _listout;
  228.  
  229.                             _filteredArray = _unitArray select {
  230.                                 _unit = _x;
  231.                                 _displayName = toLower (getText (configFile >> "CfgVehicles" >> _unit >> "displayName"));
  232.                                 !((_displayName find "dreadnought" > -1) || (_displayName find "terminator" > -1))
  233.                             };
  234.  
  235.                             // _filteredArray now contains only the units of which display name does not contain 'dreadnought' or 'terminator'
  236.  
  237.  
  238.  
  239.                         _posATL = _pos;
  240.                         waitUntil {
  241.                             if (alive _mainprojectile) then {
  242.                                 _posATL = getPosATL _mainprojectile;
  243.                             };
  244.                             !alive _mainprojectile;
  245.                         };
  246.  
  247.                         _posATL = (getPosATL _projectile);
  248.  
  249.                         // systemchat format ["_posATL = %1",_posATL];
  250.                         // systemchat format ["_pos = %1",_pos];
  251.  
  252.                         [[_posATL,_projectile], {
  253.                             params ["_posATL","_projectile"];
  254.                         _dust = "#particlesource" createVehicleLocal _posATL;  
  255.                         _dust attachto [_projectile,[0,0,0]];
  256.                         detach _dust;  
  257.                         _dust setParticleClass "BombDust";
  258.                         _blast = "#particlesource" createVehicleLocal _posATL;
  259.                         _blast setParticleCircle [0, [0, 0, 0]];
  260.                         _blast setParticleRandom [0, [0, 0, 0], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0];
  261.                         _blast setParticleParams [["\A3\data_f\koule", 1, 0, 1], "", "SpaceObject", 1,1,[0,0,0],[0,0,1],3,10,7.9,0,[50,1000],[[1, 1, 1, 0.1], [1, 1, 1, 0]], [1], 1, 0, "", "", _this];
  262.                         _blast setDropInterval 50;
  263.                         [_posATL] spawn {
  264.                             params ["_posATL"];
  265.  
  266.                             _aslLoc = _posATL;
  267.                             _rocks1 = "#particlesource" createVehicleLocal _aslLoc;
  268.                             _rocks1 setposasl _aslLoc;
  269.                             _rocks1 setParticleParams [["\A3\data_f\ParticleEffects\Universal\Mud.p3d", 1, 0, 1], "", "SpaceObject", 1, 12.5, [0, 0, 0], [0, 0, 15], 5, 100, 7.9, 1, [.45, .45], [[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _aslLoc,0,false,0.3];
  270.                             _rocks1 setParticleRandom [0, [1, 1, 0], [20, 20, 15], 3, 0.25, [0, 0, 0, 0.1], 0, 0];
  271.                             _rocks1 setDropInterval 0.01;
  272.                             _rocks1 setParticleCircle [0, [0, 0, 0]];
  273.  
  274.                             _rocks2 = "#particlesource" createVehicleLocal _aslLoc;
  275.                             _rocks2 setposasl _aslLoc;
  276.                             _rocks2 setParticleParams [["\A3\data_f\ParticleEffects\Universal\Mud.p3d", 1, 0, 1], "", "SpaceObject", 1, 12.5, [0, 0, 0], [0, 0, 15], 5, 100, 7.9, 1, [.27, .27], [[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _aslLoc,0,false,0.3];
  277.                             _rocks2 setParticleRandom [0, [1, 1, 0], [25, 25, 15], 3, 0.25, [0, 0, 0, 0.1], 0, 0];
  278.                             _rocks2 setDropInterval 0.01;
  279.                             _rocks2 setParticleCircle [0, [0, 0, 0]];
  280.  
  281.                             _rocks3 = "#particlesource" createVehicleLocal _aslLoc;
  282.                             _rocks3 setposasl _aslLoc;
  283.                             _rocks3 setParticleParams [["\A3\data_f\ParticleEffects\Universal\Mud.p3d", 1, 0, 1], "", "SpaceObject", 1, 12.5, [0, 0, 0], [0, 0, 15], 5, 100, 7.9, 1, [.09, .09], [[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", _aslLoc,0,false,0.3];
  284.                             _rocks3 setParticleRandom [0, [1, 1, 0], [30, 30, 15], 3, 0.25, [0, 0, 0, 0.1], 0, 0];
  285.                             _rocks3 setDropInterval 0.01;
  286.                             _rocks3 setParticleCircle [0, [0, 0, 0]];
  287.                             _rocks = [_rocks1,_rocks2, _rocks3];
  288.                             sleep 0.2;
  289.                             {
  290.                             deletevehicle _x;
  291.                             } foreach _rocks;
  292.                         };
  293.                         sleep 7;
  294.                         deleteVehicle _dust;
  295.                         deleteVehicle _blast;
  296.                         }] remoteExec ["spawn", [0,-2] select isDedicated,false];
  297.                        
  298.                         _craterpos = _posATL;
  299.                         _craterpos set [2, 0];
  300.                        
  301.                         _projectile setDir _randomDirNumber;
  302.                         _projectile setPos getPos _projectile;
  303.                         _projectile setvectorUp surfaceNormal position _projectile;
  304.                         _projectile setPosATL [(_craterpos #0), ( _craterpos #1), 0];
  305.                         _projectile setvelocity [0, 0, 0];
  306.                        
  307.                         [_posATL, _side, _filteredArray, _projectile] spawn {
  308.                             params ["_spawn", "_side", "_filteredArray", "_projectile"];
  309.                            
  310.                             sleep 0.5;
  311.                             {
  312.                                 _projectile animate [_x, 1];
  313.                             } forEach (animationnames _projectile);
  314.                             sleep 1.5;
  315.                             _EliteUnit = [_spawn, _side, _filteredArray] call BIS_fnc_spawngroup;
  316.                            
  317.                             {
  318.                                 _x setPosATL (_spawn findEmptyposition [3, 10, typeOf _x]);
  319.                                 sleep 0.2;
  320.                                 _randomPosAroundplayer = [[[(getPosATL _projectile), 50]], []] call BIS_fnc_randomPos;
  321.                                 _x domove (_randomPosAroundplayer);
  322.                             } forEach (units _EliteUnit);
  323.                         };
  324.                     };
  325.                 }, {}, [_pos]] call zen_dialog_fnc_create;
  326.             }, "\PHAN_ScifiSupportPlus\data\SpacemarineDropod.paa"] call zen_custom_modules_fnc_register;
  327.         };
Advertisement
Add Comment
Please, Sign In to add comment