Jump to content
greywolf907

Random tasks\objectives

Recommended Posts

 

Try this line instead of the above safepos line:

_rndpos = [_AOmarker, 50, 2000,[],0] call BIS_fnc_findSafePos;// I guess the gradient thing interferes with Air units

If that doest work, try this:

_rndpos = [_AOmarker, 50, 2000] call BIS_fnc_findSafePos;// this will also consider any water bodies in the radius, but who cares  // its a flying heli :)

Thanks. I will try as soon as I get in the door. Can you see or think of any reason why it wont spawn more than 1 air unit. I tried upping the count for air units but it seems to ignore it.

Share this post


Link to post
Share on other sites

Thanks. I will try as soon as I get in the door. Can you see or think of any reason why it wont spawn more than 1 air unit. I tried upping the count for air units but it seems to ignore it.

you see that "9" in the original findsafepos line I sent you post# 146 above?

It relates to the min distance from nearest map object to avoid collision. This was more suitable in case of land vehicles.

 

Your error report had gradient issues written all over it. Gradient figures the height/level of ground if I am right..

https://community.bistudio.com/wiki/BIS_fnc_findSafePos

 

So I am assuming for a heli it should'nt matter as its flying. Hence the errors?

 

Use  these new lines I sent you in the last post. Try them one at a time. :)

  • Like 1

Share this post


Link to post
Share on other sites

I think all the errors might actually be for infantry also as there are ALOT of them. it just repeated over and over so only posted the last one which I assumed is to do with the air. I will suss out more when I get home. Thanks for all your help ArmaMan

  • Like 1

Share this post


Link to post
Share on other sites

I think all the errors might actually be for infantry also as there are ALOT of them. it just repeated over and over so only posted the last one which I assumed is to do with the air. I will suss out more when I get home. Thanks for all your help ArmaMan

No problem mate. Let me know if u still get errors. Then just send me your mission.pbo. ;)

 

But if the errors arent showing for infantry, dont assume that there is a problem. They might just be fine patrolling in the wild :)

Share this post


Link to post
Share on other sites

No problem mate. Let me know if u still get errors. Then just send me your mission.pbo. ;)

 

But if the errors arent showing for infantry, dont assume that there is a problem. They might just be fine patrolling in the wild :)

 

You were right. ALL the errors were to do with just the Air Units. Everything working fine now. Thanks very very much for all the help...  :)

 

Oh also thought I would update you, weird thing if I used the first line you said to try the whole mission fails to load..Really bizarre..

  • Like 1

Share this post


Link to post
Share on other sites

You were right. ALL the errors were to do with just the Air Units. Everything working fine now. Thanks very very much for all the help...  :)

 

Oh also thought I would update you, weird thing if I used the first line you said to try the whole mission fails to load..Really bizarre..

lol I kind of knew something MIGHT occur with that line.

_rndpos = [_AOmarker, 50, 2000,[],0] call BIS_fnc_findSafePos;

Actually that [] bracket was supposed to ignore any gradient entry. But thats not how it works I guess :P

SHK_Pos is always a better option IMHO. There is an option to specifically choose road spots too.

 

Give it a try when you want to ;)

 

Happy to see you got it working :)

  • Like 1

Share this post


Link to post
Share on other sites
On 1/28/2015 at 10:09 AM, Persian MO said:

Here is my way to create a mission like this.Not the best but at-least working.

- In game editor, put Gamelogic location anywhere you want to have AO area and name them: city1, city2, ...

perhaps over on towns

now,you need some scripts.

- SHK_pos for find random position

- SHK_Taskmaster for task hint

- Shock's Building Garrison Function for fill houses at AO

***Example for 5 side missions***

init.sqf

 


if ((!isServer) && (player != player)) then {waitUntil {player == player};}; // Player sync

// disable radio and saving
enablesaving [false, false];
enableSentences false;

// use this code to control side missions call, later remove called mission from missions list
if (isNil "side1") then { side1 = true;};
if (isNil "side2") then { side2 = true;};
if (isNil "side3") then { side3 = true;};
if (isNil "side4") then { side4 = true;};
if (isNil "side5") then { side5 = true;};

// call taskmaster and find position functions
call compile preprocessfilelinenumbers "shk_pos\shk_pos_init.sqf";
call compile preprocessfile "shk_taskmaster.sqf";

// call side finer to select a mission and execute it
if (isserver) then { null=[]execVM "side_finder.sqf"; };

 

 

Description.ext

 


onLoadIntroTime=false;
onLoadMissionTime=false;
disabledAI=1;
debriefing=1;

RESPAWN = 3;
respawnDelay = 30;
respawnTemplates[] = {"Counter"};

joinUnassigned = 0;
enableDebugConsole = 0;
allowFunctionsLog = 0;

showGPS = 1;
showCompass = 1;
showMap = 1;
showPad = 1;
showWatch = 1;



class CfgFunctions
{
   #include "SBGF\cfgfunctions.hpp"  

};



class Header
{
gameType = coop;
minPlayers = 1;
maxPlayers = 30;
};
 

 

side_finer.sqf

 


if (!isServer) exitWith {}; // Server only

// create missions list array 
_allMissions = [];

// check if the mission hasn't executed yet, so add it to missions list array...
if ((side1)) then {
_allMissions pushBack 1;  
};
if ((side2)) then {
_allMissions pushBack 2;  
};
if ((side3)) then {
_allMissions pushBack 3;  
};
if ((side4)) then {
_allMissions pushBack 4;  
};
if ((side5)) then {
_allMissions pushBack 5;  
};

// find random a mission from missions list array
_mission = (_allMissions call BIS_fnc_selectRandom); 

// execute the selected mission...
if (_mission == 1) then { [] execVM "sidemissions\side1.sqf"; };
if (_mission == 2) then { [] execVM "sidemissions\side2.sqf"; };
if (_mission == 3) then { [] execVM "sidemissions\side3.sqf"; };
if (_mission == 4) then { [] execVM "sidemissions\side4.sqf"; };
if (_mission == 5) then { [] execVM "sidemissions\side5.sqf"; };
 

 

- Create a folder and name it: sidemissions

create side missions inside this folder and name it like: side1, side2, side3, side 4, side5, ...

Example a side mission:

side1.sqf

 


//if (!isServer) exitWith {}; // Server only

// set false the side1 so side finder will not execute this mission again
side1 = false;

sleep 200;

// find center of AO...looking for gamelogic location which created before in editor
_sidepos = [city1, city2, city3, city4, city5, city6, city7, city8, city9, city10] call BIS_fnc_selectRandom;

// add marker on AO/target
_marker = createMarker ["side_area", _sidepos];
_marker setMarkerType "hd_destroy";
_marker setMarkerColor "ColorRed";
_marker setMarkerText " Destroy jet";
_marker setMarkerSize [1,1];

// spawn target
jet = createVehicle ["RHS_A10", _sidepos, [], 0, "CAN_COLLIDE"]; 
jet lock true;
jet setdir 140;

// Add task
//Task ID-Task name-Task description and some other options
["Task1","Destroy jet","Seek and destroy NATO <marker name='side_area'>Jet</marker> at the airbase.",true,["Destroy jet",getmarkerpos "side_area"]] call SHK_Taskmaster_add ;


// spawn enemy

// find position to spawn infantry NATO
//_pos = [<marker>,<radios>,<direct>,<if false, no water>
_pos = [getmarkerpos "side_area", random 50, random 360, false, [0,0]] call SHK_pos;

// create random units in a group and spawn it ... [3,0.2] means 100% 3 first classname will spawn and 20% possibility for rest classnames
_grp1 = [(_pos), West,[
"B_Soldier_SL_F","B_soldier_AT_F","B_soldier_AR_F","B_Soldier_A_F","B_medic_F","B_RangeMaster_F",
"B_Competitor_F","B_engineer_F","B_soldier_exp_F","B_Soldier_GL_F","B_soldier_M_F","B_soldier_AA_F",
"B_soldier_PG_F","B_soldier_repair_F","B_Soldier_F","B_soldier_LAT_F","B_Soldier_lite_F","B_soldier_UAV_F",
"B_sniper_F","B_spotter_F"
],[],[],[],[],[3,0.2]] call bis_fnc_spawngroup;

// Give order to group to start patrol at AO marker area, radios 100 meter
[_grp1, (getmarkerPos "side_area"), 100] call bis_fnc_taskPatrol;


// units in house
if (isserver) then {
_units = ["side_area",West,200,0.1,[
"B_Soldier_SL_F","B_soldier_AT_F","B_soldier_AR_F","B_Soldier_A_F","B_medic_F","B_RangeMaster_F",
"B_Competitor_F","B_engineer_F","B_soldier_exp_F","B_Soldier_GL_F","B_soldier_M_F","B_soldier_AA_F",
"B_soldier_PG_F","B_soldier_repair_F","B_Soldier_F","B_soldier_LAT_F","B_Soldier_lite_F","B_soldier_UAV_F",
"B_sniper_F","B_spotter_F"
],-1] spawn SBGF_fnc_garrison;

};


// spawn car at AO area and patrol
_grp2 = createGroup West;
_pos = [ (getmarkerPos "side_area"), random 300, random 359, false, [1, 300]] call SHK_pos;
_carlist = ["rhsusf_m1025_d_m2","rhsusf_m1025_d_Mk19","B_MRAP_01_gmg_F","B_MRAP_01_hmg_F"] call BIS_fnc_selectRandom;
_car1 = createVehicle [_carlist, _pos, [], 0, "CAN_COLLIDE"]; 
"B_Soldier_GL_F" createUnit [_pos, _grp2, " this MoveinGunner _car1",0.8,"SEARGENT"];
"B_Soldier_GL_F" createUnit [_pos, _grp2, " this MoveinDriver _car1",0.6,"PRIVATE"];
[_grp2, (getmarkerPos "side_area"), 1000] call bis_fnc_taskPatrol;


// Spawn tank/apc at AO area and patrol
_grp3 = createGroup West;
_pos = [ (getmarkerPos "side_area"), random 300, random 359, false, [0,0]] call SHK_pos;
_apclist = [
"B_APC_Tracked_01_rcws_F","B_APC_Wheeled_01_cannon_F","B_APC_Tracked_01_rcws_F","B_APC_Wheeled_01_cannon_F"
] call BIS_fnc_selectRandom;
_apc1 = createVehicle [_apclist, _pos, [], 0, "CAN_COLLIDE"];
"B_crew_F" createUnit [_pos, _grp3, " this MoveinCommander _apc1",0.8,"SEARGENT"];
"B_crew_F" createUnit [_pos, _grp3, " this MoveinGunner _apc1",0.6,"PRIVATE"];
"B_crew_F" createUnit [_pos, _grp3, " this MoveinDriver _apc1",0.6,"PRIVATE"];
[_grp3, (getmarkerPos "side_area"), 1000] call bis_fnc_taskPatrol;


// WAIT UNTIL objective destroy
waitUntil { (!alive jet) };

// task complete hint
["Task1","succeeded"] call SHK_Taskmaster_upd;

// delete AO marker and target
deleteMarker "side_area";
sleep 10;
deletevehicle jet;

// remove mans/vehicles/air/static "optional"
sleep 30;
{if (!(isplayer _x)) then {deleteVehicle _x;};} foreach nearestobjects [_sidepos,[
"air","StaticWeapon","Landvehicle"
],2000]; 
sleep 10;
{if (!(isplayer _x)) then {deleteVehicle _x;};} foreach nearestobjects [_sidepos,[
"man"
],2000]; 

sleep 5;

// go for next side mission
if (isserver) then { null=[]execVM "side_finder.sqf"; };

if(true)exitWith{};
 

 

and add more side missions like this.

Note that i used mods classnames for some units and vehicles in example, you have to change classnames to arma vanilla classnames

i wonder if someone could help me i am trying this and I am getting an error


["Ta>
10:50:43   Error position: <


waitUntil { (!alive jet) };


["Ta>
10:50:43   Error Invalid number in expression
10:50:43 File C:\Users\gaffe\Documents\Arma 3 - Other Profiles\Gaffey\missions\SAS OP VIROLAHTI\TEST.Stratis\sidemissions\side1.sqf..., line 85
10:50:43 Error in expression <_area"), 1000] call bis_fnc_taskPatrol;



waitUntil { (!alive jet) };

Share this post


Link to post
Share on other sites

i have sorted it now.. how would I add a win condition to this? so I can pick X amount  and then it will end?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×