This commit is contained in:
eraser1 2015-09-13 01:15:21 -05:00
parent 401f09ada2
commit af225038af
10 changed files with 363 additions and 5 deletions

View File

@ -31,12 +31,14 @@ class CfgFunctions
class AddMissionToMonitor {};
class AILocalityManager {};
class BroadcastMissionStatus {};
class CalcPos {};
class CleanUp {};
class CleanUpManager {};
class CreateMarker {};
class FillCrate {};
class FindSafePos {};
class FindSuppressor {};
class ImportFromM3E {};
class IsPlayerNearby {};
class IsNearWater {};
class MissionsMonitor {};

View File

@ -73,7 +73,8 @@ DMS_DEBUG = false;
["lost_battalion",10],
["mercenaries",20],
["roguenavyseals",15],
["walmart",20]
["walmart",20],
["mercbase",5]
];
DMS_findSafePosBlacklist = [ // For BIS_fnc_findSafePos position blacklist info refer to: https://community.bistudio.com/wiki/BIS_fnc_findSafePos
@ -117,6 +118,7 @@ DMS_DEBUG = false;
DMS_AI_WP_Radius_moderate = 40; // Waypoint radius for "moderate" AI
DMS_AI_WP_Radius_difficult = 75; // Waypoint radius for "difficult" AI
DMS_AI_WP_Radius_hardcore = 150; // Waypoint radius for "hardcore" AI
DMS_AI_WP_Radius_base = 5; // Waypoint radius for AI in bases
DMS_static_weapons = [ // Static weapons for AI
"O_HMG_01_F",
@ -569,9 +571,11 @@ DMS_DEBUG = false;
// Debug Overwrites
if(DMS_DEBUG) then {
if(DMS_DEBUG) then
{
DMS_TimeBetweenMissions = [30,60];
DMS_MissionTimeOut = [60,90];
//DMS_MissionTypes = [["testmission",1]];
//DMS_MissionTypes = [["mercbase",1]];
diag_log format ["DMS_DEBUG CONFIG :: Overriding DMS_TimeBetweenMissions (%1) and DMS_MissionTimeOut (%2)",DMS_TimeBetweenMissions,DMS_MissionTimeOut];
};

View File

@ -0,0 +1,177 @@
/*
Sample mission (duplicate for testing purposes)
*/
private ["_num", "_side", "_difficulty", "_AICount", "_staticGuns", "_baseObjs", "_crate", "_missionAIUnits", "_missionObjs", "_msgStart", "_msgWIN", "_msgLOSE", "_missionName", "_markers", "_time", "_added", "_cleanup"];
// For logging purposes
_num = DMS_MissionCount;
// Set mission side (only "bandit" is supported for now)
_side = "bandit";
// find position
_pos = call DMS_fnc_findSafePos;
// Set general mission difficulty
_difficulty = "hardcore";
// Create AI
_AICount = 6 + (round (random 2));
_group =
[
[_pos,[-9.48486,-12.4834,0]] call DMS_fnc_CalcPos,
_AICount,
"hardcore",
"random",
_side
] call DMS_fnc_SpawnAIGroup;
// Use "base" waypoint instead
while {(count (waypoints _group)) > 0} do
{
deleteWaypoint ((waypoints _group) select 0);
};
[
_group,
[_pos,[-9.48486,-12.4834,0]] call DMS_fnc_CalcPos,
"base"
] call DMS_fnc_SetGroupBehavior;
_staticGuns =
[
[
[_pos,[-6.29138,3.9917,0]] call DMS_fnc_CalcPos
],
_group,
"assault",
"hardcore",
"bandit",
"O_HMG_01_high_F"
] call DMS_fnc_SpawnAIStatic;
(_staticGuns select 0) setDir 15;
_baseObjs =
[
"base1",
_pos
] call DMS_fnc_ImportFromM3E;
// Create Crate
_crate = ["Box_NATO_AmmoOrd_F",_pos] call DMS_fnc_SpawnCrate;
// Pink Crate ;)
_crate setObjectTextureGlobal [0,"#(rgb,8,8,3)color(1,0.08,0.57,1)"];
_crate setObjectTextureGlobal [1,"#(rgb,8,8,3)color(1,0.08,0.57,1)"];
// Define mission-spawned AI Units
_missionAIUnits =
[
_group // We only spawned the single group for this mission
];
// Define mission-spawned objects and loot values
_missionObjs =
[
_staticGuns+_baseObjs, // base objects and static gun
[],
[[_crate,"Sniper"]]
];
// Define Mission Start message
_msgStart = format["<t color='#FFFF00' size='1.25'> Mercenary Base </t><br/> A mercenary base has been located at %1! There's reports of a dandy crate inside of it...",mapGridPosition _pos];
// Define Mission Win message
_msgWIN = format["<t color='#0080ff' size='1.25'> Mercenary Base </t><br/> Convicts have successfully assaulted the Mercenary Base and obtained the dandy crate!"];
// Define Mission Lose message
_msgLOSE = format["<t color='#FF0000' size='1.25'> Mercenary Base </t><br/> Seems like the Mercenaries packed up and drove away..."];
// Define mission name (for map marker and logging)
_missionName = "Mercenary Base";
// Create Markers
_markers =
[
_pos,
_missionName,
_difficulty
] call DMS_fnc_CreateMarker;
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
[
[
"kill",
_group
],
[
"playerNear",
[_pos,DMS_playerNearRadius]
]
],
[
_time,
(DMS_MissionTimeOut select 0) + random((DMS_MissionTimeOut select 1) - (DMS_MissionTimeOut select 0))
],
_missionAIUnits,
_missionObjs,
[_msgWIN,_msgLOSE],
_markers,
_side
] call DMS_fnc_AddMissionToMonitor;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_AddMissionToMonitor! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
// Delete AI units and the crate. I could do it in one line but I just made a little function that should work for every mission (provided you defined everything correctly)
_cleanup = [];
{
_cleanup pushBack _x;
} forEach _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
{
_cleanup pushBack (_x select 0);
} foreach (_missionObjs select 2);
_cleanup call DMS_fnc_CleanUp;
// Delete the markers directly
{deleteMarker _x;} forEach _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
// Notify players
_msgStart call DMS_fnc_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time];
};

View File

@ -0,0 +1,22 @@
[
["Land_HBarrierTower_F",[-9.12122,9.17334,0],180.049],
["Land_HBarrierTower_F",[5.15552,-9.92236,0],270.462],
["Land_HBarrierTower_F",[-9.02209,-29.1157,0],0],
["Land_HBarrierTower_F",[-23.2937,-10.021,0],90.6414],
["Land_HBarrierWall_corridor_F",[-24.0222,-15.5698,0],0],
["Land_CncWall4_F",[-15.0026,-27.3579,0],0],
["Land_CncWall4_F",[-19.0652,-25.082,0],53.1818],
["Land_CncWall4_F",[-21.0901,-20.4282,0],82.6364],
["Land_CncWall4_F",[-2.98938,-27.3594,0],0],
["Land_CncWall4_F",[1.07483,-25.02,0],302.318],
["Land_CncWall4_F",[2.92139,-20.2295,0],280.636],
["Land_HBarrierWall_corridor_F",[5.90735,-15.3979,0],0],
["Land_CncWall4_F",[3.50403,-3.87158,0],262.221],
["Land_CncWall4_F",[2.09851,1.11768,0],249.539],
["Land_CncWall4_F",[-1.08093,5.08643,0],215.994],
["Land_CncWall1_F",[-3.72351,6.81592,0],201.682],
["Land_HBarrier_1_F",[-4.89832,7.65137,0],290.455],
["Land_HBarrier_1_F",[-4.89832,7.65137,1.3],290.455],
["Land_HBarrier_Big_F",[-15.7292,4.59131,0],309.682],
["Land_HBarrier_Big_F",[-20.431,-2.63086,0],298.636]
]

View File

@ -0,0 +1,58 @@
/*
DMS_fnc_CalcPos
Created by eraser1
Usage:
[
_positionOrObject, // Object or Position: The center
_relativePosition // Array: The offset
] call DMS_fnc_CalcPos;
Returns the absolute position from the provided relative position from the provided center position or object.
*/
private ["_pos", "_relPos", "_npos"];
_OK = params
[
["_pos","",[[],objNull]],
["_relPos","",[[]],[2,3]]
];
if (!_OK) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_CalcPos with invalid parameters: %1",_this];
};
// Get the position if an object was supplied instead of position
if ((typeName _pos)=="OBJECT") then
{
_pos = getPos _pos;
};
// Set the center pos to 0 if it isn't defined
if ((count _pos)<3) then
{
_pos set [2,0];
};
// Set the z-pos offset to 0 if it isn't defined
if ((count _relPos)<3) then
{
_relPos set [2,0];
};
_npos =
[
(_pos select 0)+(_relPos select 0),
(_pos select 1)+(_relPos select 1),
(_pos select 2)+(_relPos select 2)
];
_npos

View File

@ -0,0 +1,74 @@
/*
DMS_fnc_ImportFromM3E
Created by eraser1
Check out M3 Editor: http://maca134.co.uk/portfolio/m3editor-arma-3-map-editor/
Usage:
[
_file, // String: The filename (or filepath under the objects folder) that contains the exported M3E objects
_pos // Object or Array: Center position
] call DMS_fnc_ImportFromM3E;
Returns all created objects.
*/
private ["_file", "_pos", "_objs", "_export", "_obj", "_objPos"];
_OK = params
[
["_file","",[""]],
["_pos","",[[],objNull],[2,3]]
];
if (!_OK) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E with invalid parameters: %1",_this];
[]
};
// Get the position if an object was supplied instead of position
if ((typeName _pos)=="OBJECT") then
{
_pos = getPos _pos;
};
// Set the center pos to 0 if it isn't defined
if ((count _pos)<3) then
{
_pos set [2,0];
};
_objs = [];
_export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\%1.sqf",_file]);
{
// Create the object
_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
// Calculate the object's position using provided relative position
_objPos = [_pos,_x select 1] call DMS_fnc_CalcPos;
if (((count _x)>4) && {!(_x select 4)}) then
{
// Supports bank/pitch
_obj setPosATL _objPos;
_obj setVectorDirAndUp (_x select 3);
}
else
{
_obj setDir (_x select 2);
_obj setPos _objPos;
};
_objs pushBack _obj;
} foreach _export;
_objs

View File

@ -48,7 +48,8 @@ if(DMS_ai_remove_launchers && {_launcher != ""}) then
_unit removeWeaponGlobal _launcher;
{
if(_x == _rockets) then {
if(_x == _rockets) then
{
_unit removeMagazine _x;
};
} forEach magazines _unit;

View File

@ -15,12 +15,13 @@
_class, // Class: "random","assault","MG","sniper" or "unarmed"
_difficulty, // Difficulty: "random","static","hardcore","difficult","moderate", or "easy"
_side // "bandit","hero", etc.
_MGClass // !OPTIONAL) String: classname of the MG. Use "random" to select a random one from DMS_static_weapons
] call DMS_fnc_SpawnAIStatic;
Returns an array of static gun objects.
*/
private ["_OK", "_guns", "_pos", "_gun", "_unit", "_group", "_class", "_difficulty", "_side", "_positions"];
private ["_OK", "_guns", "_pos", "_MGClassInput", "_MGClass", "_gun", "_unit", "_group", "_class", "_difficulty", "_side", "_positions"];
_OK = params
@ -37,13 +38,21 @@ if (!_OK) exitWith
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIStatic with invalid parameters: %1",_this];
};
_MGClassInput = param [5,"random",[""]];
_guns = [];
{
_pos = _x;
_gun = createVehicle [(DMS_static_weapons call BIS_fnc_selectRandom), _pos, [], 0, "CAN_COLLIDE"];
_MGClass = _MGClassInput;
if (_MGClass == "random") then
{
_MGClass = DMS_static_weapons call BIS_fnc_selectRandom;
};
_gun = createVehicle [_MGClass, _pos, [], 0, "CAN_COLLIDE"];
_gun setDir (random 360);
_gun setPosATL _pos;
_gun addEventHandler ["GetOut",{(_this select 0) setDamage 1;}];

Binary file not shown.

View File

@ -78,9 +78,20 @@ if (!hasInterface && !isServer) then
## Changelog:
#### September 13, 2015 (1:00 AM CST-America):
* New config value: ```DMS_AI_WP_Radius_base``` . Tiny waypoint radius for "base defence".
* New mission: "mercbase". Known issue: Stuff gets messed up when the mission spawns on a steep slope. Blame BIS for breaking "BIS_fnc_findSafePos" :P
* Added Taviana map safe pos params. (thanks JamieKG!)
* New functions: "DMS_fnc_CalcPos" and "DMS_fnc_ImportFromM3E".
* You can now import bases from Maca's awesome M3 Editor! Simply create the file under the "objects" folder, then call "DMS_fnc_ImportFromM3E"! Refer to the new "mercbase" mission as an example.
* "DMS_fnc_ImportFromM3E" supports static position (make sure you pass [0,0,0] as the second parameter), relative position, as well as bank/pitch. In addition, you get parameter parsing, just like any other DMS function, so if you're messing around with stuff and make a mistake, it will tell you ;)
* You can now specify which gun that an static AI spawns with.
#### September 12, 2015 (1:30 AM CST-America):
* Added Esseker map safe pos params. (thanks Flowrider!)
#### September 11, 2015 (8:30 PM CST-America):
* NEW CONFIG VALUES: ```DMS_GodmodeCrates``` and ```DMS_CrateCase_Sniper```. DMS_GodmodeCrates is pretty self-explanatory :P
* NEW FEATURE FOR "DMS_fnc_FillCrate": You can now define "crate cases" in the config (such as "DMS_CrateCase_Sniper"). Passing the "crate case" name (such as "Sniper") will make the crate spawn with the exact gear defined in the config. Refer to the testmission.sqf (line 80) and "DMS_CrateCase_Sniper" config for an example.