Help with new mission concept

Help with new mission concept

« posted: Apr 06, 2020, 01:22 AM »
Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Name: mission_Sniper.sqf
// @file Author: JoSchaap, AgentRev, LouD
// @file Edit: 27/04/2018 by [509th] Coyote Rogue
// @file Edit: 06/04/2020 by [Raw Gaming] SoulStalker

if (!isServer) exitwith {};
#include "armouredMissionDefines.sqf";

private ["_cash", "_moneyAmount", "_boxes1", "_box1", "_box2","_geoPos","_sniper","_marker1"];

_moneyAmount = 30000; //Reward amount for completing mission

_setupVars =
{
_missionType = "Ghost Sniper";
_locationsArray = SniperMissionMarkers;
};

_setupObjects =
{
_missionPos = markerPos _missionLocation;

_geoPos = _missionPos vectorAdd ([[500 + random 500, 0, 0], random 360] call BIS_fnc_rotateVector2D);

// Sniper
_aiGroup = createGroup CIVILIAN;
_sniper = _aiGroup createUnit ["C_man_polo_1_F", [_geoPos select 0, _geoPos select 1, 0], [], 10, "None"];
    _sniper setPosATL [_geoPos select 0, _geoPos select 1, 0];

_sniper addUniform "U_I_FullGhillie_sard";
_sniper addVest "V_PlateCarrierIA1_dgtl";
_sniper addItem "NVGoggles";
_sniper assignItem "NVGoggles";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";
_sniper addWeapon "srifle_GM6_camo_F"; //srifle_DMR_02_camo_F - 10Rnd_338_Mag - optic_Nightstalker
_sniper addPrimaryWeaponItem "optic_LRPS_ghex_F";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";

// Add some body armor
_sniper setVariable ["selections", []];
_sniper setVariable ["gethit", []];
_sniper addEventHandler
[
"HandleDamage",
{
_unit = _this select 0;
_selections = _unit getVariable ["selections", []];
_gethit = _unit getVariable ["gethit", []];
_selection = _this select 1;
if !(_selection in _selections) then
{
_selections set [count _selections, _selection];
_gethit set [count _gethit, 0];
};
_i = _selections find _selection;
_olddamage = _gethit select _i;
_damage = _olddamage + ((_this select 2) - _olddamage) * 0.20; // The lower the number, the higher the armor
_gethit set [_i, _damage];
_damage;
}
];

_sniper addRating 9999999;
_sniper call setEliteSkill;
_sniper setUnitPos "DOWN";

_sniper = leader _aiGroup;
 
    _aiGroup setCombatMode "RED";
    _aiGroup setBehaviour "COMBAT";

_marker1 = createMarker ["SniperArea", _missionPos];
_marker1 setMarkerShape "ELLIPSE";
_marker1 setMarkerSize [1000,1000];
_marker1 setMarkerBrush "FDiagonal";
_marker1 setMarkerColor "colorOPFOR";

while {alive _sniper} do {
sleep 60; //if (alive _sniper) then {sleep 60;};
_geoPos = _missionPos vectorAdd ([[500 + random 500, 0, 0], random 360] call BIS_fnc_rotateVector2D);
_sniper setPosATL [_geoPos select 0, _geoPos select 1, 0];
["Ghost Sniper Position Changing","hint",true,false,false] call BIS_fnc_MP;
};

_missionPicture = "media\ghost.jpg";
_missionHintText = format ["<br/>A <t color='%1'>Ghost Sniper</t> is targeting players randomly. He seems to be changing position supernaturally and very frequently! <br/>Try and track his position and take him out!", armouredMissionColor];
};

_waitUntilMarkerPos = nil;
_waitUntilExec = nil;
_waitUntilCondition = nil;

_failedExec =
{
// Mission failed
deleteMarker "SniperArea";
};

// Mission completed

_successExec =
{
//Money

deleteMarker "SniperArea";

for "_i" from 1 to 10 do
{
_cash = createVehicle ["Land_Money_F", _lastPos, [], 5, "NONE"];
_cash setPos ([_lastPos, [[2 + random 3,0,0], random 360] call BIS_fnc_rotateVector2D] call BIS_fnc_vectorAdd);
_cash setDir random 360;
_cash setVariable ["cmoney", _moneyAmount, true];
_cash setVariable ["owner", "world", true];
};

//Crates

_boxes1 = selectRandom ["Box_NATO_Wps_F","Box_East_Wps_F","Box_IND_Wps_F", "Box_IND_Ammo_F","Box_IND_AmmoOrd_F","Box_IND_Grenades_F","Box_IND_Support_F","Box_IND_WpsLaunch_F","Box_IND_WpsSpecial_F"];
_box1 = createVehicle [_boxes1, _lastPos, [], 5, "NONE"];
_box1 setDir random 360;
_box1 call randomCrateLoadOut; // Randomly fills box with equipment
_box1 allowDamage false;

_box2 = createVehicle ["Box_NATO_WpsSpecial_F", _lastPos, [], 5, "NONE"];
_box2 setDir random 360;
[_box2, "mission_Main_A3snipers"] call fn_refillbox; // Fills from set list associated with type of box
_box2 allowDamage false;

//Crate Behavior

{ _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1, _box2]; //Allows crates to be picked up and carried

//Message

_successHintMessage = "The Ghost Sniper was located and assasinated. Well Done!";

};

_this call armouredMissionProcessor;


I am trying to create a lone sniper mission, where the sniper randomly spawns in a 1 km radius of the mission position. This works fine

Once spawned he then teleports  every so many minutes until the mission is completed or ends. For testing purposes this is set to 60 seconds. This works fine.

The idea that the sniper is not in a constant position and the players have to scope for him, with the possibility of being sniped.

The problem I am finding is it doesn't show the mission hint text. it is being caught in the while do loop. Which works great but once you kill the sniper then the mission text displays

I have tried various methods of getting this to show. i.e. a boolean variable that skips the while loop until the mission text has been displayed or making it a function and calling it that way but the mission then doesn't end.

Is there an easier way of creating this timed teleport of the sniper throughout the duration of the mission.

Would this be possible with getting the start time of the mission and looking to see if the start time + the interval time has been met and then carry out the code??

Thanks
  • Offline [IT42O] MjDoc
  • Mans joint Documentation Arma3 develop
  • Fresh Spawn
  • *
  • Posts: 5
  • I wish everyone peace, health and love!

Re: Help with new mission concept

« Reply #1 posted: Apr 07, 2020, 02:26 PM »
hmm, "lone sniper" ?, sounds great ! :), it will be nice to see a working result, please, if it’s not difficult for you, share the result when you succeed ;)
dev [BRO'F] server

Re: Help with new mission concept

« Reply #2 posted: Apr 08, 2020, 07:03 PM »
hmm, "lone sniper" ?, sounds great ! :), it will be nice to see a working result, please, if it’s not difficult for you, share the result when you succeed ;)

Hey MjDoc

I decided to change it just to get it to work for now. I changed it to spawn 3 randomly placed snipers, all in different  locations, within a 1 km radius of the mission marker. Their locations are not marked on the map. Players have to scope them out and eliminate them one by one to finish the mission.

Here is the code. You are Welcome to any of the code within the PBO. We have over 102 missions on our server. A lot of them very different from what you normally find on servers.

Best thing to do is drop on to our server and see what you like. Just search for RAW usa

I can make the PBO available to you on our teamspeak for download but our PBO is all iintegrated with stuff to support the mods we use. But it doesn't stop you from using some of the missions. Some missions again are reliant on other files within the PBO but you can work that out while sifting through it.

Cheers - Teamspeak : rawus.teamspeak3.com

Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Name: mission_Sniper.sqf
// @file Author: JoSchaap, AgentRev, LouD
// @file Edit: 27/04/2018 by [509th] Coyote Rogue
// @file Edit: 06/04/2020 by [Raw Gaming] SoulStalker

if (!isServer) exitwith {};
#include "premiumMissionDefines.sqf";

private ["_boxes1", "_box1", "_box2", "_box3","_geoPos","_sniper","_marker1","_sniper1","_sniper2","_currBox1","_currBox2","_currBox3","_smokemarker"];

_setupVars =
{
_missionType = "Ghost Sniper";
_locationsArray = SniperMissionMarkers;
};

_setupObjects =
{

_missionPos = markerPos _missionLocation;

_geoPos = _missionPos vectorAdd ([[500 + random 500, 0, 0], random 360] call BIS_fnc_rotateVector2D);

// Sniper One
_aiGroup = createGroup CIVILIAN;
    _sniper = [_aiGroup, _missionPos] call createRandomSoldier;
    _sniper setPosATL [_geoPos select 0, _geoPos select 1, 0];

_sniper addUniform "U_I_FullGhillie_sard";
_sniper addVest "V_PlateCarrierIA1_dgtl";
_sniper addItem "NVGoggles";
_sniper assignItem "NVGoggles";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";
_sniper addWeapon "srifle_GM6_camo_F";
_sniper addPrimaryWeaponItem "optic_LRPS_ghex_F";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";
_sniper addMagazine "5Rnd_127x108_APDS_Mag";

_sniper addRating 9999999;
_sniper setUnitPos "DOWN";
_sniper = leader _aiGroup;

_geoPos = _missionPos vectorAdd ([[500 + random 500, 0, 0], random 360] call BIS_fnc_rotateVector2D);
// Sniper Two
_aiGroup = createGroup CIVILIAN;
    _sniper1 = [_aiGroup, _missionPos] call createRandomSoldier;
    _sniper1 setPosATL [_geoPos select 0, _geoPos select 1, 0];

_sniper1 addUniform "U_I_FullGhillie_sard";
_sniper1 addVest "V_PlateCarrierIA1_dgtl";
_sniper1 addItem "NVGoggles";
_sniper1 assignItem "NVGoggles";
_sniper1 addMagazine "5Rnd_127x108_APDS_Mag";
_sniper1 addWeapon "srifle_GM6_camo_F";
_sniper1 addPrimaryWeaponItem "optic_LRPS_ghex_F";
_sniper1 addMagazine "5Rnd_127x108_APDS_Mag";
_sniper1 addMagazine "5Rnd_127x108_APDS_Mag";
_sniper1 addMagazine "5Rnd_127x108_APDS_Mag";
_sniper1 addMagazine "5Rnd_127x108_APDS_Mag";

_sniper1 addRating 9999999;
_sniper1 setUnitPos "DOWN";

_geoPos = _missionPos vectorAdd ([[500 + random 500, 0, 0], random 360] call BIS_fnc_rotateVector2D);
// Sniper Third
_aiGroup = createGroup CIVILIAN;
    _sniper2 = [_aiGroup, _missionPos] call createRandomSoldier;
    _sniper2 setPosATL [_geoPos select 0, _geoPos select 1, 0];

_sniper2 addUniform "U_I_FullGhillie_sard";
_sniper2 addVest "V_PlateCarrierIA1_dgtl";
_sniper2 addItem "NVGoggles";
_sniper2 assignItem "NVGoggles";
_sniper2 addMagazine "5Rnd_127x108_APDS_Mag";
_sniper2 addWeapon "srifle_GM6_camo_F";
_sniper2 addPrimaryWeaponItem "optic_LRPS_ghex_F";
_sniper2 addMagazine "5Rnd_127x108_APDS_Mag";
_sniper2 addMagazine "5Rnd_127x108_APDS_Mag";
_sniper2 addMagazine "5Rnd_127x108_APDS_Mag";
_sniper2 addMagazine "5Rnd_127x108_APDS_Mag";

_sniper2 addRating 9999999;
_sniper2 setUnitPos "DOWN";

[_sniper,_sniper1,_sniper2] joinSilent _aiGroup;


    _aiGroup setCombatMode "RED";
    _aiGroup setBehaviour "COMBAT";
 
_marker1 = createMarker ["SniperArea", _missionPos];
_marker1 setMarkerShape "ELLIPSE";
_marker1 setMarkerSize [1000,1000];
_marker1 setMarkerBrush "FDiagonal";
_marker1 setMarkerColor "colorOPFOR";

_missionPicture = "media\ghost.jpg";
_missionHintText = format ["<br/>Three <t color='%1'>Ghost Snipers</t> are targeting players randomly. They seem to be changing position supernaturally and very frequently! <br/>Try and track their positions and take him out!", premiumMissionColor];
};

_waitUntilMarkerPos = nil;
_waitUntilExec = nil;
_waitUntilCondition = nil;

_failedExec =
{
// Mission failed
deleteMarker "SniperArea";
};

_successExec =
{
// Mission completed

deleteMarker "SniperArea";

// Mission completed

_Boxes1 = ["Box_IND_Wps_F","Box_East_Wps_F","Box_NATO_Wps_F","Box_NATO_AmmoOrd_F","Box_NATO_Grenades_F","Box_East_WpsLaunch_F","Box_NATO_WpsLaunch_F","Box_East_WpsSpecial_F","Box_NATO_WpsSpecial_F"];   
_currBox1 = _Boxes1 call BIS_fnc_selectRandom;
_box1 = createVehicle [_currBox1, _lastPos, [], 2, "None"];
_box1 setDir random 360;
_box1 setVariable ["cmoney", 1000000, true];
_box1 allowDamage false;

_currBox2 = _Boxes1 call BIS_fnc_selectRandom;
_box2 = createVehicle [_currBox2, _lastPos, [], 2, "None"];
_box2 setDir random 360;
_box2 setVariable ["cmoney", 1000000, true];
_box2 allowDamage false;

_currBox3 = _Boxes1 call BIS_fnc_selectRandom;
_box3 = createVehicle [_currBox2, _lastPos, [], 2, "None"];
_box3 setDir random 360;
_box3 setVariable ["cmoney", 1000000, true];
_box3 allowDamage false;

{ _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1, _box2, _box3];

//Smoke to mark the crates
_smokemarker = createMarker ["SMMarker1", _lastPos];
[_smokemarker] spawn CrateSmoke; //Calls repeating green smoke grenade
uiSleep 2;
deleteMarker "SMMarker1";

_successHintMessage = "The Ghost Snipers were successfully located and assasinated. Job Really Well Done! Now collect $1 million dollars for each Sniper Dispatched.";
};

_this call premiumMissionProcessor;