Jump to content

FMission


Recommended Posts

There were a few things that needed fixing, I didn't test this but it should work. Take a look at it and it should help you fix your other mission. Remember to add your _names to private.

/*
File Name: FMission_M3_DeathWish.sqf
File Created: 3/29/2014
File Version: 1.0
File Author: Snakeyes
File Last Edit Date: 3/29/2014
File Description: DeathWish (M3)
Template by: Foamy
*/

// CHECK FOR ANOTHER MISSION 3 RUNNING START ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

if (isNil "EPOCH_MISSION3_RUNNING") then
{
EPOCH_MISSION3_RUNNING = false;
};

if (EPOCH_MISSION3_RUNNING) exitWith
{
diag_log("MISSION 3 already running");
};

// CHECK FOR ANOTHER MISSION 3 RUNNING END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// Don't forget to add all your "_names" to the private section
private ["_missionSpawnChance","_spawnMarker","_spawnRadius","_markerRadius","_markerColor","_item","_loot","_loot_lists","_loot_box","_wait_time","_spawnRoll","_position","_loot_pos","_loot_box","_textMarker_IconType","_markerText","_markerBrush","_base","_aiunit_spawn_pos","_aivehicle_spawn_pos","_aiheli_spawn_pos","_aiunit1","_aiunit2","_aiunit3","_aiunit4","_aiunit5","_aiunit6","_aiunit7","_aiunit8","_aiunit9","_aiunit10","_aiunit11","_attackgroup","_attacker1","_attacker2","_targetunitsAlive","_timeout"];

diag_log("MISSION 3: DeathWish - Script Started");

_missionSpawnChance = 1; //Set Spawn Chance Here 1 = always
_spawnRoll = random 1;

diag_log("MISSION 3: DeathWish - Checking MissionSpawnChance");
if (_spawnRoll > _missionSpawnChance) exitWith
{
diag_log format ["MISSION 3: DeathWish - Failed with %1 it needed to be lower than %2",_spawnRoll,_missionSpawnChance];
};

sleep .5;
diag_log("MISSION 3: DeathWish - Mission SpawnChance Success");

sleep .5;
diag_log("MISSION 3: DeathWish - Mission Script Started");

EPOCH_MISSION3_RUNNING = true;

/*
// Edit Loot Box Contents Below
// Format is:
// 1st row = Weapons, Tools ( Compass, etc)
// 2nd row = Ammo, Food items etc
// 3rd row = Backpacks

The loot example in this template has 2 loadouts to choose from, you can add as many as you want. The more you add the more
variety you will have.
Each addition will use a block like this:
[
["DMR","NVGoggles","Binocular_Vector"],
["20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","ItemSodaMdew","ItemSodaR4z0r","ItemAntibiotic"],
["DZ_Backpack_EP1"]
], <---- The , is NOT needed on last loot block, see example below where the , is only used to separate the
first block from the second block. There is no , at the end of the second block as it is the last block in
the list.
*/

//---------------------------------------------------------------------------------

// Loot Box Setup
_loot_box = "GuerillaCacheBox";
_loot_lists = [
[
["DMR","DMR","DMR","NVGoggles","NVGoggles","Binocular_Vector","Binocular_Vector"],
["20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","ItemSodaMdew","ItemSodaR4z0r","ItemAntibiotic"],
["DZ_Backpack_EP1"]
],
[
["M4A1_AIM_SD_CAMO","ItemGPS","Binocular"],
["30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","ItemSodaRbull"],
["DZ_ALICE_Pack_EP1"]
]
];

//---------------------------------------------------------------------------------

_loot = _loot_lists call BIS_fnc_selectRandom;

// Mission Variables
mission_despawn_timer = 1200; // This sets the Timeout if a timer is used.
_wait_time = 900; // This is how long the loot box will stay once it spawns.
_spawnRadius = 5000; // This is the distance from Center - Used to determine the radius in which missions will spawn
_spawnMarker = 'center'; // DO NOT Change this, UNLESS you need a hard coded center loc for custom purposes
_markerRadius = 350; // This sets marker radius and the area the loot can spawn in
_markerColor = "ColorBlue"; // This sets the Marker Color
_textMarker_IconType = "mil_objective"; // This sets the "Icon Type" (https://community.bi...wiki/cfgMarkers) 
_markerText = "Mission: Sniper Alley"; // Text to display at Marker (Leave "" blank if you dont want a message)
_markerBrush = "SOLID"; // Marker Brush - How the marker is filled in


// This sets the global position coords the mission needs to run, do not change.
_position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,20,0] call BIS_fnc_findSafePos;
_loot_pos = [_position,0,(_markerRadius - 100),10,0,20,0] call BIS_fnc_findSafePos;

// Use these if using AI, Vehicles or Helis
_aiunit_spawn_pos = [_loot_pos, 30, 50, 30, 0, 20, 0] call BIS_fnc_findSafePos;
_aivehicle_spawn_pos = [_loot_pos, 30, 50, 30, 0, 20, 0] call BIS_fnc_findSafePos;
_aiheli_spawn_pos = [_loot_pos, 30, 50, 30, 0, 20, 0] call BIS_fnc_findSafePos;

//---------------------------------------------------------------------------------
// Mission Body STARTS Here
// Read General Script Instructions for Variable Usage per script.

// Add a Marker? Make sure to use FMarker3.sqf for M3 Missions
[_position,_loot_pos,_markerRadius,_markerColor,false,_textMarker_IconType,_markerText,_markerBrush] execVM "\z\addons\dayz_server\addons\FMission\FMarker\FMarker3.sqf";

// Add a base
_base = createVehicle ["Land_fortified_nest_big",_loot_pos,[], 0, "CAN_COLLIDE"];
_base setPos _loot_pos;

// Add some AI to patrol
sleep 1;

diag_log("MISSION 3: DeathWish - Loading -=FAI Units=- Started");

_aiunit1 = [_aiunit_spawn_pos,50,4,"Bandit",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit2 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit3 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit4 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit5 = [_aiunit_spawn_pos,50,4,"Medic",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit6 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit7 = [_aiunit_spawn_pos,50,4,"Medic",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit8 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit9 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit10 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit11 = [_aiunit_spawn_pos,50,4,"Bandit",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

sleep 10;
diag_log("MISSION 3: DeathWish - Loading -=FAI=- Completed");

sleep .5;

// Add a one off custom AI
_attackgroup = createGroup east;

_attacker1 = _attackgroup createUnit ["TK_INS_Soldier_3_EP1", _base, [], 0, "Form"];
[_attacker1] execVM "\z\addons\dayz_server\addons\FMission\FLoot\FLoot_Bandit.sqf";
_attacker1 setUnitPos "Middle";

_attacker2 = _attackgroup createUnit ["TK_Soldier_Medic_EP1", _base, [], 0, "Form"];
[_attacker2] execVM "\z\addons\dayz_server\addons\FMission\FLoot\FLoot_Medic.sqf";
_attacker2 setUnitPos "Middle";

_attackgroup setCombatMode "RED";
_attackgroup setBehaviour "STEALTH";


// Add a Heli Patrol
_aiHeli = [_aiheli_spawn_pos,_loot_pos,250,"M1"] execVM "\z\addons\dayz_server\addons\FAI\FMission\FAI_Create_Heli.sqf";


// Add a Vehicle patrols?
_aiVehicle = [_aivehicle_spawn_pos,_loot_pos,100,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Vehicle.sqf";


[nil,nil,rTitleText,"MISSION: DeathWish - A group of Bandit Snipers are wreaking havoc in the area. Go check it out!", "PLAIN",10] call RE;

diag_log("MISSION 3: DeathWish - Waiting...");
_timeout = time + mission_despawn_timer;

waitUntil
{
_targetunitsAlive = {alive _x} count (units _attackgroup);
((time > _timeout) || (_targetunitsAlive < 1))
};

	_targetunitsAlive = {alive _x} count (units _attackgroup);
	if (_targetunitsAlive < 1) then
	{
	[nil,nil,rTitleText,"MISSION: Survivors have eliminated the Bandit Snipers and their comrades, Good Job.", "PLAIN",10] call RE;

	// Create loot box
	diag_log("MISSION 3: DeathWish - Creating loot box");
	_loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
	_loot_box setPos _loot_pos;
	clearMagazineCargoGlobal _loot_box;
	clearWeaponCargoGlobal _loot_box;
	clearBackpackCargoGlobal _loot_box;

	// Add loot
	diag_log("MISSION 3: DeathWish - Loot box created, adding loot to loot box");
	{
	_loot_box addWeaponCargoGlobal [_x,1];
	} forEach (_loot select 0);
	{
	_loot_box addMagazineCargoGlobal [_x,1];
	} forEach (_loot select 1);
	{
	_loot_box addBackpackCargoGlobal [_x,1];
	} forEach (_loot select 2);

	// Wait for awhile so loot can be collected?
	sleep _wait_time;

	// Clean up
	EPOCH_MISSION3_RUNNING = false;

	deleteVehicle _base;
	deleteVehicle _loot_box;
	{ deleteVehicle _x } forEach units _attackgroup;
	deleteGroup _attackgroup;

	diag_log("MISSION 3: DeathWish - Script Finished");
	}
	else
	{
	[nil,nil,rTitleText,"MISSION: Mission Failed", "PLAIN",10] call RE;

	// Clean up
	EPOCH_MISSION3_RUNNING = false;

	deleteVehicle _base;
	{ deleteVehicle _x } forEach units _attackgroup;
	deleteGroup _attackgroup;

	diag_log("MISSION 3: DeathWish - Script Finished");
	};
Link to comment
Share on other sites

Really interested in this project! Looks really good! Will be hoping to add some of my builds to this :). One quick question, ive recently moved to a vilayer server and i cannot find my init.sqf in my dayz_server folder! Any ideas lads? 

 

Cheers

 

Your init.sqf should be in the root of the mission folder as Snakeyes said. It is in the same folder as the mission.sqf and the description.ext files.

Link to comment
Share on other sites

Your init.sqf should be in the root of the mission folder as Snakeyes said. It is in the same folder as the mission.sqf and the description.ext files.

 

Yes, on vilayer the map directories are changed a little bit.

 

You have vilayercodecustom in which you will see dayz_server = this is your server.pbo

 

In that directory you should also find a folder called missions, u need to enter that one to find your mission files. For chernarus it is called:

epoch.chernarus, namalsk is epoch.namalsk and so on.

 

Had to write this from memory because I run on a dedicated now but it should be correct.

 

Good luck finding it!

Link to comment
Share on other sites

I'm running 2 missions for M1 and 2 missions for M3. So with my current settings either has a 50% chance of running in an hour cycle. After two hours of server time no missions have spawned in at all. I think I'll bump the mission spawn chance up to 75% and try that. I don't mind that they don't always spawn, but I would like to see them spawn in once in awhile. BTW, I know that I can force the mission spawn with mission spawn chance = 1, but I like the randomness and the chance that they will not spawn occasionally.

Link to comment
Share on other sites

How do I use static vehicles for mission props? I have some mission ideas that require using crashed vehicles as props. For example, a bandit C-130 crash carrying building supplies or a bandit Ural crash carrying medical supplies, etc. What would the code look like and where do I add it into an existing template for FMission? After the mission ends, would the object be included in the clean up code? Thanks.

 

:)

Link to comment
Share on other sites

I'm running 2 missions for M1 and 2 missions for M3. So with my current settings either has a 50% chance of running in an hour cycle. After two hours of server time no missions have spawned in at all. I think I'll bump the mission spawn chance up to 75% and try that. I don't mind that they don't always spawn, but I would like to see them spawn in once in awhile. BTW, I know that I can force the mission spawn with mission spawn chance = 1, but I like the randomness and the chance that they will not spawn occasionally.

 

Since the determining spawnroll is random you have just been unlucky at 50%. Don't forget you can add in multiple entries for each launcher. You can run any Launcher more than once an hour.

 

 

How do I use static vehicles for mission props? I have some mission ideas that require using crashed vehicles as props. For example, a bandit C-130 crash carrying building supplies or a bandit Ural crash carrying medical supplies, etc. What would the code look like and where do I add it into an existing template for FMission? After the mission ends, would the object be included in the clean up code? Thanks.

 

:)

 

 

I will be releasing a Code Block file for FMission that will contain a bunch of pre-made code blocks for FMission that you can simply copy in and modify to add stuff to scripts. I will include a snippet for adding wrecks and other various objects. 

 

As far as the placement it would go in the mission body in the order it would need to spawn. I made a tutorial video for creating a mission in FMission. Watch it and that should help you.

Link to comment
Share on other sites

You cover a lot of the basics in the FMission text files included in the download. Install, set-up, mission logic, etc. Currently, I'm creating very simple Hunt/Gather missions (M3) with AI and AI Patrols. I would like to see another tut covering the use of stage props for a mission, such as a crashed vehicle. It could be anything from a cargo truck to a C-130. That would help me to create more advanced missions. I can't tell a proper story without setting the stage with static props.

 

Thank you!

 

:)

Link to comment
Share on other sites

Thanks for the mission system foamy.  Works quite well.  Took me a few minutes to get my head wrapped around your concept and structure but I figured it out.

 

I just need more missions now.  I have several basic missions like supply drops etc but I'd really like to have more scenario missions with interactive ai like the 2 included.

 

Anyone have any to share?

Link to comment
Share on other sites

Hi chisel,

 

Here are two missions that I have made for FMission. You are welcome to them.

 

Death Wish

/*


File Name: FMission_M3_DeathWish.sqf
File Created: 3/29/2014
File Version: 1.0
File Author: Snakeyes
File Last Edit Date: 3/29/2014
File Description: DeathWish (M3)
Template by: Foamy
*/

// CHECK FOR ANOTHER MISSION 3 RUNNING START ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

if (isNil "EPOCH_MISSION3_RUNNING") then
{
EPOCH_MISSION3_RUNNING = false;
};

if (EPOCH_MISSION3_RUNNING) exitWith
{
diag_log("MISSION 3 already running");
};

// CHECK FOR ANOTHER MISSION 3 RUNNING END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// Don't forget to add all your "_names" to the private section
private ["_missionSpawnChance","_spawnMarker","_spawnRadius","_markerRadius","_markerColor","_item","_loot","_loot_lists","_loot_box","_wait_time","_spawnRoll","_position","_loot_pos","_loot_box","_textMarker_IconType","_markerText","_markerBrush","_base","_aiunit_spawn_pos","_aivehicle_spawn_pos","_aiheli_spawn_pos","_aiunit1","_aiunit2","_aiunit3","_aiunit4","_aiunit5","_aiunit6","_aiunit7","_aiunit8","_aiunit9","_aiunit10","_aiunit11","_attackgroup","_attacker1","_attacker2","_targetunitsAlive","_timeout"];

diag_log("MISSION 3: DeathWish - Script Started");

_missionSpawnChance = 1; //Set Spawn Chance Here 1 = always
_spawnRoll = random 1;

diag_log("MISSION 3: DeathWish - Checking MissionSpawnChance");
if (_spawnRoll > _missionSpawnChance) exitWith
{
diag_log format ["MISSION 3: DeathWish - Failed with %1 it needed to be lower than %2",_spawnRoll,_missionSpawnChance];
};

sleep .5;
diag_log("MISSION 3: DeathWish - Mission SpawnChance Success");

sleep .5;
diag_log("MISSION 3: DeathWish - Mission Script Started");

EPOCH_MISSION3_RUNNING = true;

/*
// Edit Loot Box Contents Below
// Format is:
// 1st row = Weapons, Tools ( Compass, etc)
// 2nd row = Ammo, Food items etc
// 3rd row = Backpacks

The loot example in this template has 2 loadouts to choose from, you can add as many as you want. The more you add the more
variety you will have.
Each addition will use a block like this:
[
["DMR","NVGoggles","Binocular_Vector"],
["20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","ItemSodaMdew","ItemSodaR4z0r","ItemAntibiotic"],
["DZ_Backpack_EP1"]
], <---- The , is NOT needed on last loot block, see example below where the , is only used to separate the
first block from the second block. There is no , at the end of the second block as it is the last block in
the list.
*/

//---------------------------------------------------------------------------------

// Loot Box Setup
_loot_box = "GuerillaCacheBox";
_loot_lists = [
[
["DMR","DMR","DMR","NVGoggles","NVGoggles","Binocular_Vector","Binocular_Vector"],
["20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","ItemSodaMdew","ItemSodaR4z0r","ItemAntibiotic"],
["DZ_Backpack_EP1"]
],
[
["M4A1_AIM_SD_CAMO","ItemGPS","Binocular"],
["30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","ItemSodaRbull"],
["DZ_ALICE_Pack_EP1"]
]
];

//---------------------------------------------------------------------------------

_loot = _loot_lists call BIS_fnc_selectRandom;

// Mission Variables
mission_despawn_timer = 1200; // This sets the Timeout if a timer is used.
_wait_time = 900; // This is how long the loot box will stay once it spawns.
_spawnRadius = 5000; // This is the distance from Center - Used to determine the radius in which missions will spawn
_spawnMarker = 'center'; // DO NOT Change this, UNLESS you need a hard coded center loc for custom purposes
_markerRadius = 350; // This sets marker radius and the area the loot can spawn in
_markerColor = "ColorBlue"; // This sets the Marker Color
_textMarker_IconType = "mil_objective"; // This sets the "Icon Type" (https://community.bi...wiki/cfgMarkers)
_markerText = "Mission: Sniper Alley"; // Text to display at Marker (Leave "" blank if you dont want a message)
_markerBrush = "SOLID"; // Marker Brush - How the marker is filled in


// This sets the global position coords the mission needs to run, do not change.
_position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,20,0] call BIS_fnc_findSafePos;
_loot_pos = [_position,0,(_markerRadius - 100),10,0,20,0] call BIS_fnc_findSafePos;

// Use these if using AI, Vehicles or Helis
_aiunit_spawn_pos = [_loot_pos, 30, 50, 30, 0, 20, 0] call BIS_fnc_findSafePos;
_aivehicle_spawn_pos = [_loot_pos, 30, 50, 30, 0, 20, 0] call BIS_fnc_findSafePos;
_aiheli_spawn_pos = [_loot_pos, 30, 50, 30, 0, 20, 0] call BIS_fnc_findSafePos;

//---------------------------------------------------------------------------------
// Mission Body STARTS Here
// Read General Script Instructions for Variable Usage per script.

// Add a Marker? Make sure to use FMarker3.sqf for M3 Missions
[_position,_loot_pos,_markerRadius,_markerColor,false,_textMarker_IconType,_markerText,_markerBrush] execVM "\z\addons\dayz_server\addons\FMission\FMarker\FMarker3.sqf";

// Add a base
_base = createVehicle ["Land_fortified_nest_big",_loot_pos,[], 0, "CAN_COLLIDE"];
_base setPos _loot_pos;

// Add some AI to patrol
sleep 1;

diag_log("MISSION 3: DeathWish - Loading -=FAI Units=- Started");

_aiunit1 = [_aiunit_spawn_pos,50,4,"Bandit",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit2 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit3 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit4 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit5 = [_aiunit_spawn_pos,50,4,"Medic",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit6 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit7 = [_aiunit_spawn_pos,50,4,"Medic",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit8 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit9 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit10 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit11 = [_aiunit_spawn_pos,50,4,"Bandit",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

sleep 10;
diag_log("MISSION 3: DeathWish - Loading -=FAI=- Completed");

sleep .5;

// Add a one off custom AI
_attackgroup = createGroup east;

_attacker1 = _attackgroup createUnit ["TK_INS_Soldier_3_EP1", _base, [], 0, "Form"];
[_attacker1] execVM "\z\addons\dayz_server\addons\FMission\FLoot\FLoot_Bandit.sqf";
_attacker1 setUnitPos "Middle";

_attacker2 = _attackgroup createUnit ["TK_Soldier_Medic_EP1", _base, [], 0, "Form"];
[_attacker2] execVM "\z\addons\dayz_server\addons\FMission\FLoot\FLoot_Medic.sqf";
_attacker2 setUnitPos "Middle";

_attackgroup setCombatMode "RED";
_attackgroup setBehaviour "STEALTH";


// Add a Heli Patrol
_aiHeli = [_aiheli_spawn_pos,_loot_pos,250,"M1"] execVM "\z\addons\dayz_server\addons\FAI\FMission\FAI_Create_Heli.sqf";


// Add a Vehicle patrols?
_aiVehicle = [_aivehicle_spawn_pos,_loot_pos,100,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Vehicle.sqf";


[nil,nil,rTitleText,"MISSION: DeathWish - A group of Bandit Snipers are wreaking havoc in the area. Go check it out!", "PLAIN",10] call RE;

diag_log("MISSION 3: DeathWish - Waiting...");
_timeout = time + mission_despawn_timer;

waitUntil
{
_targetunitsAlive = {alive _x} count (units _attackgroup);
((time > _timeout) || (_targetunitsAlive < 1))
};

_targetunitsAlive = {alive _x} count (units _attackgroup);
if (_targetunitsAlive < 1) then
{
[nil,nil,rTitleText,"MISSION: Survivors have eliminated the Bandit Snipers and their comrades, Good Job.", "PLAIN",10] call RE;

// Create loot box
diag_log("MISSION 3: DeathWish - Creating loot box");
_loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
_loot_box setPos _loot_pos;
clearMagazineCargoGlobal _loot_box;
clearWeaponCargoGlobal _loot_box;
clearBackpackCargoGlobal _loot_box;

// Add loot
diag_log("MISSION 3: DeathWish - Loot box created, adding loot to loot box");
{
_loot_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_loot_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_loot_box addBackpackCargoGlobal [_x,1];
} forEach (_loot select 2);

// Wait for awhile so loot can be collected?
sleep _wait_time;

// Clean up
EPOCH_MISSION3_RUNNING = false;

deleteVehicle _base;
deleteVehicle _loot_box;
{ deleteVehicle _x } forEach units _attackgroup;
deleteGroup _attackgroup;

diag_log("MISSION 3: DeathWish - Script Finished");
}
else
{
[nil,nil,rTitleText,"MISSION: Mission Failed", "PLAIN",10] call RE;

// Clean up
EPOCH_MISSION3_RUNNING = false;

deleteVehicle _base;
{ deleteVehicle _x } forEach units _attackgroup;
deleteGroup _attackgroup;

diag_log("MISSION 3: DeathWish - Script Finished");
};

 

Wells Fargo

/*


File Name: FMission_M3_WellsFargo.sqf
File Created: 3/28/2014
File Version: 1.0
File Author: Snakeyes
File Last Edit Date: 3/28/2014
File Description: WellsFargo (M3)
Template by: Foamy
*/

// CHECK FOR ANOTHER MISSION 3 RUNNING START ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

if (isNil "EPOCH_MISSION3_RUNNING") then
{
EPOCH_MISSION3_RUNNING = false;
};

if (EPOCH_MISSION3_RUNNING) exitWith
{
diag_log("MISSION 3 already running");
};

// CHECK FOR ANOTHER MISSION 3 RUNNING END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// Don't forget to add all your "_names" to the private section
private ["_missionSpawnChance","_spawnMarker","_spawnRadius","_markerRadius","_markerColor","_item","_loot","_loot_lists","_loot_box","_wait_time","_spawnRoll","_position","_loot_pos","_loot_box","_textMarker_IconType","_markerText","_markerBrush","_base","_aiunit_spawn_pos","_aivehicle_spawn_pos","_aiheli_spawn_pos","_aiunit1","_aiunit2","_aiunit3","_aiunit4","_aiunit5","_aiunit6","_aiunit7","_attackgroup","_attacker1","_attacker2","_targetunitsAlive","_timeout"];

diag_log("MISSION 3: WellsFargo - Script Started");

_missionSpawnChance = 1; //Set Spawn Chance Here 1 = always
_spawnRoll = random 1;

diag_log("MISSION 3: WellsFargo - Checking MissionSpawnChance");
if (_spawnRoll > _missionSpawnChance) exitWith
{
diag_log format ["MISSION 3: WellsFargo - Failed with %1 it needed to be lower than %2",_spawnRoll,_missionSpawnChance];
};

sleep .5;
diag_log("MISSION 3: WellsFargo - Mission SpawnChance Success");

sleep .5;
diag_log("MISSION 3: WellsFargo - Mission Script Started");

EPOCH_MISSION3_RUNNING = true;

/*
// Edit Loot Box Contents Below
// Format is:
// 1st row = Weapons, Tools ( Compass, etc)
// 2nd row = Ammo, Food items etc
// 3rd row = Backpacks

The loot example in this template has 2 loadouts to choose from, you can add as many as you want. The more you add the more
variety you will have.
Each addition will use a block like this:
[
["DMR","NVGoggles","Binocular_Vector"],
["20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","ItemSodaMdew","ItemSodaR4z0r","ItemAntibiotic"],
["DZ_Backpack_EP1"]
], <---- The , is NOT needed on last loot block, see example below where the , is only used to separate the
first block from the second block. There is no , at the end of the second block as it is the last block in
the list.
*/

//---------------------------------------------------------------------------------

// Loot Box Setup
_loot_box = "GuerillaCacheBox";
_loot_lists = [
[
["DMR","NVGoggles","Binocular_Vector"],
["20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","ItemSodaMdew","ItemSodaR4z0r","ItemAntibiotic"],
["DZ_Backpack_EP1"]
],
[
["M4A1_AIM_SD_CAMO","ItemGPS","Binocular"],
["30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","ItemSodaRbull"],
["DZ_ALICE_Pack_EP1"]
],
[
["glock17_EP1"]
["17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemBriefcase100oz","ItemGoldBar10oz","ItemGoldBar10oz","ItemGoldBar10oz","ItemGoldBar10oz","ItemGoldBar10oz","ItemGoldBar10oz","ItemMorphine"]
[DZ_CivilBackpack_EP1]
];

//---------------------------------------------------------------------------------

_loot = _loot_lists call BIS_fnc_selectRandom;

// Mission Variables
mission_despawn_timer = 1200; // This sets the Timeout if a timer is used.
_wait_time = 900; // This is how long the loot box will stay once it spawns.
_spawnRadius = 5000; // This is the distance from Center - Used to determine the radius in which missions will spawn
_spawnMarker = 'center'; // DO NOT Change this, UNLESS you need a hard coded center loc for custom purposes
_markerRadius = 350; // This sets marker radius and the area the loot can spawn in
_markerColor = "ColorBlue"; // This sets the Marker Color
_textMarker_IconType = "mil_objective"; // This sets the "Icon Type" (https://community.bistudio.com/wiki/cfgMarkers)
_markerText = "Mission: Wells Fargo Transport"; // Text to display at Marker (Leave "" blank if you dont want a message)
_markerBrush = "SOLID"; // Marker Brush - How the marker is filled in


// This sets the global position coords the mission needs to run, do not change.
_position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,20,0] call BIS_fnc_findSafePos;
_loot_pos = [_position,0,(_markerRadius - 100),10,0,20,0] call BIS_fnc_findSafePos;

// Use these if using AI, Vehicles or Helis
_aiunit_spawn_pos = [_loot_pos, 30, 50, 30, 0, 20, 0] call BIS_fnc_findSafePos;
_aivehicle_spawn_pos = [_loot_pos, 30, 50, 30, 0, 20, 0] call BIS_fnc_findSafePos;
_aiheli_spawn_pos = [_loot_pos, 30, 50, 30, 0, 20, 0] call BIS_fnc_findSafePos;

//---------------------------------------------------------------------------------
// Mission Body STARTS Here
// Read General Script Instructions for Variable Usage per script.

// Add a Marker? Make sure to use FMarker3.sqf for M3 Missions
[_position,_loot_pos,_markerRadius,_markerColor,false,_textMarker_IconType,_markerText,_markerBrush] execVM "\z\addons\dayz_server\addons\FMission\FMarker\FMarker3.sqf";

// Add a base?
_base = createVehicle ["Land_fortified_nest_big",_loot_pos,[], 0, "CAN_COLLIDE"];
_base setPos _loot_pos;

// Add some AI to patrol?
sleep 1;

diag_log("MISSION 3: WellsFargo - Loading -=FAI Units=- Started");

_aiunit1 = [_aiunit_spawn_pos,50,4,"Bandit",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit2 = [_aiunit_spawn_pos,50,4,"Bandit",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit3 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit4 = [_aiunit_spawn_pos,50,4,"Medic",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit5 = [_aiunit_spawn_pos,50,4,"Sniper",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit6 = [_aiunit_spawn_pos,50,4,"Bandit",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

_aiunit7 = [_aiunit_spawn_pos,50,4,"Bandit",_loot_pos,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Unit.sqf";

sleep 10;
diag_log("MISSION 3: WellsFargo - Loading -=FAI=- Completed");

sleep .5;

// Add a one off custom AI?
_attackgroup = createGroup east;

_attacker1 = _attackgroup createUnit ["TK_INS_Soldier_3_EP1", _base, [], 0, "Form"];
_attacker1 setUnitPos "AUTO";
[_attacker1] execVM "\z\addons\dayz_server\addons\FMission\FLoot\FLoot_Bandit.sqf";
_attacker1 setUnitPos "Middle";

_attacker2 = _attackgroup createUnit ["TK_Soldier_Medic_EP1", _base, [], 0, "Form"];
_attacker2 setUnitPos "AUTO";
_null = [_attacker2] execVM "\z\addons\dayz_server\addons\FMission\FLoot\FLoot_Medic.sqf";
_attacker2 setUnitPos "Middle";

_attackgroup setCombatMode "RED";
_attackgroup setBehaviour "STEALTH";


// Add a Heli Patrol?
_aiHeli = [_aiheli_spawn_pos,_loot_pos,250,"M1"] execVM "\z\addons\dayz_server\addons\FAI\FMission\FAI_Create_Heli.sqf";

// Add a Vehicle patrols?
_aiVehicle = [_aivehicle_spawn_pos,_loot_pos,100,"M1"] execVM "\z\addons\dayz_server\addons\FMission\FAI\FAI_Create_Vehicle.sqf";


[nil,nil,rTitleText,"MISSION: WellsFargo - A Wells Fargo Transport has crashed. Hurry there now to secure the location!", "PLAIN",10] call RE;

diag_log("MISSION 3: WellsFargo - Waiting...");
_timeout = time + mission_despawn_timer;
waitUntil
{
_targetunitsAlive = {alive _x} count (units _targetgroup);
((time > _timeout) || (_targetunitsAlive < 1))
};

_targetunitsAlive = {alive _x} count (units _targetgroup);
if (_targetunitsAlive < 1) then
{
[nil,nil,rTitleText,"MISSION: Survivors have captured the Wells Fargo Transport cargo and eliminated the Bandits, Good Job.", "PLAIN",10] call RE;


// Create a loot box?
// Create loot box
diag_log("MISSION 3: WellsFargo - Creating loot box");
_loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
_loot_box setPos _loot_pos;
clearMagazineCargoGlobal _loot_box;
clearWeaponCargoGlobal _loot_box;
clearBackpackCargoGlobal _loot_box;

// Add loot
diag_log("MISSION 3: WellsFargo - Loot box created, adding loot to loot box");
{
_loot_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_loot_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_loot_box addBackpackCargoGlobal [_x,1];
} forEach (_loot select 2);

// Wait for awhile so loot can be collected?
sleep _wait_time;


// Mission Body ENDS here
// ---------------------------------------------------------------------------------


// Add additional deleteVehicle _xxx; for each item that needs to be deleted.
// Add additional deleteVehicle _xxgroup; to delete the AI units
// Clean up
EPOCH_MISSION3_RUNNING = false;

deleteVehicle _base;
deleteVehicle _loot_box;
{ deleteVehicle _x } forEach units _targetgroup;
deleteGroup _targetgroup;
{ deleteVehicle _x } forEach units _attackgroup;
deleteGroup _attackgroup;

diag_log("MISSION 3: WellsFargo - Script Finished");
}
else
{
[nil,nil,rTitleText,"MISSION: Mission Failed", "PLAIN",10] call RE;

// Clean up
EPOCH_MISSION3_RUNNING = false;

deleteVehicle _base;
{ deleteVehicle _x } forEach units _attackgroup;
deleteGroup _attackgroup;

diag_log("MISSION 3: WellsFargo - Script Finished");
};

Link to comment
Share on other sites

Hey Foamy, I've just noticed the AI unit that are spawned with the following code:

_aiunit1 = [_aiunit_spawn_pos,10,1,"Sniper",_loot_pos,M3] execVM "\z\addons\dayz_server\custom\FMission\FAI\FAI_Create_Unit.sqf";

...are not cleaned up when the mission ends. This will of course hinder performance after a few hours and also leaves large quanities of AI dotted around the map. Can you confirm this as a limitation of the mission system itself, or an I doing something wrong?

 

I've tried;

deleteVehicle _aiunitX; // X of course being 1, 2, 3 for each unit, not a typo..

.. for each unit but that didn't seem to work, but I honestly thought that it would. Slightly confused, can you give me any ideas as to the correct way to delete these particular types of AI.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...