Jump to content
Sign in to follow this  
infiltrator_2k

Creating Tasks, Triggers And Units Via Script.

Recommended Posts

I'm still a novice with regards to scripting and up to now I've managed to get by using the editor's GUI to add units, groups, triggers and sync things to etc.. But I've noticed most simple use markers and scripts to create missions. Not only is it a lot cleaner, but I think it's got to be the way if I want to learn how to script.

I'm currently using DAC in conjunction with some manually inserted units. But ideally I'd like to script spawn say an infantry group into buildings as well as DAC zones. This way I can create tasks and spawn DAC zones and groups without players prematurely triggering trigger states. Not only that, but it will obviously also be a lot more resource friendly if these tasks, DAC zones and groups/units are spawned on the fly.

Of course, Invade and Annex uses this method, but the whole mission structure is pretty overwhelming for a novice such as myself. Does anyone have a simple example of how I can randomly create tasks, triggers with DAC zones, units and objects? Also I'd like to assign script spawned units to building positions. Up to now I've achieved this by manually inserting units and assigning them to building positions with code in the unit's init field, but I like to do this all now by script as I know I can't keep getting by using the editor's GUI to achieve it if I want to dynamically generate stuff.

If anyone's got examples I can use/edit it would be much appreciated.

Cheers

Ian

Share this post


Link to post
Share on other sites

Some snippets from my random mission script i use DAC for enemy spawning.

clean_village.sqf is simple "kill all enemy to free the town" modul.

short explanation:

server.sqf:

will setup some vars and stuff.

init_mission:

will select a random town and execute the clean_village.sqf with the town as location.

clean_village:

setup the main mission and some mission related stuff like marker, task, DAC and a mission trigger.

place a logic name it "server",

and a helipad name it "target",

you need to change some paths for the scripts and remove some execVMs

serverside:

server.sqf

systemChat "Start Server";


//Missions
mission_types = ["clean_village"];
sidemission_types = ["crash_site"];

//Array with used main missions
used_cities = [];

//first start init vars
server setVariable ["bs_mission","noActive"];
server setVariable ["bs_sidemission","noActive"];
mission_abort = false;
sidemission_abort = false;
//setup mhq
execVM "server\mhq\init_mhq.sqf";

//ambient  stuff civs,ieds etc
execVM "server\ambient.sqf";

//wait for dac
waituntil{DAC_Basic_Value == 1};

//get param, random 0, request 1
_missionParam = paramsArray select 0;

if(_missionParam == 0)then{
   systemChat "Mission Type Random";
   sleep 20;
[] execVM "server\mission\init_missions.sqf";

}else{

   systemChat "Mission Type Request";

};

init_missions.sqf

//request need mission type, get one if available

mission_abort = false;

_arg = [_this, 0, ""] call BIS_fnc_param;

systemChat format["%1",_this select 0];
_req = _this select 0;

sleep 5;

//get all villages on map
_cities = nearestLocations [position Server, ["NameVillage"], 80000];

//select a random one
_target = [_cities] call fncLib_randomArray;

//return village string
_loc =  text _target;

//if already used restart script
if( _loc in used_cities )then{

   execVM "server\mission\init_missions.sqf";

}else{

   //get mission status

_v = server getVariable "bs_mission";
      systemChat format["%1",_v];
if(_v == "noActive")then{

 		//add village to array
    used_cities = used_cities + [_loc];

    if(_req != "" )then{

          	systemChat format ["req - %1",_req];
           //if reqest take that

       [_req] call fncLib_startMission;

    }else{
           systemChat "ran";
		//select random main mission	
		_mission = [mission_types] call fncLib_randomArray;
           systemChat format ["ran - %1",_mission];
           [_mission] call fncLib_startMission;

       };

  }else{

	hq_logic_papa commandChat "Keine Mission verfügbar";

  };
};

clean_village.sqf

//string town
_text = _this select 0;
//location town
_target = _this select 1;

//setup task
[_text,"Clean " + _text,"Säubern sie " + _text] call SHK_Taskmaster_add;

//create marker
_markerstr = [_target] call mission_marker;

target setpos getMarkerPos _markerstr;

[_markerstr] call mission_dummy_unit;
[_markerstr,target,hq_logic_papa] call mission_enemy_support;

systemChat "start dac";

waituntil{DAC_NewZone == 0};

_dac = "z_" + str floor(time); 
_values = [_dac,[1,0,0,0],[6,4,20,6],[3,2,30,5],[ ],[],[0,4,0,6,1]];
//[ [ position _target select 0, position _target select 1] ,350,350,0,0,_values] call DAC_fNewZone;

[target] call mission_trigger;

/*
* Setup Global Vars
*/
server setVariable ["bs_mission_dac",_dac];

_g = server getVariable "bs_mission_support_object";
_r = server getVariable "bs_mission";

waitUntil { (kt == kb) AND ( DAC_NewZone == 0 ) AND (damage _g > 0.8 ) OR (mission_abort) };

if( (_text == _r ) AND (!mission_abort))then{
   player sidechat format["%1 - %2",_text,_r];
   [_markerstr,_r] call mission_successful;
sleep 5;
execVM "server\mission\standby.sqf";
}else{
   //Mission abort

_v = server getVariable "bs_mission";

if(_v != "noActive")then{

   ['marker'] call fncLib_abortMissionVars;
   ['trigger'] call fncLib_abortMissionVars;
   ['support'] call fncLib_abortMissionVars;
   ['task'] call fncLib_abortMissionVars;

}else{

       [hq_logic_papa, "Keine laufende Mision"] call zp_globalCommandChatClients;

   };
}

mission functions: not all used

sidemission_marker = {

       _target = _this select 0;

   _markerstr = createMarker ["smtarget_" +  str(time), _target ];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerColor "ColorRed";
_markerstr setMarkerType "waypoint";

  	server setVariable ["bs_sidemission_marker",_markerstr];
publicVariable "server";

_markerstr

};

sidemission_successful = {

   _t = _this select 0;
_m = _this select 1;

   deleteMarker _m;

[_t,"succeeded"] call SHK_Taskmaster_upd;	 
   server setVariable ["bs_sidemission","noActive"];
   publicVariable "server";

};

fncLib_addActionOption = {

 	_array = _this select 0;
   _sqf = _this select 1;
_name = _this select 2;

{
      _x addAction [_name,format["client\actions\%1.sqf",_sqf] ];

   }foreach _array;


};

fncLib_abortMissionVars = {

   _typ = _this select 0;

   switch (_typ) do {

   case 'marker': { 
		        	_d = server getVariable "bs_mission_marker";
					_d setMarkerColor "ColorBlue";
                       server setVariable ["bs_mission_marker",false];
				};

   case 'trigger': {
          				_f = server getVariable "bs_mission_trigger";
   					deletevehicle _f;
                       server setVariable ["bs_mission_trigger",false];
				};

   case 'support': {
					_a = server getVariable "bs_mission_support_object";
					_a setDamage 1;
					server setVariable ["bs_mission_support_object",false];
				};

   case 'task': {
       				_v = server getVariable "bs_mission";
					[_v,"failed"] call SHK_Taskmaster_upd;
					server setVariable ["bs_mission","noActive"];
					[hq_logic_papa, "Mission wurde abgebrochen"] call zp_globalCommandChatClients;
				};

   case 'bs_join_sm_grp_player': {

       server setVariable ["bs_join_sm_grp_player_0",false];
	server getVariable ["bs_join_sm_grp_player_1",false];
	server getVariable ["bs_join_sm_grp_player_2",false];
	server getVariable ["bs_join_sm_grp_player_3",false];
       server getVariable ["bs_join_sm_grp_player_4",false];

				};                                                                                                                                                 

   default { hint "fncLib_abortMissionVars no params" };

};
   systemChat "cleaned up";
   publicVariable "server";
};

fncLib_startMission = {

   	_mission = _this select 0;

       //format string and start mission file                        
	_file = Format ["server\mission\m\%1.sqf",_mission];
	server setVariable ["bs_mission",_loc]; 
	publicVariable "server";
   	systemchat _file;
	[_loc,_target] execVM _file;
	hq_logic_papa commandChat "Ãœbertrage Missions Informationen";
};

fncLib_randomArray = {

   _array = _this select 0;

   _c = count _array;
_n = floor ( random  _c );
_i = _array select _n;

   _i
};

// Executed on the server.
zp_requestSideMission = {
   private ["_param1", "_param2", "_param3", "_param4"];

  _param1 = _this select 0;

   [hq_logic_papa, "Neue SMission wird angefordert"] call zp_globalCommandChatClients;
   [_param1] execVM "server\mission\init_sidemission.sqf";
};

fncLib_stratMapPort = {
_m = _this select 0;
   player setpos getmarkerPos _m;
};


mission_trigger = {

    _target = _this select 0;

   systemChat "setup trigger";

   kt = str( floor( time ) ) + "_" + str ( floor( random( 999 ) ) );
kb = 'birdistheword'; 

_trigger = createTrigger ["EmptyDetector", position _target ];
_trigger setTriggerArea [400, 400, 0, true];
_trigger setTriggerActivation ["east", "NOT PRESENT", true];
_trigger setTriggerStatements ["this",format["kb = '%1'",kt], ""];

server setVariable ["bs_mission_trigger",_trigger];
server setVariable ["bs_mission_cleaned",kt];

};

mission_dummy_unit = {

   _position_truck = getMarkerPos _markerstr findEmptyPosition [10,350,"O_Truck_02_covered_F"];
waitUntil {

	if (count _position_truck > 1) exitWith {true};  // has to return true to continue
	sleep 1;
	_position_truck = getMarkerPos _markerstr findEmptyPosition [10,350,"O_Truck_02_covered_F"];  
};

_vehicle = createVehicle ["O_Truck_02_covered_F" , [ _position_truck select 0,  _position_truck select 1], [], 0, ""];
createVehicleCrew _vehicle; 

   systemChat "truck done";
};


mission_enemy_support = {

   _markerstr = _this select 0;
_target = _this select 1;
   _hq_logic_papa = _this select 1;

   _position_antenna = getMarkerPos _markerstr findEmptyPosition [10,350,"PowGen_Big"];
waitUntil {

  // exit loop if the unit gets deleted
	if (count _position_antenna > 1) exitWith {true};  // has to return true to continue
	sleep 1;
	_position_antenna = getMarkerPos _markerstr findEmptyPosition [10,350,"PowGen_Big"];
};

_ant_marker = createMarker ["antenna_"+  str(time), [ _position_antenna select 0, _position_antenna select 1]];
_ant_marker setMarkerShape "ICON";
_ant_marker setMarkerType "loc_Transmitter";
_ant_marker setMarkerColor "ColorRed";

_land_antenna = createVehicle ["PowGen_Big" , [  _position_antenna select 0,  _position_antenna select 1], [], 0, ""];
_land_antenna addEventHandler ["killed", {  [hq_logic_papa, "Keine Feindlichen funkübertragungen mehr im Gebiet"] call zp_globalCommandChatClients;}];

   server setVariable ["bs_mission_support_object",_land_antenna];

systemChat "antenna  done";

[_land_antenna,_target,_hq_logic_papa] spawn {

    _land_antenna_spawn = _this select 0;
    _paras = _this select 1;
	_hq = _this select 2;
 	systemChat "paras waiting";

    while { damage _land_antenna_spawn < 0.8 } do {

		sleep 540;
    	[_paras] execVM "lib\reinforcements.sqf"

	};  
 };
};



mission_successful = {

   _markerstr = _this select 0;
_text = _this select 1;

_markerstr setMarkerColor "ColorGreen";
[_text,"succeeded"] call SHK_Taskmaster_upd;	 
   server setVariable ["bs_mission","noActive"];
   publicVariable "server";
};


mission_marker = {

   _target = _this select 0;

   _markerstr = createMarker ["target_" +  str(time),[ position _target select 0, position _target select 1] ];
_markerstr setMarkerShape "ELLIPSE";
_markerstr setMarkerBrush "FDiagonal";
_markerstr setMarkerSize [400,400];
_markerstr setMarkerColor "ColorRed";

server setVariable ["bs_mission_marker",_markerstr];

_markerstr

};

zp_abortMission = {



};

// Executed on the server.
zp_abortMission = {

private ["_param1", "_param2", "_param3", "_param4"];
   mission_abort = true;
};





fncLib_carRadio = {

   _car = _this select 0;
   _player = _this select 1;
   _status = _this select 2;

hint"Radio ist kaputt";

};

fncLib_findHousePos = {

_target = _this select 0;

_nearesthouses = position target nearObjects ["House",350];
_houseList = [];
{
   for "_i" from 0 to 20 do {
       if ( [(_x buildingPos _i), [0,0,0]] call BIS_fnc_arrayCompare ) exitWith {
           if (_i > 0) then {
               _houseList set [count _houseList, [_x, _i]];
           };
       };
   };    
}forEach _nearesthouses;

_randomHouse = _houseList select (floor (random (count _houseList)));
_housePos = (_randomHouse select 0) buildingPos (floor (random (_randomHouse select 1)));

if( dev )then{

_crate_marker = createMarker ["aas_" + str( time ), _housePos];
_crate_marker setMarkerShape "ICON";
_crate_marker setMarkerType "loc_Tree";
_crate_marker setMarkerColor "ColorRed";

};

_housePos

};


fnclib_chatDump = {

	_str = _this select 0;
	player sidechat _str;

};

fncLib_teleport = {

   onMapSingleClick "player setPos _pos; onMapSingleClick ''"; 

};

fncLib_airstrike = {

};

zp_requestMission = {
private ["_param1", "_param2", "_param3", "_param4"];

  _param1 = _this select 0;

   [hq_logic_papa, "Neue Mission wird angefordert"] call zp_globalCommandChatClients;
   [_param1] execVM "server\mission\init_missions.sqf";

};


fncLib_captive = {

  player setcaptive true;

};


zp_globalCommandChat = {
   private ["_caller", "_text"];

   _caller = _this select 0;
   _text = _this select 1;

  _caller commandChat _text;

};


fnclib_findPos = {

if (!isServer) exitWith {};

_NameVillage = nearestLocations [position Server, ["NameVillage"], 100000];
_possibleLocation = [];
_blacklist  = [];

{

_newmarker = createMarker [str(position _x),position _x];
_newmarker setMarkerShape "ICON";
_newmarker setMarkerText str(_number);
_newmarker setMarkerColor "ColorYellow";
_newmarker setMarkerType "mil_objective";

           //Mögliche positionen
           _possibleLocation = _possibleLocation + [_x];
           //aus schleife entfernen
  			_NameVillage = _NameVillage - [_x];    


}foreach _NameVillage;


_NameCityCapital = nearestLocations [position Server, ["NameCityCapital"], 100000];
_possibleLocation = [];
_blacklist  = [];

{

_newmarker = createMarker [str(position _x),position _x];
_newmarker setMarkerShape "ICON";
_newmarker setMarkerText str(_number);
_newmarker setMarkerColor "ColorGreen";
_newmarker setMarkerType "mil_objective";

           //Mögliche positionen
           _possibleLocation = _possibleLocation + [_x];
           //aus schleife entfernen
  			_NameCityCapital = _NameCityCapital - [_x];    


}foreach _NameCityCapital;

_NameCity = nearestLocations [position Server, ["NameCity"], 100000];
_possibleLocation = [];
_blacklist  = [];

{

_newmarker = createMarker [str(position _x),position _x];
_newmarker setMarkerShape "ICON";
_newmarker setMarkerText str(_number);
_newmarker setMarkerColor "ColorBlue";
_newmarker setMarkerType "mil_objective";

           //Mögliche positionen
           _possibleLocation = _possibleLocation + [_x];
           //aus schleife entfernen
  			_NameCity = _NameCity - [_x];    


}foreach _NameCity;


}

Edited by skullfox

Share this post


Link to post
Share on other sites
Some snippets from my random mission script i use DAC for enemy spawning.

clean_village.sqf is simple "kill all enemy to free the town" modul.

short explanation:

server.sqf:

will setup some vars and stuff.

init_mission:

will select a random town and execute the clean_village.sqf with the town as location.

clean_village:

setup the main mission and some mission related stuff like marker, task, DAC and a mission trigger.

place a logic name it "server",

and a helipad name it "target",

you need to change some paths for the scripts and remove some execVMs

serverside:

server.sqf

systemChat "Start Server";


//Missions
mission_types = ["clean_village"];
sidemission_types = ["crash_site"];

//Array with used main missions
used_cities = [];

//first start init vars
server setVariable ["bs_mission","noActive"];
server setVariable ["bs_sidemission","noActive"];
mission_abort = false;
sidemission_abort = false;
//setup mhq
execVM "server\mhq\init_mhq.sqf";

//ambient  stuff civs,ieds etc
execVM "server\ambient.sqf";

//wait for dac
waituntil{DAC_Basic_Value == 1};

//get param, random 0, request 1
_missionParam = paramsArray select 0;

if(_missionParam == 0)then{
   systemChat "Mission Type Random";
   sleep 20;
[] execVM "server\mission\init_missions.sqf";

}else{

   systemChat "Mission Type Request";

};

init_missions.sqf

//request need mission type, get one if available

mission_abort = false;

_arg = [_this, 0, ""] call BIS_fnc_param;

systemChat format["%1",_this select 0];
_req = _this select 0;

sleep 5;

//get all villages on map
_cities = nearestLocations [position Server, ["NameVillage"], 80000];

//select a random one
_target = [_cities] call fncLib_randomArray;

//return village string
_loc =  text _target;

//if already used restart script
if( _loc in used_cities )then{

   execVM "server\mission\init_missions.sqf";

}else{

   //get mission status

_v = server getVariable "bs_mission";
      systemChat format["%1",_v];
if(_v == "noActive")then{

 		//add village to array
    used_cities = used_cities + [_loc];

    if(_req != "" )then{

          	systemChat format ["req - %1",_req];
           //if reqest take that

       [_req] call fncLib_startMission;

    }else{
           systemChat "ran";
		//select random main mission	
		_mission = [mission_types] call fncLib_randomArray;
           systemChat format ["ran - %1",_mission];
           [_mission] call fncLib_startMission;

       };

  }else{

	hq_logic_papa commandChat "Keine Mission verfügbar";

  };
};

clean_village.sqf

//string town
_text = _this select 0;
//location town
_target = _this select 1;

//setup task
[_text,"Clean " + _text,"Säubern sie " + _text] call SHK_Taskmaster_add;

//create marker
_markerstr = [_target] call mission_marker;

target setpos getMarkerPos _markerstr;

[_markerstr] call mission_dummy_unit;
[_markerstr,target,hq_logic_papa] call mission_enemy_support;

systemChat "start dac";

waituntil{DAC_NewZone == 0};

_dac = "z_" + str floor(time); 
_values = [_dac,[1,0,0,0],[6,4,20,6],[3,2,30,5],[ ],[],[0,4,0,6,1]];
//[ [ position _target select 0, position _target select 1] ,350,350,0,0,_values] call DAC_fNewZone;

[target] call mission_trigger;

/*
* Setup Global Vars
*/
server setVariable ["bs_mission_dac",_dac];

_g = server getVariable "bs_mission_support_object";
_r = server getVariable "bs_mission";

waitUntil { (kt == kb) AND ( DAC_NewZone == 0 ) AND (damage _g > 0.8 ) OR (mission_abort) };

if( (_text == _r ) AND (!mission_abort))then{
   player sidechat format["%1 - %2",_text,_r];
   [_markerstr,_r] call mission_successful;
sleep 5;
execVM "server\mission\standby.sqf";
}else{
   //Mission abort

_v = server getVariable "bs_mission";

if(_v != "noActive")then{

   ['marker'] call fncLib_abortMissionVars;
   ['trigger'] call fncLib_abortMissionVars;
   ['support'] call fncLib_abortMissionVars;
   ['task'] call fncLib_abortMissionVars;

}else{

       [hq_logic_papa, "Keine laufende Mision"] call zp_globalCommandChatClients;

   };
}

mission functions: not all used

sidemission_marker = {

       _target = _this select 0;

   _markerstr = createMarker ["smtarget_" +  str(time), _target ];
_markerstr setMarkerShape "ICON";
_markerstr setMarkerColor "ColorRed";
_markerstr setMarkerType "waypoint";

  	server setVariable ["bs_sidemission_marker",_markerstr];
publicVariable "server";

_markerstr

};

sidemission_successful = {

   _t = _this select 0;
_m = _this select 1;

   deleteMarker _m;

[_t,"succeeded"] call SHK_Taskmaster_upd;	 
   server setVariable ["bs_sidemission","noActive"];
   publicVariable "server";

};

fncLib_addActionOption = {

 	_array = _this select 0;
   _sqf = _this select 1;
_name = _this select 2;

{
      _x addAction [_name,format["client\actions\%1.sqf",_sqf] ];

   }foreach _array;


};

fncLib_abortMissionVars = {

   _typ = _this select 0;

   switch (_typ) do {

   case 'marker': { 
		        	_d = server getVariable "bs_mission_marker";
					_d setMarkerColor "ColorBlue";
                       server setVariable ["bs_mission_marker",false];
				};

   case 'trigger': {
          				_f = server getVariable "bs_mission_trigger";
   					deletevehicle _f;
                       server setVariable ["bs_mission_trigger",false];
				};

   case 'support': {
					_a = server getVariable "bs_mission_support_object";
					_a setDamage 1;
					server setVariable ["bs_mission_support_object",false];
				};

   case 'task': {
       				_v = server getVariable "bs_mission";
					[_v,"failed"] call SHK_Taskmaster_upd;
					server setVariable ["bs_mission","noActive"];
					[hq_logic_papa, "Mission wurde abgebrochen"] call zp_globalCommandChatClients;
				};

   case 'bs_join_sm_grp_player': {

       server setVariable ["bs_join_sm_grp_player_0",false];
	server getVariable ["bs_join_sm_grp_player_1",false];
	server getVariable ["bs_join_sm_grp_player_2",false];
	server getVariable ["bs_join_sm_grp_player_3",false];
       server getVariable ["bs_join_sm_grp_player_4",false];

				};                                                                                                                                                 

   default { hint "fncLib_abortMissionVars no params" };

};
   systemChat "cleaned up";
   publicVariable "server";
};

fncLib_startMission = {

   	_mission = _this select 0;

       //format string and start mission file                        
	_file = Format ["server\mission\m\%1.sqf",_mission];
	server setVariable ["bs_mission",_loc]; 
	publicVariable "server";
   	systemchat _file;
	[_loc,_target] execVM _file;
	hq_logic_papa commandChat "Ãœbertrage Missions Informationen";
};

fncLib_randomArray = {

   _array = _this select 0;

   _c = count _array;
_n = floor ( random  _c );
_i = _array select _n;

   _i
};

// Executed on the server.
zp_requestSideMission = {
   private ["_param1", "_param2", "_param3", "_param4"];

  _param1 = _this select 0;

   [hq_logic_papa, "Neue SMission wird angefordert"] call zp_globalCommandChatClients;
   [_param1] execVM "server\mission\init_sidemission.sqf";
};

fncLib_stratMapPort = {
_m = _this select 0;
   player setpos getmarkerPos _m;
};


mission_trigger = {

    _target = _this select 0;

   systemChat "setup trigger";

   kt = str( floor( time ) ) + "_" + str ( floor( random( 999 ) ) );
kb = 'birdistheword'; 

_trigger = createTrigger ["EmptyDetector", position _target ];
_trigger setTriggerArea [400, 400, 0, true];
_trigger setTriggerActivation ["east", "NOT PRESENT", true];
_trigger setTriggerStatements ["this",format["kb = '%1'",kt], ""];

server setVariable ["bs_mission_trigger",_trigger];
server setVariable ["bs_mission_cleaned",kt];

};

mission_dummy_unit = {

   _position_truck = getMarkerPos _markerstr findEmptyPosition [10,350,"O_Truck_02_covered_F"];
waitUntil {

	if (count _position_truck > 1) exitWith {true};  // has to return true to continue
	sleep 1;
	_position_truck = getMarkerPos _markerstr findEmptyPosition [10,350,"O_Truck_02_covered_F"];  
};

_vehicle = createVehicle ["O_Truck_02_covered_F" , [ _position_truck select 0,  _position_truck select 1], [], 0, ""];
createVehicleCrew _vehicle; 

   systemChat "truck done";
};


mission_enemy_support = {

   _markerstr = _this select 0;
_target = _this select 1;
   _hq_logic_papa = _this select 1;

   _position_antenna = getMarkerPos _markerstr findEmptyPosition [10,350,"PowGen_Big"];
waitUntil {

  // exit loop if the unit gets deleted
	if (count _position_antenna > 1) exitWith {true};  // has to return true to continue
	sleep 1;
	_position_antenna = getMarkerPos _markerstr findEmptyPosition [10,350,"PowGen_Big"];
};

_ant_marker = createMarker ["antenna_"+  str(time), [ _position_antenna select 0, _position_antenna select 1]];
_ant_marker setMarkerShape "ICON";
_ant_marker setMarkerType "loc_Transmitter";
_ant_marker setMarkerColor "ColorRed";

_land_antenna = createVehicle ["PowGen_Big" , [  _position_antenna select 0,  _position_antenna select 1], [], 0, ""];
_land_antenna addEventHandler ["killed", {  [hq_logic_papa, "Keine Feindlichen funkübertragungen mehr im Gebiet"] call zp_globalCommandChatClients;}];

   server setVariable ["bs_mission_support_object",_land_antenna];

systemChat "antenna  done";

[_land_antenna,_target,_hq_logic_papa] spawn {

    _land_antenna_spawn = _this select 0;
    _paras = _this select 1;
	_hq = _this select 2;
 	systemChat "paras waiting";

    while { damage _land_antenna_spawn < 0.8 } do {

		sleep 540;
    	[_paras] execVM "lib\reinforcements.sqf"

	};  
 };
};



mission_successful = {

   _markerstr = _this select 0;
_text = _this select 1;

_markerstr setMarkerColor "ColorGreen";
[_text,"succeeded"] call SHK_Taskmaster_upd;	 
   server setVariable ["bs_mission","noActive"];
   publicVariable "server";
};


mission_marker = {

   _target = _this select 0;

   _markerstr = createMarker ["target_" +  str(time),[ position _target select 0, position _target select 1] ];
_markerstr setMarkerShape "ELLIPSE";
_markerstr setMarkerBrush "FDiagonal";
_markerstr setMarkerSize [400,400];
_markerstr setMarkerColor "ColorRed";

server setVariable ["bs_mission_marker",_markerstr];

_markerstr

};

zp_abortMission = {



};

// Executed on the server.
zp_abortMission = {

private ["_param1", "_param2", "_param3", "_param4"];
   mission_abort = true;
};





fncLib_carRadio = {

   _car = _this select 0;
   _player = _this select 1;
   _status = _this select 2;

hint"Radio ist kaputt";

};

fncLib_findHousePos = {

_target = _this select 0;

_nearesthouses = position target nearObjects ["House",350];
_houseList = [];
{
   for "_i" from 0 to 20 do {
       if ( [(_x buildingPos _i), [0,0,0]] call BIS_fnc_arrayCompare ) exitWith {
           if (_i > 0) then {
               _houseList set [count _houseList, [_x, _i]];
           };
       };
   };    
}forEach _nearesthouses;

_randomHouse = _houseList select (floor (random (count _houseList)));
_housePos = (_randomHouse select 0) buildingPos (floor (random (_randomHouse select 1)));

if( dev )then{

_crate_marker = createMarker ["aas_" + str( time ), _housePos];
_crate_marker setMarkerShape "ICON";
_crate_marker setMarkerType "loc_Tree";
_crate_marker setMarkerColor "ColorRed";

};

_housePos

};


fnclib_chatDump = {

	_str = _this select 0;
	player sidechat _str;

};

fncLib_teleport = {

   onMapSingleClick "player setPos _pos; onMapSingleClick ''"; 

};

fncLib_airstrike = {

};

zp_requestMission = {
private ["_param1", "_param2", "_param3", "_param4"];

  _param1 = _this select 0;

   [hq_logic_papa, "Neue Mission wird angefordert"] call zp_globalCommandChatClients;
   [_param1] execVM "server\mission\init_missions.sqf";

};


fncLib_captive = {

  player setcaptive true;

};


zp_globalCommandChat = {
   private ["_caller", "_text"];

   _caller = _this select 0;
   _text = _this select 1;

  _caller commandChat _text;

};


fnclib_findPos = {

if (!isServer) exitWith {};

_NameVillage = nearestLocations [position Server, ["NameVillage"], 100000];
_possibleLocation = [];
_blacklist  = [];

{

_newmarker = createMarker [str(position _x),position _x];
_newmarker setMarkerShape "ICON";
_newmarker setMarkerText str(_number);
_newmarker setMarkerColor "ColorYellow";
_newmarker setMarkerType "mil_objective";

           //Mögliche positionen
           _possibleLocation = _possibleLocation + [_x];
           //aus schleife entfernen
  			_NameVillage = _NameVillage - [_x];    


}foreach _NameVillage;


_NameCityCapital = nearestLocations [position Server, ["NameCityCapital"], 100000];
_possibleLocation = [];
_blacklist  = [];

{

_newmarker = createMarker [str(position _x),position _x];
_newmarker setMarkerShape "ICON";
_newmarker setMarkerText str(_number);
_newmarker setMarkerColor "ColorGreen";
_newmarker setMarkerType "mil_objective";

           //Mögliche positionen
           _possibleLocation = _possibleLocation + [_x];
           //aus schleife entfernen
  			_NameCityCapital = _NameCityCapital - [_x];    


}foreach _NameCityCapital;

_NameCity = nearestLocations [position Server, ["NameCity"], 100000];
_possibleLocation = [];
_blacklist  = [];

{

_newmarker = createMarker [str(position _x),position _x];
_newmarker setMarkerShape "ICON";
_newmarker setMarkerText str(_number);
_newmarker setMarkerColor "ColorBlue";
_newmarker setMarkerType "mil_objective";

           //Mögliche positionen
           _possibleLocation = _possibleLocation + [_x];
           //aus schleife entfernen
  			_NameCity = _NameCity - [_x];    


}foreach _NameCity;


}

Nice one, I'll let you know how I get on ;)

Cheers

Infil

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
Sign in to follow this  

×