Jump to content

WAI sample mission sqf explained


gopostal

Recommended Posts

Following is a heavily commented mission I pulled from my custom stuff. It should go a long way to help server admins create their own missions. It's really not that hard if you can follow some basic ideas of map location and logic flow.

 

// This is meant as an example script and should not be used in your mission folder.


//It's main use it to explain all the different sections and what to change depending on
//what you want to do. If you have further questions please don't hesitate to drop me a
//line. My email is [email protected]

//This mission is meant to be used on the Napf map and so will not work right on any other.
//Let's begin, shall we?

// This is the variable declaration section. These are the vars used in the following code. You MUST
//declare your variables here for them to replicate properly from server to client. Mostly you won't
//need to edit anything in this.
private ["_playerPresent","_cleanmission","_currenttime","_starttime","_missiontimeout","_vehname","_veh","_position","_vehclass","_vehdir","_objPosition"];

// This sets the class name used for the _vehclass variable.
_vehclass = "UH1H_DZE";
// Here the vehname is declared depending on what you set the vehclass above as
// This will be used later on in the code to set the proper name of the vehicle to
//the map flag everyone sees
_vehname    = getText (configFile >> "CfgVehicles" >> _vehclass >> "displayName");
// This declares the center point for the mission. Very important as most missions end when
//a player gets within X meters of the objective (which is THIS position, not the crate or vehicle).
_position = [3765.69, 14348.5, 0];
// Adds a log line to the server rpt letting you know what's currently running
diag_log format["WAI: Mission Beachhead Started At %1",_position];

// The vehicle declared above is being created and placed in this section
_veh = createVehicle [_vehclass,_position, [], 0, "CAN_COLLIDE"];
// Which way to point the vehicle? In this case it will be random
_vehdir = round(random 360);
//Set the vehicle pointing the generated way
_veh setDir _vehdir;
//These two lines are housekeeping for proper vehicle creation
clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
_veh setVariable ["ObjectID","1",true];
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_veh];
// Log line letting the rpt know the server spawned a 'vehname' declared above
diag_log format["WAI: Mission Beachhead spawned a %1",_vehname];

// Declaration of the created vehicles position
_objPosition = getPosATL _veh;

// Here we get into the actor generation. I'll explain each line

// Creates a random number from 0 to 3, then adds 3 to that number. You end up with a number
//from 3 to 6.
_rndnum = round (random 3) + 3;
// Remember when we declared the _position above? Well here it's used to set the actors down.
// Really this is easiest to think of as simple X,Y,Z coordinates. "Select 0" means the X,
//"Select 1" is the Y, and 0 is the Z or height. Above we said "_position = [3765.69, 14348.5, 0]"
//so you can plug those values in here mentally and see that it reads "3765.69" as the first value, etc.
[[_position select 0, _position select 1, 0],                  //position
// Remember the random number generated above? Here it's plugged in to create the number of actors
_rndnum,                  //Number Of units
1,                          //Skill level 0-1. Has no effect if using custom skills
"Random",                  //Primary gun set number. "Random" for random weapon set.
4,                          //Number of magazines
"",                          //Backpack "" for random or classname here.
"CZ_Special_Forces_GL_DES_EP1_DZ",                          //Skin "" for random or classname here.
"Random",                  //Gearset number. "Random" for random gear set.
true
] call spawn_group;

//This group is handled just like above.
[[_position select 0, _position select 1, 0],                  //position
4,                          //Number Of units
1,                          //Skill level 0-1. Has no effect if using custom skills
"Random",                  //Primary gun set number. "Random" for random weapon set.
4,                          //Number of magazines
"",                          //Backpack "" for random or classname here.
"CZ_Special_Forces_GL_DES_EP1_DZ",                          //Skin "" for random or classname here.
"Random",                  //Gearset number. "Random" for random gear set.
true
] call spawn_group;

// OK, now we have a wrinkle in the position statement but actually it's easy to understand. It adds a small offset to the
//position so you can spawn something close by without crushing or colliding with your previous spawned actors.
//There are two spawns in this line so don't get confused. The first one is "[_position select 0, (_position select 1) + 10, 0]"
//See the "(_position select 1) + 10" part? What that does is add a 10 unit offset to the Y variable meaning the M2 gun will render
//10 map units more to the Y direction than the _position declaration above. Ingame this means that the static gunners will appear now
//close to but not right on the clan of soldiers created above. That way everyone comes in safe and sound, grouped nicely and ready for combat.
[[[_position select 0, (_position select 1) + 10, 0],[(_position select 0) + 10, _position select 1, 0]], //position(s) (can be multiple).
"M2StaticMG",             //Classname of turret
0.5,                      //Skill level 0-1. Has no effect if using custom skills
"CZ_Special_Forces_GL_DES_EP1_DZ",              //Skin "" for random or classname here.
0,                          //Primary gun set number. "Random" for random weapon set. (not needed if ai_static_useweapon = False)
2,                          //Number of magazines. (not needed if ai_static_useweapon = False)
"",                          //Backpack "" for random or classname here. (not needed if ai_static_useweapon = False)
"Random",                  //Gearset number. "Random" for random gear set. (not needed if ai_static_useweapon = False)
true
] call spawn_static;

//This is a spawned patrol boat for this mission. It's armed and deadly. Since I need it to come in on the water
//I found a spot out in the water close to the beach and I used that position here instead of the way above. Either
//way is acceptable, it's just that the way above offers more flexibility in most cases.
//This is the center point of the patrol area
[[3689.31, 14345.4, 0],   //Position to patrol
//This is where the boat is created. This doesn't have to be the same spot, you can have the boat render into
//the game at another location and it will proceed immediately to the patrol area just above. Remember though, the
//AI are pretty dumb, don't expect them to navigate around an island or through a bridge support. Best to keep them
//close.
[3689.31, 14345.4, 0],    // Position to spawn at
//I kept this small so they could guard the beach completely
30,                    //Radius of patrol
3,                     //Number of waypoints to give
"RHIB",        //Classname of vehicle (make sure it has driver and gunner)
1                        //Skill level of units
] spawn vehicle_patrol;

//Second boat unit, just like above
[[3696.84, 14379.3, 0],   //Position to patrol
[3696.84, 14379.3, 0],    // Position to spawn at
200,                    //Radius of patrol
10,                     //Number of waypoints to give
"RHIB",        //Classname of vehicle (make sure it has driver and gunner)
1                        //Skill level of units
] spawn vehicle_patrol;

//Here I added paratroopers to cut off the retreat of players. By declaring a small trigger area I ensured
//the players would be committed to the mission before the troopers dropped in. The players come well into the
//mission before realizing there are paratroopers coming down on their rear :)  Don't overdo this though, it can
//get quite hard quite fast on players. To be honest this mission is pretty overdone but my guys wanted a squad
//level challenge
[[3765.69, 14348.5, 0],  //Position that units will be dropped by
[0,0,0],                           //Starting position of the heli
400,                               //Radius from drop position a player has to be to spawn chopper
"UH1H_DZ",                         //Classname of chopper (Make sure it has 2 gunner seats!)
7,                                 //Number of units to be para dropped
1,                                 //Skill level 0-1 or skill array number if using custom skills "Random" for random Skill array.
"Random",                          //Primary gun set number. "Random" for random weapon set.
4,                                 //Number of magazines
"",                                //Backpack "" for random or classname here.
"CZ_Special_Forces_GL_DES_EP1_DZ",                      //Skin "" for random or classname here.
"Random",                          //Gearset number. "Random" for random gear set.
False                               //True: Heli will stay at position and fight. False: Heli will leave if not under fire.
] spawn heli_para;

// This creates the map marker. It's telling the player to make a marker at "_position" (declared above) and
//call it "Beach Head".
[_position,"Beach Head"] execVM "\z\addons\dayz_server\WAI\missions\compile\markers.sqf";

//This is a nice improvement over the normal messages you get when the mission starts. It makes a nice
//pop-up box on the right and you can control the colors, size, and text by adjusting the settings in it.
// Feel free to experiment with changes until it suits what you want it to look like.
_hint = parseText format["<t align=center' color='#ff0000' shadow='2' size='1.75'>BEACH HEAD!</t><br/><t  align='center' color='#ffffff'>Legion SEAL teams have landed, watch for water/air support! Use teamwork!</t&gt];
customRemoteMessage = ['hint', _hint];
publicVariable "customRemoteMessage";

//Now the nuts and bolts of running the mission. Mostly you won't need to do anything in here aside
//from what I'll mark.
_missiontimeout = true;
_cleanmission = false;
_playerPresent = false;
_starttime = floor(time);
while {_missiontimeout} do {
    sleep 5;
    _currenttime = floor(time);
    {if((isPlayer _x) AND (_x distance _position <= 150)) then {_playerPresent = true};}forEach playableUnits;
    if (_currenttime - _starttime >= wai_mission_timeout) then {_cleanmission = true;};
    if ((_playerPresent) OR (_cleanmission)) then {_missiontimeout = false;};
};
if (_playerPresent) then {
    [_veh,[_vehdir,_objPosition],_vehclass,true,"0"] call custom_publish;
    waitUntil
    {
        sleep 5;
        _playerPresent = false;
        //The next line is the only thing in this part you might need to edit. Do you see "(_x distance _position <= 30)"?
        //That's the distance to your position declaration above that the player has to be in order to trigger the mission
        //as being completed. If you are using a vehicle as the goal you might make this a bit smaller, but if you use a very
        //large vehicle like a C130 you might test it to ensure you can get close enough to the _position to trigger it. In this
        //case the distance is set to 30 units. I've used as low as 8 and as large as 40 depending on the situation.
        {if((isPlayer _x) AND (_x distance _position <= 30)) then {_playerPresent = true};}forEach playableUnits;
        (_playerPresent)
    };
    
    //Logging that the mission was ended
    diag_log format["WAI: Mission Beachhead Ended At %1",_position];
    
    //This is a pop up box telling the players that the mission ended successfully. It's changed to the color green
    //to reinforce that.
    _hint = parseText format["<t align=center' color='#00FF11' shadow='2' size='1.75'>SUCCESS!</t><br/><t  align='center' color='#ffffff'>Survivors have secured the beach!</t&gt];
    customRemoteMessage = ['hint', _hint];
    publicVariable "customRemoteMessage";
} else {
    // This section is the mission clean up. It's where the various spawned actors are removed after they
    //are no longer needed.
    clean_running_mission = True;
    deleteVehicle _veh;
    {_cleanunits = _x getVariable "missionclean";
    if (!isNil "_cleanunits") then {
        switch (_cleanunits) do {
            case "ground" : {ai_ground_units = (ai_ground_units -1);};
            case "air" : {ai_air_units = (ai_air_units -1);};
            case "vehicle" : {ai_vehicle_units = (ai_vehicle_units -1);};
            case "static" : {ai_emplacement_units = (ai_emplacement_units -1);};
        };
        deleteVehicle _x;
        sleep 0.05;
    };    
    } forEach allUnits;
    
    //Log line that mission ended without being completed.
    diag_log format["WAI: Mission beachhead Timed Out At %1",_position];
    
    //The other pop up you get if the mission was a failure (uncompleted). It renders in red to reinforce this.
    _hint = parseText format["<t align=center' color='#ff1133' shadow='2' size='1.75'>FAILED</t><br/><t  align='center' color='#ffffff'>Survivors did not secure the beach in time!</t&gt];
    customRemoteMessage = ['hint', _hint];
    publicVariable "customRemoteMessage";
};
//This line lets the server know it's ok to spawn the next mission when its time.
missionrunning = false;

//Thanks for reading this far. I hope it helps you design your own custom stuff :)

 

I'll follow up with a zip file of my missions folder as soon as I write a short explanation Readme for what each one is and does.

Link to comment
Share on other sites

I'm posting the zip of my missions folder for everyone to use and edit as they see fit. First a few explanations though. These missions are heavily coded to work on Napf ONLY and will NOT work on other maps. If you run Napf though, feel free to add whatever you like of them to your server.

 

Secondly my servers are set up with the soldiers all belonging to the faction "Legion". As such, the text in the mission pop ups reflect that. You might edit that so it reads more generic depending on what your server is set up like. For instance you will see things like "Legion has stormed Freidorf". It won't make sense to your guys so you might change it to "Soldiers have stormed Freidorf" or somesuch. You are free to edit as you want.

 

Following is a breakdown of the missions and what is special about them:

disabled_civchopper <--same as original

weapon_cache   <--same as original

crash_spawner   <--same as original
armed_vehicle  <--same as original
disabled_milchopper  <--same as original
MV22  <--same as original
convoy  <--same as original

banditbase  <--same as original
campharry   <--same as original

 

The following are all town spawn missions. They generally spawn in the town center, have several machine guns, and multiple troops
Lezburg
Schangen
Chatzbach
Liestal
Freidorf
Meggen
Sachseln

 

BridgeNowhere- Really tough take-the-bridge mission that spawns several waves of reinforcements.

OfficeSpace- Soldiers spread around, inside, and on top of an office building. Toughie.

UFO- If your players are careful they can recover a working "UFO". Neat to see new players when they try to work out what the UFO is and does.
SniperTeam- 4 man team of maximum level snipers armed with AS50's overlooking the dam (This mission requires some edits to your AIConfig file, email me if you want to use it and I'll explain what to change. It's simple stuff)
DeathValley- You think it will be an easy mission, the soldiers are all in a bowl valley. So you think. Machine guns, patrol heli, paratroopers. Another toughie.
BeachHead- Legion beach incursion with boat patrols and air support

NapfCastle- Soldiers set up in the Napf ruins

Sumrenfield- Soldier group in the dish array


 

Linky: https://www.dropbox.com/s/i5s3hghez8yg4t7/missions.zip

 

Have fun guys, I hope you enjoy these :)

Link to comment
Share on other sites

Mission placement is a HUGE variable and it's one that I spend a lot of time on. I spectate my guys doing the missions and make corrections if they find 'cheat' ways of doing things or if I need to tweak them in some fashion.

 

Because most of my custom missions rely on some structure or natural formation they are hard-coded to use the Napf map. Once you understand the way position is implemented into the script it wouldn't be much trouble to find places on your map where you can use these.

 

Since I used BeachHead as the example above I'll show you all you need to change in it to make it work in any map:

 

private ["_playerPresent","_cleanmission","_currenttime","_starttime","_missiontimeout","_vehname","_veh","_position","_vehclass","_vehdir","_objPosition"];

_vehclass = "UH1H_DZE";
_vehname    = getText (configFile >> "CfgVehicles" >> _vehclass >> "displayName");
_position = [3765.69, 14348.5, 0];
diag_log format["WAI: Mission Beachhead Started At %1",_position];

_veh = createVehicle [_vehclass,_position, [], 0, "CAN_COLLIDE"];
_vehdir = round(random 360);
_veh setDir _vehdir;
clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
_veh setVariable ["ObjectID","1",true];
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_veh];
diag_log format["WAI: Mission Beachhead spawned a %1",_vehname];

_objPosition = getPosATL _veh;

_rndnum = round (random 3) + 3;
[[_position select 0, _position select 1, 0],                  //position
_rndnum,                  //Number Of units
1,                          //Skill level 0-1. Has no effect if using custom skills
"Random",                  //Primary gun set number. "Random" for random weapon set.
4,                          //Number of magazines
"",                          //Backpack "" for random or classname here.
"CZ_Special_Forces_GL_DES_EP1_DZ",                          //Skin "" for random or classname here.
"Random",                  //Gearset number. "Random" for random gear set.
true
] call spawn_group;

[[_position select 0, _position select 1, 0],                  //position
4,                          //Number Of units
1,                          //Skill level 0-1. Has no effect if using custom skills
"Random",                  //Primary gun set number. "Random" for random weapon set.
4,                          //Number of magazines
"",                          //Backpack "" for random or classname here.
"CZ_Special_Forces_GL_DES_EP1_DZ",                          //Skin "" for random or classname here.
"Random",                  //Gearset number. "Random" for random gear set.
true
] call spawn_group;

[[[_position select 0, (_position select 1) + 10, 0],[(_position select 0) + 10, _position select 1, 0]], //position(s) (can be multiple).
"M2StaticMG",             //Classname of turret
0.5,                      //Skill level 0-1. Has no effect if using custom skills
"CZ_Special_Forces_GL_DES_EP1_DZ",              //Skin "" for random or classname here.
0,                          //Primary gun set number. "Random" for random weapon set. (not needed if ai_static_useweapon = False)
2,                          //Number of magazines. (not needed if ai_static_useweapon = False)
"",                          //Backpack "" for random or classname here. (not needed if ai_static_useweapon = False)
"Random",                  //Gearset number. "Random" for random gear set. (not needed if ai_static_useweapon = False)
true
] call spawn_static;

[[3689.31, 14345.4, 0],   //Position to patrol
[3689.31, 14345.4, 0],    // Position to spawn at
30,                    //Radius of patrol
3,                     //Number of waypoints to give
"RHIB",        //Classname of vehicle (make sure it has driver and gunner)
1                        //Skill level of units
] spawn vehicle_patrol;

[[3696.84, 14379.3, 0],   //Position to patrol
[3696.84, 14379.3, 0],    // Position to spawn at
200,                    //Radius of patrol
10,                     //Number of waypoints to give
"RHIB",        //Classname of vehicle (make sure it has driver and gunner)
1                        //Skill level of units
] spawn vehicle_patrol;

[[3765.69, 14348.5, 0],  //Position that units will be dropped by
[0,0,0],                           //Starting position of the heli
400,                               //Radius from drop position a player has to be to spawn chopper
"UH1H_DZ",                         //Classname of chopper (Make sure it has 2 gunner seats!)
7,                                 //Number of units to be para dropped
1,                                 //Skill level 0-1 or skill array number if using custom skills "Random" for random Skill array.
"Random",                          //Primary gun set number. "Random" for random weapon set.
4,                                 //Number of magazines
"",                                //Backpack "" for random or classname here.
"CZ_Special_Forces_GL_DES_EP1_DZ",                      //Skin "" for random or classname here.
"Random",                          //Gearset number. "Random" for random gear set.
False                               //True: Heli will stay at position and fight. False: Heli will leave if not under fire.
] spawn heli_para;

[_position,"Beach Head"] execVM "\z\addons\dayz_server\WAI\missions\compile\markers.sqf";
_hint = parseText format["<t align=center' color='#ff0000' shadow='2' size='1.75'>BEACH HEAD!</t><br/><t  align='center' color='#ffffff'>Legion SEAL teams have landed, watch for water/air support! Use teamwork!</t&gt];
customRemoteMessage = ['hint', _hint];
publicVariable "customRemoteMessage";

_missiontimeout = true;
_cleanmission = false;
_playerPresent = false;
_starttime = floor(time);
while {_missiontimeout} do {
    sleep 5;
    _currenttime = floor(time);
    {if((isPlayer _x) AND (_x distance _position <= 150)) then {_playerPresent = true};}forEach playableUnits;
    if (_currenttime - _starttime >= wai_mission_timeout) then {_cleanmission = true;};
    if ((_playerPresent) OR (_cleanmission)) then {_missiontimeout = false;};
};
if (_playerPresent) then {
    [_veh,[_vehdir,_objPosition],_vehclass,true,"0"] call custom_publish;
    waitUntil
    {
        sleep 5;
        _playerPresent = false;
        {if((isPlayer _x) AND (_x distance _position <= 30)) then {_playerPresent = true};}forEach playableUnits;
        (_playerPresent)
    };
    diag_log format["WAI: Mission Beachhead Ended At %1",_position];
    _hint = parseText format["<t align=center' color='#00FF11' shadow='2' size='1.75'>SUCCESS!</t><br/><t  align='center' color='#ffffff'>Survivors have secured the beach!</t&gt];
    customRemoteMessage = ['hint', _hint];
    publicVariable "customRemoteMessage";
} else {
    clean_running_mission = True;
    deleteVehicle _veh;
    {_cleanunits = _x getVariable "missionclean";
    if (!isNil "_cleanunits") then {
        switch (_cleanunits) do {
            case "ground" : {ai_ground_units = (ai_ground_units -1);};
            case "air" : {ai_air_units = (ai_air_units -1);};
            case "vehicle" : {ai_vehicle_units = (ai_vehicle_units -1);};
            case "static" : {ai_emplacement_units = (ai_emplacement_units -1);};
        };
        deleteVehicle _x;
        sleep 0.05;
    };    
    } forEach allUnits;
    
    diag_log format["WAI: Mission beachhead Timed Out At %1",_position];
    _hint = parseText format["<t align=center' color='#ff1133' shadow='2' size='1.75'>FAILED</t><br/><t  align='center' color='#ffffff'>Survivors did not secure the beach in time!</t&gt];
    customRemoteMessage = ['hint', _hint];
    publicVariable "customRemoteMessage";
};
missionrunning = false;

If you are running say Cherno you'd just find a decent shoreline that's a bit open and mark your beach map position. Once you have that (making sure you have enough room for the troops, gunner, and chopper to render on the shore) then you swim out just a little bit in the water and grab two close-by positions for the boat patrols. After that you decide where to place your paratroopers to drop in, remembering that their role is to 'cut off' the retreat of the players and add that position to the sqf.

That's it, you can now use it on any map. You can do that with any of my missions and if anyone wants to I'll go in TS and explain to them the flow of each mission so they can decide where to use it on their server map. Just be sure to share guys if you find a good spot on another map. We are all in this together ;)

Link to comment
Share on other sites

Yeah they do. Which is a good thing because they are REALLY tough. I had several patrol boats spawn around Napf when I worked out how to create them properly and ended up removing them. They were taking down the player's choppers left and right.

Link to comment
Share on other sites

Hmm..that's weird because my land patrols aren't despawning on timeout.

 

[[(_position select 0) + 15,(_position select 1) + 15,0],   //Position to patrol
[(_position select 0) + 1,(_position select 1) + 1,0], // Position to spawn at
200, //Radius of patrol
10,                     //Number of waypoints to give
"UAZ_MG_TK_EP1", //Classname of vehicle (make sure it has driver and gunner)
0.5 //Skill level of units 
] spawn vehicle_patrol;
Link to comment
Share on other sites

I would like to be able to contact you outside of the forum, whether it be teamspeak/skype or whatever, hit me up. I'm fairly new to this kinda of scripting and im on a completely different map but I LOVE WAI!! I have had a chopper spawn in on us while doing a mission though, which is weird because I'm not running Cherno/Napf I'm running Sauerland lol, it scared the fuck outta us.

Link to comment
Share on other sites

I have a teamspeak here legion.teamspeakserverhost.com:21929  You, or anyone else, is always welcome to pop by and say hello. My play name is Kelly there (my real name). I've stated this before (just so you know) I had all my teeth removed late last week so my pronunciation is a bit slurry but I enjoy very much talking shop about coding and the like.

 

@Fr1nk: if they are hanging around after the mission ends then directly destroy them along with the other generated actors in the loop near the end of the missions. I'd think it wouldn't be a huge problem if they remained though? I get it though if you just want to make it do exactly what you want it to do. I respect that. Anyway can you code those checks in or do you want me to help you with it?

Link to comment
Share on other sites

I have a teamspeak here legion.teamspeakserverhost.com:21929  You, or anyone else, is always welcome to pop by and say hello. My play name is Kelly there (my real name). I've stated this before (just so you know) I had all my teeth removed late last week so my pronunciation is a bit slurry but I enjoy very much talking shop about coding and the like.

 

@Fr1nk: if they are hanging around after the mission ends then directly destroy them along with the other generated actors in the loop near the end of the missions. I'd think it wouldn't be a huge problem if they remained though? I get it though if you just want to make it do exactly what you want it to do. I respect that. Anyway can you code those checks in or do you want me to help you with it?

 

Hey thanks for the feedback. Personally, I don't mind them hanging around. I think it adds a nice random element to gameplay, but some of my players were asking if they could be cleared. Let me take a closer look and make sure I didn't change anything while tinkering...will get back to you.  :)

Link to comment
Share on other sites

  • 2 weeks later...

Following is a heavily commented mission I pulled from my custom stuff. It should go a long way to help server admins create their own missions. It's really not that hard if you can follow some basic ideas of map location and logic flow.

 

// This is meant as an example script and should not be used in your mission folder.

//It's main use it to explain all the different sections and what to change depending on

//what you want to do. If you have further questions please don't hesitate to drop me a

//line. My email is [email protected]

//This mission is meant to be used on the Napf map and so will not work right on any other.

//Let's begin, shall we?

// This is the variable declaration section. These are the vars used in the following code. You MUST

//declare your variables here for them to replicate properly from server to client. Mostly you won't

//need to edit anything in this.

private ["_playerPresent","_cleanmission","_currenttime","_starttime","_missiontimeout","_vehname","_veh","_position","_vehclass","_vehdir","_objPosition"];

// This sets the class name used for the _vehclass variable.

_vehclass = "UH1H_DZE";

// Here the vehname is declared depending on what you set the vehclass above as

// This will be used later on in the code to set the proper name of the vehicle to

//the map flag everyone sees

_vehname    = getText (configFile >> "CfgVehicles" >> _vehclass >> "displayName");

// This declares the center point for the mission. Very important as most missions end when

//a player gets within X meters of the objective (which is THIS position, not the crate or vehicle).

_position = [3765.69, 14348.5, 0];

// Adds a log line to the server rpt letting you know what's currently running

diag_log format["WAI: Mission Beachhead Started At %1",_position];

// The vehicle declared above is being created and placed in this section

_veh = createVehicle [_vehclass,_position, [], 0, "CAN_COLLIDE"];

// Which way to point the vehicle? In this case it will be random

_vehdir = round(random 360);

//Set the vehicle pointing the generated way

_veh setDir _vehdir;

//These two lines are housekeeping for proper vehicle creation

clearWeaponCargoGlobal _veh;

clearMagazineCargoGlobal _veh;

_veh setVariable ["ObjectID","1",true];

PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_veh];

// Log line letting the rpt know the server spawned a 'vehname' declared above

diag_log format["WAI: Mission Beachhead spawned a %1",_vehname];

// Declaration of the created vehicles position

_objPosition = getPosATL _veh;

// Here we get into the actor generation. I'll explain each line

// Creates a random number from 0 to 3, then adds 3 to that number. You end up with a number

//from 3 to 6.

_rndnum = round (random 3) + 3;

// Remember when we declared the _position above? Well here it's used to set the actors down.

// Really this is easiest to think of as simple X,Y,Z coordinates. "Select 0" means the X,

//"Select 1" is the Y, and 0 is the Z or height. Above we said "_position = [3765.69, 14348.5, 0]"

//so you can plug those values in here mentally and see that it reads "3765.69" as the first value, etc.

[[_position select 0, _position select 1, 0],                  //position

// Remember the random number generated above? Here it's plugged in to create the number of actors

_rndnum,                  //Number Of units

1,                          //Skill level 0-1. Has no effect if using custom skills

"Random",                  //Primary gun set number. "Random" for random weapon set.

4,                          //Number of magazines

"",                          //Backpack "" for random or classname here.

"CZ_Special_Forces_GL_DES_EP1_DZ",                          //Skin "" for random or classname here.

"Random",                  //Gearset number. "Random" for random gear set.

true

] call spawn_group;

//This group is handled just like above.

[[_position select 0, _position select 1, 0],                  //position

4,                          //Number Of units

1,                          //Skill level 0-1. Has no effect if using custom skills

"Random",                  //Primary gun set number. "Random" for random weapon set.

4,                          //Number of magazines

"",                          //Backpack "" for random or classname here.

"CZ_Special_Forces_GL_DES_EP1_DZ",                          //Skin "" for random or classname here.

"Random",                  //Gearset number. "Random" for random gear set.

true

] call spawn_group;

// OK, now we have a wrinkle in the position statement but actually it's easy to understand. It adds a small offset to the

//position so you can spawn something close by without crushing or colliding with your previous spawned actors.

//There are two spawns in this line so don't get confused. The first one is "[_position select 0, (_position select 1) + 10, 0]"

//See the "(_position select 1) + 10" part? What that does is add a 10 unit offset to the Y variable meaning the M2 gun will render

//10 map units more to the Y direction than the _position declaration above. Ingame this means that the static gunners will appear now

//close to but not right on the clan of soldiers created above. That way everyone comes in safe and sound, grouped nicely and ready for combat.

[[[_position select 0, (_position select 1) + 10, 0],[(_position select 0) + 10, _position select 1, 0]], //position(s) (can be multiple).

"M2StaticMG",             //Classname of turret

0.5,                      //Skill level 0-1. Has no effect if using custom skills

"CZ_Special_Forces_GL_DES_EP1_DZ",              //Skin "" for random or classname here.

0,                          //Primary gun set number. "Random" for random weapon set. (not needed if ai_static_useweapon = False)

2,                          //Number of magazines. (not needed if ai_static_useweapon = False)

"",                          //Backpack "" for random or classname here. (not needed if ai_static_useweapon = False)

"Random",                  //Gearset number. "Random" for random gear set. (not needed if ai_static_useweapon = False)

true

] call spawn_static;

//This is a spawned patrol boat for this mission. It's armed and deadly. Since I need it to come in on the water

//I found a spot out in the water close to the beach and I used that position here instead of the way above. Either

//way is acceptable, it's just that the way above offers more flexibility in most cases.

//This is the center point of the patrol area

[[3689.31, 14345.4, 0],   //Position to patrol

//This is where the boat is created. This doesn't have to be the same spot, you can have the boat render into

//the game at another location and it will proceed immediately to the patrol area just above. Remember though, the

//AI are pretty dumb, don't expect them to navigate around an island or through a bridge support. Best to keep them

//close.

[3689.31, 14345.4, 0],    // Position to spawn at

//I kept this small so they could guard the beach completely

30,                    //Radius of patrol

3,                     //Number of waypoints to give

"RHIB",        //Classname of vehicle (make sure it has driver and gunner)

1                        //Skill level of units

] spawn vehicle_patrol;

//Second boat unit, just like above

[[3696.84, 14379.3, 0],   //Position to patrol

[3696.84, 14379.3, 0],    // Position to spawn at

200,                    //Radius of patrol

10,                     //Number of waypoints to give

"RHIB",        //Classname of vehicle (make sure it has driver and gunner)

1                        //Skill level of units

] spawn vehicle_patrol;

//Here I added paratroopers to cut off the retreat of players. By declaring a small trigger area I ensured

//the players would be committed to the mission before the troopers dropped in. The players come well into the

//mission before realizing there are paratroopers coming down on their rear :)  Don't overdo this though, it can

//get quite hard quite fast on players. To be honest this mission is pretty overdone but my guys wanted a squad

//level challenge

[[3765.69, 14348.5, 0],  //Position that units will be dropped by

[0,0,0],                           //Starting position of the heli

400,                               //Radius from drop position a player has to be to spawn chopper

"UH1H_DZ",                         //Classname of chopper (Make sure it has 2 gunner seats!)

7,                                 //Number of units to be para dropped

1,                                 //Skill level 0-1 or skill array number if using custom skills "Random" for random Skill array.

"Random",                          //Primary gun set number. "Random" for random weapon set.

4,                                 //Number of magazines

"",                                //Backpack "" for random or classname here.

"CZ_Special_Forces_GL_DES_EP1_DZ",                      //Skin "" for random or classname here.

"Random",                          //Gearset number. "Random" for random gear set.

False                               //True: Heli will stay at position and fight. False: Heli will leave if not under fire.

] spawn heli_para;

// This creates the map marker. It's telling the player to make a marker at "_position" (declared above) and

//call it "Beach Head".

[_position,"Beach Head"] execVM "\z\addons\dayz_server\WAI\missions\compile\markers.sqf";

//This is a nice improvement over the normal messages you get when the mission starts. It makes a nice

//pop-up box on the right and you can control the colors, size, and text by adjusting the settings in it.

// Feel free to experiment with changes until it suits what you want it to look like.

_hint = parseText format["<t align=center' color='#ff0000' shadow='2' size='1.75'>BEACH HEAD!</t><br/><t  align='center' color='#ffffff'>Legion SEAL teams have landed, watch for water/air support! Use teamwork!</t&gt];

customRemoteMessage = ['hint', _hint];

publicVariable "customRemoteMessage";

//Now the nuts and bolts of running the mission. Mostly you won't need to do anything in here aside

//from what I'll mark.

_missiontimeout = true;

_cleanmission = false;

_playerPresent = false;

_starttime = floor(time);

while {_missiontimeout} do {

    sleep 5;

    _currenttime = floor(time);

    {if((isPlayer _x) AND (_x distance _position <= 150)) then {_playerPresent = true};}forEach playableUnits;

    if (_currenttime - _starttime >= wai_mission_timeout) then {_cleanmission = true;};

    if ((_playerPresent) OR (_cleanmission)) then {_missiontimeout = false;};

};

if (_playerPresent) then {

    [_veh,[_vehdir,_objPosition],_vehclass,true,"0"] call custom_publish;

    waitUntil

    {

        sleep 5;

        _playerPresent = false;

        //The next line is the only thing in this part you might need to edit. Do you see "(_x distance _position <= 30)"?

        //That's the distance to your position declaration above that the player has to be in order to trigger the mission

        //as being completed. If you are using a vehicle as the goal you might make this a bit smaller, but if you use a very

        //large vehicle like a C130 you might test it to ensure you can get close enough to the _position to trigger it. In this

        //case the distance is set to 30 units. I've used as low as 8 and as large as 40 depending on the situation.

        {if((isPlayer _x) AND (_x distance _position <= 30)) then {_playerPresent = true};}forEach playableUnits;

        (_playerPresent)

    };

    

    //Logging that the mission was ended

    diag_log format["WAI: Mission Beachhead Ended At %1",_position];

    

    //This is a pop up box telling the players that the mission ended successfully. It's changed to the color green

    //to reinforce that.

    _hint = parseText format["<t align=center' color='#00FF11' shadow='2' size='1.75'>SUCCESS!</t><br/><t  align='center' color='#ffffff'>Survivors have secured the beach!</t&gt];

    customRemoteMessage = ['hint', _hint];

    publicVariable "customRemoteMessage";

} else {

    // This section is the mission clean up. It's where the various spawned actors are removed after they

    //are no longer needed.

    clean_running_mission = True;

    deleteVehicle _veh;

    {_cleanunits = _x getVariable "missionclean";

    if (!isNil "_cleanunits") then {

        switch (_cleanunits) do {

            case "ground" : {ai_ground_units = (ai_ground_units -1);};

            case "air" : {ai_air_units = (ai_air_units -1);};

            case "vehicle" : {ai_vehicle_units = (ai_vehicle_units -1);};

            case "static" : {ai_emplacement_units = (ai_emplacement_units -1);};

        };

        deleteVehicle _x;

        sleep 0.05;

    };    

    } forEach allUnits;

    

    //Log line that mission ended without being completed.

    diag_log format["WAI: Mission beachhead Timed Out At %1",_position];

    

    //The other pop up you get if the mission was a failure (uncompleted). It renders in red to reinforce this.

    _hint = parseText format["<t align=center' color='#ff1133' shadow='2' size='1.75'>FAILED</t><br/><t  align='center' color='#ffffff'>Survivors did not secure the beach in time!</t&gt];

    customRemoteMessage = ['hint', _hint];

    publicVariable "customRemoteMessage";

};

//This line lets the server know it's ok to spawn the next mission when its time.

missionrunning = false;

//Thanks for reading this far. I hope it helps you design your own custom stuff :)

 

I'll follow up with a zip file of my missions folder as soon as I write a short explanation Readme for what each one is and does.

Good stuff! Thank you. :)

Link to comment
Share on other sites

I know it's a little hard to read but it looks WAY better if you install an sqf highlighter for Notepad++ and then copy/paste the whole thing in as temp.sqf. I should have created it as an attachment with the highlighter included.

 

Thanks for that though, It did actually take a while to comment out. I hope it's not so confusing.

Link to comment
Share on other sites

Hi,
i modified them (except of officespace and ruins mission) for Chernarus - but i havent tested it yet.

i also did insert 2 Locations for Beachhead, DeathValley and BrideNowhere (EDIT: hahaha i love this typo i will leave it there - bride nowhere xD) which will be randomly chosen, it should be easy to add more locations but i havent tested a single script! Could be there are some errors in it!
i also converted every coordinates in the mission to relative coordinates so you only have to insert 1 value and the rest will spawn around them!
missions.zip

regards waTTe

PS: I hope you dont mind me modifying them and uploading them here, if so just tell me and i will delete it!

If you wanna know how i did the several location thingy look here:

Bridge and DeathValley:

_positions = [
[13457.729, 6446.8276, 0], //Location 1
[3602.7068, 8517.0723, 0] //Location 2
];
_position = _positions call BIS_fnc_selectRandom;

Beach was tricky cause of the water locations:

_positions = 
[ // First location goes here:
[1314.3391, 2255.241,0], // Position in Water 1
[1302.2274, 2324.2607,0], // Position on Land
[1324.3391, 2265.241,0] // Position in Water 2
],
[ // Second location goes here:
[13428.563, 10763.183, 0], // Position in Water 1
[13375.397, 10806.569,0], // Position on Land
[13438.563, 10773.183,0] // Position in Water 2
]
];
_location = _positions call BIS_fnc_selectRandom;
_positionwater = _location select 0;
_position = _location select 1;
_positionwater1 = _location select 2;
Link to comment
Share on other sites

Hi Can you help me set up one mission on the military island, in the format of this post (comments where i can change gear and crates) as i tried to follow this post and really stuck , even with working out the worldspace. I need the following please:

 

1. I already have WAI working on my server; what i want is to create one single giant mission on the Island (military island north - Napf map)

2. I want it to spawn one per server restart. even better if I can have an option to make this event only happen once a server restart during night only (so use the time function)

3. I want to be able to select what gear the AI have and crates contain.

4. I want alot of AI , chopper called when player enters, want it to be heavy battle.

 

Please contact me if you can help? would very much appreciate it. 

Link to comment
Share on other sites

I'm posting the zip of my missions folder for everyone to use and edit as they see fit. First a few explanations though. These missions are heavily coded to work on Napf ONLY and will NOT work on other maps. If you run Napf though, feel free to add whatever you like of them to your server.

 

Secondly my servers are set up with the soldiers all belonging to the faction "Legion". As such, the text in the mission pop ups reflect that. You might edit that so it reads more generic depending on what your server is set up like. For instance you will see things like "Legion has stormed Freidorf". It won't make sense to your guys so you might change it to "Soldiers have stormed Freidorf" or somesuch. You are free to edit as you want.

 

Following is a breakdown of the missions and what is special about them:

disabled_civchopper <--same as original

weapon_cache   <--same as original

crash_spawner   <--same as original

armed_vehicle  <--same as original

disabled_milchopper  <--same as original

MV22  <--same as original

convoy  <--same as original

banditbase  <--same as original

campharry   <--same as original

 

The following are all town spawn missions. They generally spawn in the town center, have several machine guns, and multiple troops

Lezburg

Schangen

Chatzbach

Liestal

Freidorf

Meggen

Sachseln

 

BridgeNowhere- Really tough take-the-bridge mission that spawns several waves of reinforcements.

OfficeSpace- Soldiers spread around, inside, and on top of an office building. Toughie.

UFO- If your players are careful they can recover a working "UFO". Neat to see new players when they try to work out what the UFO is and does.

SniperTeam- 4 man team of maximum level snipers armed with AS50's overlooking the dam (This mission requires some edits to your AIConfig file, email me if you want to use it and I'll explain what to change. It's simple stuff)

DeathValley- You think it will be an easy mission, the soldiers are all in a bowl valley. So you think. Machine guns, patrol heli, paratroopers. Another toughie.

BeachHead- Legion beach incursion with boat patrols and air support

NapfCastle- Soldiers set up in the Napf ruins

Sumrenfield- Soldier group in the dish array

 

Linky: https://www.dropbox.com/s/i5s3hghez8yg4t7/missions.zip

 

Have fun guys, I hope you enjoy these :)

So I am totally new too all of this. Have my own server now. and really like the NAPF map and want to add your mission files to my server and then change then. but what i dont know is how to call them up when i put them in or if they go in my server_napf.pbo or the one listed under missions? if you can help to add the right scripting to call them up that would be awesome.

Link to comment
Share on other sites

Guys, I want to apologize. Some of you know that I have been fighting through a recovery from a rather nasty battle with throat cancer. Unfortunately I've had to close my servers and drop off from most playing or creating. Don't worry, I didn't get the cancer back (I hope lol) but losing my teeth has just been too much for me and I've been dropping a bunch of weight again. Add to that the new meds they have me on to boost my blood platelet production and the end result is I just have almost no energy above what it takes to stay working and keep my family going.

 

I really enjoyed chatting with all of you, I met some fantastic people and got to see some very well done servers. I'm sorry I won't be much good to you guys any more but I'm going to concentrate on getting better for a while. From time to time I'll drop into Ruben's servers http://www.thelastcrusader.eu/ and play some because he and EPD are just such great guys and they understand my limitations. Marathon sessions just are not in my cards right now sadly, and won't be for the near future.

 

All my work is (as always) free for anyone to use. If you played on my PvE or PvP and want my server/mission PBO's (and even databases if you desire) just contact me and I'll ship them to you. They will work out-of-the-box and it would be my pleasure to give them to someone who will run them.

 

To those of you who messaged me and I didn't respond I do hope you understand. This last year has been a real beast to get through and even though I do greatly enjoy talking shop and teaching people to code and run servers, I'm not in a place in my life where I can spare that energy output it requires.

 

Good luck gentlemen. I hate to leave so much undone but hopefully someone else will pick this up and run with it.

 

-Kelly

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
  • Discord

×
×
  • Create New...