Jump to content
  • 0

Animated Ikea truck? Moving marked patrols?


DynaMike

Question

I would like a MOVING truck (maybe with a live updated marker) to move from 1 position to another on the map.  

The objective would be to intercept and shoot the driver (and co-driver) and then grabbing the vehicle with the loot INSIDE.

If vehicle gets destroyed then some loot will spawn around like a chopper crash.

 

I like the idea of a moving marker (saw it in Wasteland) but it could also just be start and end position shown.

 

Both start position and end position should be randomly set.  So players are able to chase the vehicle but as such not knowing where the mission starts.

 

 

I have tried editing the existing animated crash spawner but had no luck.  Anyone willing or wanting to take on this task?  Creating this would result in unlimited variations for server owners.  They will be able to create missions based on this and activating their players even more.  ATV/MC patrols getting chased.  Policecar on its way to apprehend criminals - intercept and protect your friends = loot

 

The possibilities are MANY.

 

Should be run as an Epoch event.

Link to comment
Share on other sites

Recommended Posts

  • 0

waited for your reply schwede, thanks for the code.

my guess: iam not experienced enough to think that way.

 

iam really excited if your lines are working, will post feedback asap!

thanks again man!

 

 

 

Edit: Schwede, du bist Deutscher?

Link to comment
Share on other sites

  • 0
17:05:55 Error in expression < forEach units _unitgroup;

waitUntil {(_vehicle emptyPositions "DRIVER" == 0)};>
17:05:55   Error position: <_vehicle emptyPositions "DRIVER" == 0)};>
17:05:55   Error Nicht definierte Variable in Ausdruck: _vehicle
17:05:55 File z\addons\dayz_server\WAI\missions\hero\movingconvoy.sqf, line 42
17:05:55 Error in expression <oint_prev","_msg","_wp"];

_vehicle 		= _this select 0;
_position 		= _this sele>
17:05:55   Error position: <_this select 0;
_position 		= _this sele>
17:05:55   Error Nicht definierte Variable in Ausdruck: _this
17:05:55 File z\addons\dayz_server\WAI\missions\hero\movingconvoy.sqf, line 6
17:05:55 Error in expression < forEach units _unitgroup;

waitUntil {(_vehicle emptyPositions "DRIVER" == 0)};>
17:05:55   Error position: <_vehicle emptyPositions "DRIVER" == 0)};>
17:05:55   Error Nicht definierte Variable in Ausdruck: _vehicle
17:05:55 File z\addons\dayz_server\WAI\missions\hero\movingconvoy.sqf, line 42
17:05:55 Error in expression < forEach units _unitgroup;
...
...
...

unfortunately it is not working.

ellenlange rpt mit immer derselben, sich wiederholenden meldung:

waitUntil {(_vehicle emptyPositions "DRIVER" == 0)};>
17:11:58   Error position: <_vehicle emptyPositions "DRIVER" == 0)};>
17:11:58   Error Nicht definierte Variable in Ausdruck: _vehicle
17:11:58 File z\addons\dayz_server\WAI\missions\hero\movingconvoy.sqf, line 42
17:11:58 Error in expression < forEach units _unitgroup;
Link to comment
Share on other sites

  • 0

ok, well then lets forst try to get this started first before we start to customize it ^^

 

try this one:

not sure about the _unitgroup variable though, lets just cross fingers :D

if (isServer) then {


		private["_vehicle","_position","_unitgroup","_waypoint_data","_num_waypoints","_leader","_count_wp","_waypoints","_waypoint_prev","_msg","_wp"];

		_vehicle 		= ["ArmoredSUV_PMC","ArmoredSUV_PMC","ArmoredSUV_PMC"] call BIS_fnc_selectRandom; //Put some Vehicles with guns in here?
		_position 		= [40] call find_position;
		//Troops
		_num = 4 + round (random 3);
		[[_position select 0,_position select 1,0],_num,"hard","Random",4,"Random","Hero","Random","Hero",_mission] call spawn_group;

		_waypoint_data 	= 10; //some
		_num_waypoints 	= 5; //how many waypoints?
		_leader			= leader _unitgroup;
		_count_wp		= count _waypoint_data;
		_waypoint_prev	= "";

		_vehicle setvehiclelock "UNLOCKED";

		_unitgroup setBehaviour "COMBAT";
		_unitgroup setCombatMode "YELLOW";

		{

			if(_leader == _x) then {
				_x assignAsDriver _vehicle;
				_x action["getInDriver",_vehicle];
				diag_log format["WAI: %1 assigned as driver",_x];
			} else {

				if((_vehicle emptyPositions "GUNNER") > 0) then {
					_x assignAsGunner _vehicle;
					_x moveInGunner _vehicle;

					diag_log format["WAI: %1 assigned as gunner",_x];
				} else {
					_x moveInCargo _vehicle;
					diag_log format["WAI: %1 assigned as cargo",_x];
				};

			};

		} forEach units _unitgroup;

		waitUntil {(_vehicle emptyPositions "DRIVER" == 0)};	// Wait until driver gets inside vehicle

		diag_log format["WAI: Driver is inside vehicle, continue.."];

		[_vehicle,_unitgroup] spawn {

			private["_vehicle","_unitgroup","_runmonitor"];

			_vehicle 	= _this select 0;
			_unitgroup 	= _this select 1;
			_runmonitor = true;

			while {(canMove _vehicle && _runmonitor)} do {
				if (fuel _vehicle < 0.2) then { _vehicle setfuel 1; };
				if (!(alive leader _unitgroup)) then {
					diag_log "WAI: Driver was killed, ejecting AI and removing waypoints.";
					_runmonitor = false;
				};
				sleep .5;
			};

			if(_runmonitor) then {
				diag_log "WAI: Vehicle became undriveable, ejecting crew.";
			};

			deleteWaypoint [_unitgroup, all];

			waitUntil { (speed _vehicle < 10) };	// Wait until vehicle slows down before ejecting crew

			{
				_x action ["eject",vehicle _x];
			} forEach crew _vehicle;

			_wp = _unitgroup addWaypoint [(getPos _vehicle),0];
			_wp setWaypointType "GUARD";
			_wp setWaypointBehaviour "COMBAT";

		};

		for "_i" from 1 to _num_waypoints do {

			_rand_nr 	= ceil(random((_count_wp - _i)));
			_waypoint 	= (_waypoint_data select _rand_nr);
			_waypoint_data set[_rand_nr,-1];
			_waypoint_data	= _waypoint_data - [-1];
			
			_wp = _unitgroup addWaypoint [(_waypoint select 1),0];
			
			if(_i == _num_waypoints) then { 
				_wp setWaypointType "GUARD";
			} else { 
				_wp setWaypointType "MOVE";
			};

			_wp setWaypointBehaviour "CARELESS";
			_wp setWaypointCombatMode "YELLOW";

			if(_waypoint_prev != "") then {
				_msg = format["[RADIO] The patrol arrived at %1, heading towards %2",_waypoint_prev,(_waypoint select 0)];
			} else {
				_msg = format["[RADIO] The patrol is seen moving towards %1",(_waypoint select 0)];
			};
			
			sleep random(10);
			
			if (wai_radio_announce) then {
				RemoteMessage = ["radio",_msg];
				publicVariable "RemoteMessage";
			} else {
				[nil,nil,rTitleText,_msg,"PLAIN",10] call RE;
			};
			
			waitUntil{sleep 1; (_vehicle distance (_waypoint select 1) < 30)};

			_waypoint_prev = (_waypoint select 0);
		};

};

post your RPT if not working

 

 

EDIT:

 

Just found exactly what you need, at least if i read the code right:

https://github.com/noxsicarius/Wicked-AI-Missions/blob/master/WAI/missions/missions/building.sqf

Link to comment
Share on other sites

  • 0

hi schwede,

thanks for your help in advance, really glad someone experienced is with me.

i hope we/you can make it work.

 

RPT:

21:50:09 Error in expression <ndom",4,"Random","Hero","Random","Hero",_mission] call spawn_group;

_waypoint_d>
21:50:09   Error position: <_mission] call spawn_group;

_waypoint_d>
21:50:09   Error Nicht definierte Variable in Ausdruck: _mission
21:50:09 File z\addons\dayz_server\WAI\missions\hero\movingconvoy.sqf, line 10
21:50:10 "WAI: Spawned a group of 4 AI (Hero) at [5505.39,7800.95,0]"
21:50:10 Error in expression <num_waypoints 	= 5; 
_leader			= leader _unitgroup;
_count_wp		= count _waypoint>
21:50:10   Error position: <_unitgroup;
_count_wp		= count _waypoint>
21:50:10   Error count: Nicht definierte Variable in Ausdruck: _unitgroup
21:50:10 File z\addons\dayz_server\WAI\missions\hero\movingconvoy.sqf, line 14
21:50:22 "TIME SYNC: Local Time set to [2013,8,3,13,50]"
21:50:51 "WAI: [Bandit] weapon_cache ended at [12423.9,9287.81,0]"
21:51:16 Warning: z\addons\dayz_communityassets\models\razor.p3d:0 Error while trying to generate ST for points: 214, 349, 208
Link to comment
Share on other sites

  • 0
22:17:30 "WAI: Mission Convoy Started At [13071.6,12563.3]"
22:17:30 Error in expression <,0], [], 0, "CAN_COLLIDE"];
[_box] call spawn_ammo_box2;

_veh = createVehicle [>
22:17:30   Error position: <spawn_ammo_box2;

_veh = createVehicle [>
22:17:30   Error Nicht definierte Variable in Ausdruck: spawn_ammo_box2
22:17:30 File z\addons\dayz_server\WAI\missions\hero\movingconvoy.sqf, line 10
22:17:30 "WAI: Mission Convoy spawned a Ural_CDF"
22:17:30 Error in expression <= time;
_unarmed			= false;

if(_aitype == "Hero") then {
_unitGroup	= createGro>
22:17:30   Error position: <== "Hero") then {
_unitGroup	= createGro>
22:17:30   Error ==: Typ Bool, erwartet Zahl,Zeichenfolge,Objekt,Seite,Gruppe,Text,Config entry,Display (dialog),Control,Team member,Task,Location
22:17:30 File z\addons\dayz_server\WAI\compile\spawn_group.sqf, line 42

using the latest wia version 2.2.0 beta 3 - but this doesnt work either...

i will try it with the "master" branch of wia.

 

 

EDIT: my bad, thought this belongs to the original wia missions, didnt saw that this is a different script.

Link to comment
Share on other sites

  • 0

damn, at noxsicarius script nothing is moving from one location to another.

inside the "building.sqf" there are no "waypoints", its just a "static" mission.

 

schwede hast du noch lust weiterzu probieren?

 

would be awesome to get this working/moving.

Link to comment
Share on other sites

  • 0

This is my first attempt at making something so go easy lol can someone help me get this finished, i will share with the community  :)

 

I Called it Moving_Convoy, i would like it if i could get some help on this please after seeing the code i thought i would give it a go i think it looks ok but im not sure about the   _waypoint_data             = _this select 3; And the  _num_waypoints             = _this select 4; settings This is for WAI Mission.
   

 

if(isServer) then {

    private["_mission","_position","_crate_type","_crate","_dir","_vehclass0","_vehclass1","_vehclass2","_vehclass3","_vehclass4","_vehclass5","_vehicle0","_vehicle1","_vehicle2","_vehicle3","_vehicle4","_vehicle5","_group_0","_group_1","_group_2","_group_3","_group_4","_group_5","_unitgroup","_waypoint_data","_num_waypoints","_leader","_count_wp","_waypoints","_waypoint_prev","_msg","_wp","_complete"];

    // Get mission number, important we do this early
    _mission                 = count wai_mission_data -1;
        
    _position                 = [40] call find_position;

    _waypoint_data             = _this select 3;
    _num_waypoints             = _this select 4;
    _leader                    = leader _unitgroup;
    _count_wp                = count _waypoint_data;
    _waypoint_prev            = "";
    
    [_mission,_position,"easy","Moving Convoy","Mainbandit",true] call mission_init;
    
    diag_log         format["WAI: [Mission:[bandit] Moving Convoy]: Starting... %1",_position];

    //Setup the Crate
    _crate_type              = crates_small call BIS_fnc_selectRandom;
    _crate                  = createVehicle [_crate_type,[(_position select 0) - 20,(_position select 1) - 20,0], [], 0, "CAN_COLLIDE"];
    
    //Config Convoy Vehicles Started
    //Set Convoy Spawn Direction
    _dir                     = floor(round(random 360));

    //Set Convoy Vehicle Class
    _vehclass0                 = armed_vehicle        call BIS_fnc_selectRandom;        // Military Armed
    _vehclass1                 = cargo_trucks         call BIS_fnc_selectRandom;        // Cargo Trucks
    _vehclass2                 = refuel_trucks     call BIS_fnc_selectRandom;        // Refuel Trucks
    _vehclass3                 = military_unarmed     call BIS_fnc_selectRandom;        // Military Unarmed
    _vehclass4                 = armed_chopper     call BIS_fnc_selectRandom;        // Armed Chopperscivil_vehicles
    _vehclass5                 = civil_vehicles     call BIS_fnc_selectRandom;        // Civil Vehicles
    
    //Spawn Convoy Vehicles
    _vehicle0                = [_vehclass0,_position,_mission,false,_dir] call custom_publish;    //Spawn Vehicles
    _vehicle1                = [_vehclass0,_position,_mission,false,_dir] call custom_publish;    //Spawn Vehicles
    _vehicle2                = [_vehclass1,_position,_mission,false,_dir] call custom_publish;    //Spawn Vehicles
    _vehicle3                = [_vehclass1,_position,_mission,false,_dir] call custom_publish;    //Spawn Vehicles
    _vehicle4                = [_vehclass2,_position,_mission,false,_dir] call custom_publish;    //Spawn Vehicles
    _vehicle5                = [_vehclass0,_position,_mission,false,_dir] call custom_publish;    //Spawn Vehicles
        
    //Config Convoy Vehicles Ended
    if(debug_mode) then {
        diag_log format["WAI: [bandit] Moving_Convoy spawned a %1",_vehclass0];
        diag_log format["WAI: [bandit] Moving_Convoy spawned a %1",_vehclass1];
        diag_log format["WAI: [bandit] Moving_Convoy spawned a %1",_vehclass2];
        diag_log format["WAI: [bandit] Moving_Convoy spawned a %1",_vehclass3];
        diag_log format["WAI: [bandit] Moving_Convoy spawned a %1",_vehclass4];

        diag_log format["WAI: [bandit] Moving_Convoy spawned a %1",_vehclass5];
    };
    
    //Config Convoy Ai Started
    //Create Ai Troops
    _group_0 =     [[_position select 0,_position select 1,0],4,"Easy","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
    _group_1 =     [[_position select 0,_position select 1,0],4,"Easy","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
    _group_2 =     [[_position select 0,_position select 1,0],4,"Easy","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
    _group_3 =     [[_position select 0,_position select 1,0],4,"Easy","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
    _group_4 =     [[_position select 0,_position select 1,0],4,"Easy","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
    _group_5 =     [[_position select 0,_position select 1,0],4,"Easy","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
    
    //Group Ai Troops
    _unitgroup                 = ["_group_0","_group_1","_group_2","_group_3","_group_4","_group_5"];
    
    //Set Ai Troop Behaviour
    _unitgroup setBehaviour "COMBAT";
    _unitgroup setCombatMode "RED";
    

    //Assign Groups To Vehicles
    {

        if(_leader == _x) then {
            _x assignAsDriver _vehicle0;
            _x action["getInDriver",_vehicle0];
            diag_log format["WAI: %1 assigned as driver",_x];
        } else {

            if((_vehicle0 emptyPositions "GUNNER") > 0) then {
                _x assignAsGunner _vehicle0;
                _x moveInGunner _vehicle0;

                diag_log format["WAI: %1 assigned as gunner",_x];
            } else {
                _x moveInCargo _vehicle0;
                diag_log format["WAI: %1 assigned as cargo",_x];
            };

        };

    } forEach units _unitgroup;
    {

        if(_leader == _x) then {
            _x assignAsDriver _vehicle1;
            _x action["getInDriver",_vehicle1];
            diag_log format["WAI: %1 assigned as driver",_x];
        } else {

            if((_vehicle1 emptyPositions "GUNNER") > 0) then {
                _x assignAsGunner _vehicle1;
                _x moveInGunner _vehicle1;

                diag_log format["WAI: %1 assigned as gunner",_x];
            } else {
                _x moveInCargo _vehicle1;
                diag_log format["WAI: %1 assigned as cargo",_x];
            };

        };

    } forEach units _unitgroup;
    {

        if(_leader == _x) then {
            _x assignAsDriver _vehicle2;
            _x action["getInDriver",_vehicle2];
            diag_log format["WAI: %1 assigned as driver",_x];
        } else {

            if((_vehicle2 emptyPositions "GUNNER") > 0) then {
                _x assignAsGunner _vehicle2;
                _x moveInGunner _vehicle2;

                diag_log format["WAI: %1 assigned as gunner",_x];
            } else {
                _x moveInCargo _vehicle2;
                diag_log format["WAI: %1 assigned as cargo",_x];
            };

        };

    } forEach units _unitgroup;    
    {

        if(_leader == _x) then {
            _x assignAsDriver _vehicle3;
            _x action["getInDriver",_vehicle3];
            diag_log format["WAI: %1 assigned as driver",_x];
        } else {

            if((_vehicle3 emptyPositions "GUNNER") > 0) then {
                _x assignAsGunner _vehicle3;
                _x moveInGunner _vehicle3;

                diag_log format["WAI: %1 assigned as gunner",_x];
            } else {
                _x moveInCargo _vehicle3;
                diag_log format["WAI: %1 assigned as cargo",_x];
            };

        };

    } forEach units _unitgroup;
    {

        if(_leader == _x) then {
            _x assignAsDriver _vehicle4;
            _x action["getInDriver",_vehicle4];
            diag_log format["WAI: %1 assigned as driver",_x];
        } else {

            if((_vehicle4 emptyPositions "GUNNER") > 0) then {
                _x assignAsGunner _vehicle4;
                _x moveInGunner _vehicle4;

                diag_log format["WAI: %1 assigned as gunner",_x];
            } else {
                _x moveInCargo _vehicle4;
                diag_log format["WAI: %1 assigned as cargo",_x];
            };

        };

    } forEach units _unitgroup;
    {

        if(_leader == _x) then {
            _x assignAsDriver _vehicle5;
            _x action["getInDriver",_vehicle5];
            diag_log format["WAI: %1 assigned as driver",_x];
        } else {

            if((_vehicle5 emptyPositions "GUNNER") > 0) then {
                _x assignAsGunner _vehicle5;
                _x moveInGunner _vehicle5;

                diag_log format["WAI: %1 assigned as gunner",_x];
            } else {
                _x moveInCargo _vehicle5;
                diag_log format["WAI: %1 assigned as cargo",_x];
            };

        };

    } forEach units _unitgroup;
    
    //Loading Vehicles
    waitUntil {(_vehicle0 emptyPositions "DRIVER" == 0)};    // Wait until driver gets inside vehicle
    waitUntil {(_vehicle1 emptyPositions "DRIVER" == 0)};    // Wait until driver gets inside vehicle
    waitUntil {(_vehicle2 emptyPositions "DRIVER" == 0)};    // Wait until driver gets inside vehicle
    waitUntil {(_vehicle3 emptyPositions "DRIVER" == 0)};    // Wait until driver gets inside vehicle
    waitUntil {(_vehicle4 emptyPositions "DRIVER" == 0)};    // Wait until driver gets inside vehicle
    waitUntil {(_vehicle5 emptyPositions "DRIVER" == 0)};    // Wait until driver gets inside vehicle
    
    diag_log format["WAI: Drivers Are Inside Vehicles, Continue.."];

    [_vehicle0,_vehicle1,_vehicle2,_vehicle3,_vehicle4,_vehicle5,_unitgroup] spawn {

        private["_vehicle0","_vehicle1","_vehicle2","_vehicle3","_vehicle4","_vehicle5","_unitgroup","_runmonitor"];

        _vehicle     = ["_vehicle0","_vehicle1","_vehicle2","_vehicle3","_vehicle4","_vehicle5"];
        _unitgroup     = ["_group_0","_group_1","_group_2","_group_3","_group_4","_group_5"];
        _runmonitor = true;

        while {(canMove _vehicle && _runmonitor)} do {
            if (fuel _vehicle < 0.2) then { _vehicle setfuel 1; };
            if (!(alive leader _unitgroup)) then {
                diag_log "WAI: Driver was killed, ejecting AI and removing waypoints.";
                _runmonitor = false;
            };
            sleep .5;
        };

        if(_runmonitor) then {
            diag_log "WAI: Vehicle became undriveable, ejecting crew.";
        };

        deleteWaypoint [_unitgroup, all];

        waitUntil { (speed _vehicle < 10) };    // Wait until vehicle slows down before ejecting crew

        {
            _x action ["eject",vehicle _x];
        } forEach crew _vehicle;

        _wp = _unitgroup addWaypoint [(getPos _vehicle),0];
        _wp setWaypointType "GUARD";
        _wp setWaypointBehaviour "COMBAT";

    };

    for "_i" from 1 to _num_waypoints do {

        _rand_nr     = ceil(random((_count_wp - _i)));
        _waypoint     = (_waypoint_data select _rand_nr);
        _waypoint_data set[_rand_nr,-1];
        _waypoint_data    = _waypoint_data - [-1];
            
        _wp = _unitgroup addWaypoint [(_waypoint select 1),0];
            
        if(_i == _num_waypoints) then {
            _wp setWaypointType "GUARD";
        } else {
            _wp setWaypointType "MOVE";
        };

        _wp setWaypointBehaviour "SAFE";
        _wp setWaypointCombatMode "RED";

        if(_waypoint_prev != "") then {
            _msg = format["[RADIO] The patrol arrived at %1, heading towards %2",_waypoint_prev,(_waypoint select 0)];
        } else {
            _msg = format["[RADIO] The patrol is seen moving towards %1",(_waypoint select 0)];
        };
            
        sleep random(10);
            
        if (wai_radio_announce) then {
            RemoteMessage = ["radio",_msg];
            publicVariable "RemoteMessage";
        } else {
            [nil,nil,rTitleText,_msg,"PLAIN",10] call RE;
        };
            
        waitUntil{sleep 1; (_vehicle distance (_waypoint select 1) < 30)};

        _waypoint_prev = (_waypoint select 0);
    };
    
    //Condition
    _complete = [
        [_mission,_crate], // mission number and crate
        ["kill"],  // ["crate"], or ["kill"], or ["assassinate", _unitGroup],
        [_vehicle0,_vehicle1,_vehicle2,_vehicle3,_vehicle4,_vehicle5],  // cleanup objects
        "A Moving Armed Convoy Is On Route To location, stop them before They reach destination!", // mission announcement
        "Survivors have dealt with the Convoy!", // mission success
        "Survivors did not deal with the Convoy in time! A bandit base might appear here soon!" // mission fail
    ] call mission_winorfail;
    
    //Call Create After Completion
    if(_complete) then {
        [_crate,4,8,36,2] call dynamic_crate;
    };
    
    diag_log format["WAI: [Mission:[bandit] Bandit Convoy]: Ended at %1",_position];

    h_missionsrunning = h_missionsrunning - 1;
};

Link to comment
Share on other sites

  • 0

ok, well then lets get back to the old version with waypoints and try to get rid of the errors one by one:

if (isServer) then {


		private["_vehicle","_position","_unitGroup","_waypoint_data","_num_waypoints","_leader","_count_wp","_waypoints","_waypoint_prev","_msg","_wp"];

		_vehicle 		= ["ArmoredSUV_PMC","ArmoredSUV_PMC","ArmoredSUV_PMC"] call BIS_fnc_selectRandom; //Put some Vehicles with guns in here?
		_position 		= [40] call find_position;
		_mission		= [_position,"Hard","Moving Convoy","MainBandit",true] call mission_init; 
		//Troops
		_num = 4 + round (random 3);
		[[_position select 0,_position select 1,0],_num,"hard","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;

		_waypoint_data 	= 10; //some
		_num_waypoints 	= 5; //how many waypoints?
		_leader			= leader _unitGroup;
		_count_wp		= count _waypoint_data;
		_waypoint_prev	= "";

		_vehicle setvehiclelock "UNLOCKED";

		_unitGroup setBehaviour "COMBAT";
		_unitGroup setCombatMode "YELLOW";

		{

			if(_leader == _x) then {
				_x assignAsDriver _vehicle;
				_x action["getInDriver",_vehicle];
				diag_log format["WAI: %1 assigned as driver",_x];
			} else {

				if((_vehicle emptyPositions "GUNNER") > 0) then {
					_x assignAsGunner _vehicle;
					_x moveInGunner _vehicle;

					diag_log format["WAI: %1 assigned as gunner",_x];
				} else {
					_x moveInCargo _vehicle;
					diag_log format["WAI: %1 assigned as cargo",_x];
				};

			};

		} forEach units _unitGroup;

		waitUntil {(_vehicle emptyPositions "DRIVER" == 0)};	// Wait until driver gets inside vehicle

		diag_log format["WAI: Driver is inside vehicle, continue.."];

		[_vehicle,_unitGroup] spawn {

			private["_vehicle","_unitGroup","_runmonitor"];

			_vehicle 	= _this select 0;
			_unitGroup 	= _this select 1;
			_runmonitor = true;

			while {(canMove _vehicle && _runmonitor)} do {
				if (fuel _vehicle < 0.2) then { _vehicle setfuel 1; };
				if (!(alive leader _unitGroup)) then {
					diag_log "WAI: Driver was killed, ejecting AI and removing waypoints.";
					_runmonitor = false;
				};
				sleep .5;
			};

			if(_runmonitor) then {
				diag_log "WAI: Vehicle became undriveable, ejecting crew.";
			};

			deleteWaypoint [_unitGroup, all];

			waitUntil { (speed _vehicle < 10) };	// Wait until vehicle slows down before ejecting crew

			{
				_x action ["eject",vehicle _x];
			} forEach crew _vehicle;

			_wp = _unitGroup addWaypoint [(getPos _vehicle),0];
			_wp setWaypointType "GUARD";
			_wp setWaypointBehaviour "COMBAT";

		};

		for "_i" from 1 to _num_waypoints do {

			_rand_nr 	= ceil(random((_count_wp - _i)));
			_waypoint 	= (_waypoint_data select _rand_nr);
			_waypoint_data set[_rand_nr,-1];
			_waypoint_data	= _waypoint_data - [-1];
			
			_wp = _unitGroup addWaypoint [(_waypoint select 1),0];
			
			if(_i == _num_waypoints) then { 
				_wp setWaypointType "GUARD";
			} else { 
				_wp setWaypointType "MOVE";
			};

			_wp setWaypointBehaviour "CARELESS";
			_wp setWaypointCombatMode "YELLOW";

			if(_waypoint_prev != "") then {
				_msg = format["[RADIO] The patrol arrived at %1, heading towards %2",_waypoint_prev,(_waypoint select 0)];
			} else {
				_msg = format["[RADIO] The patrol is seen moving towards %1",(_waypoint select 0)];
			};
			
			sleep random(10);
			
			if (wai_radio_announce) then {
				RemoteMessage = ["radio",_msg];
				publicVariable "RemoteMessage";
			} else {
				[nil,nil,rTitleText,_msg,"PLAIN",10] call RE;
			};
			
			waitUntil{sleep 1; (_vehicle distance (_waypoint select 1) < 30)};

			_waypoint_prev = (_waypoint select 0);
		};

};

This should be now without the missing _mission variable, Post the RPT

 

 

======================

@Tech_Support: as far as i can tell  _waypoint_data             = _this select 3; And the  _num_waypoints             = _this select 4; should be just some random numbers. As soon as the convoy is moving we are able to customize it, till then we would like to move it, move it move it ^^

Link to comment
Share on other sites

  • 0

isnt that what this is for         _wp setWaypointType "MOVE"; ??  this makes it travel on roads         _wp setWaypointBehaviour "SAFE"; ??

 

    for "_i" from 1 to _num_waypoints do {

        _rand_nr     = ceil(random((_count_wp - _i)));
        _waypoint     = (_waypoint_data select _rand_nr);
        _waypoint_data set[_rand_nr,-1];
        _waypoint_data    = _waypoint_data - [-1];
            
        _wp = _unitgroup addWaypoint [(_waypoint select 1),0];
            
        if(_i == _num_waypoints) then {
            _wp setWaypointType "GUARD";
        } else {
            _wp setWaypointType "MOVE";
        };

        _wp setWaypointBehaviour "SAFE";
        _wp setWaypointCombatMode "RED";

Link to comment
Share on other sites

  • 0

hi schwede,

i dunno if its related to your mission-code, but i got this in my rpt:

20:03:02 Error in expression <" + str(_mission)); };
wai_mission_data select _mission set [1, _type];
wai_miss>
20:03:02   Error position: <select _mission set [1, _type];
wai_miss>
20:03:02   Error select: Typ Array, erwartet Zahl,Bool
20:03:02 File z\addons\dayz_server\WAI\compile\mission_init.sqf, line 13

the  difference i see, is how the mission itsself is inited:

[_mission,_position,"Medium",format["Disabled %1",_vehname],"MainHero",true] call mission_init;

compared to yours

 _mission        = [_position,"Hard","Moving Convoy","MainBandit",true] call mission_init;

 

line 13 in mission_init.sqf:

...

wai_mission_data select _mission set [1, _type];

...
 

due my lack of scripting knowledge i dont know what or how to change something.

Link to comment
Share on other sites

  • 0

i use the latest wia 2.2.0 beta 3 from f3cuk.

this is one of the default hero missions:http://pastebin.com/iHUSU1MA

from the latest branch.

 

 

 

edit:

with debug enabled:

21:03:40 "WAI DEBUG: FINDPOS: Checking nearby mission markers: ["DZMSMajMarker","DZMSMinMarker","DZMSBMajMarker","DZMSBMinMarker","MainBandit0","MainHero1"]"
21:03:40 "WAI DEBUG: FINDPOS: Checking nearby trader markers: ["Tradercitystary","wholesaleSouth","boatTraderEast","BoatDealerSouth","AirVehicles","BanditDen","Klen","BoatDealerEast","TradercityBash","HeroTrader"]"
21:03:40 "Loop complete, valid position [4069.89,6593.45] in 7 attempts"
21:03:40 "WAI: Starting Mission number [4069.89,6593.45,0]"
21:03:40 Error in expression <" + str(_mission)); };
wai_mission_data select _mission set [1, _type];
wai_miss>
21:03:40   Error position: <select _mission set [1, _type];
wai_miss>
21:03:40   Error select: Typ Array, erwartet Zahl,Bool
21:03:40 File z\addons\dayz_server\WAI\compile\mission_init.sqf, line 13
21:04:13 "DZAI Monitor :: Server Uptime: [0d 0h 21m 7s]. Active AI Groups: 11."
21:04:13 "DZAI Monitor :: Static Spawns: 0. Respawn Queue: 0 groups queued."
21:04:13 "DZAI Monitor :: Dynamic Spawns: 0. Air Patrols: 1. Land Patrols: 10."
21:04:33 Out of path-planning region for O 1-1-E:1 at 1679.1,3885.0, node type
21:04:36 "WAI: 12 Active ground units"
21:04:36 "WAI: 0 Active emplacement units"
21:04:36 "WAI: 0 Active chopper patrol units (Crew)"
21:04:36 "WAI: 0 Active vehicle patrol units (Crew)"
21:05:05 "RUNNING EVENT: construction on [2015,3,17,14,5]"
21:05:05 "Spawning loot event at [4924.32,9121.91]"
21:05:05 "Creating ammo box at [4798.82,8965.61]"
21:05:06 "Loot event setup, waiting for 900 seconds"
21:05:24 "TIME SYNC: Local Time set to [2013,8,3,14,5]"
21:05:36 "WAI: 12 Active ground units"
21:05:36 "WAI: 0 Active emplacement units"
21:05:36 "WAI: 0 Active chopper patrol units (Crew)"
21:05:36 "WAI: 0 Active vehicle patrol units (Crew)"
21:06:36 "WAI: 12 Active ground units"
21:06:36 "WAI: 0 Active emplacement units"
21:06:36 "WAI: 0 Active chopper patrol units (Crew)"
21:06:36 "WAI: 0 Active vehicle patrol units (Crew)"
21:07:36 "WAI: 12 Active ground units"
21:07:36 "WAI: 0 Active emplacement units"
21:07:36 "WAI: 0 Active chopper patrol units (Crew)"
21:07:36 "WAI: 0 Active vehicle patrol units (Crew)"
Link to comment
Share on other sites

  • 0

i use the latest wia 2.2.0 beta 3 from f3cuk.

 

 

Thats what i was using to make the convoy with the post i posted idk wtf im doing really so lol it all looked good most of it was copy paste but common sense and a tiny bit of what i thought would make it happen. guess ill leave it to the pro's spent to much time making convoy's with both Mission and Map editors to get no where when trying to add it to dayZ.

Link to comment
Share on other sites

  • 0

waypoints from mission editor ?

 

            class Waypoints
            {
                items=120;
                class Item0
                {
                    position[]={477.77307,6,1651.5812};
                    combatMode="RED";
                    formation="LINE";
                    speed="LIMITED";
                    combat="SAFE";
                    class Effects
                    {
                    };
                    showWP="NEVER";
                };

 

Or waypoints from Map editor ?

 

_this = _group_1 addWaypoint [[300.33997, 1622.9105], 0];
_this setWaypointType "LEADER";
_this setWaypointCombatMode "RED";
_this setWaypointFormation "LINE";
_this setWaypointSpeed "LIMITED";
_this setWaypointBehaviour "SAFE";
_this showWaypoint "NEVER";
_waypoint_0 = _this;

Link to comment
Share on other sites

  • 0

I found this code can any of it be used to create the random waypoints we need ??

 

// =========================================================================================================
//  Convoy creator
//  Version: 1.6
//  Author: DTM2801
//  
// Credits & thanks: TRexian for providing random cargo part
// =========================================================================================================
//
// Description:
// This script wil create a convoy (configurable) and will keep monitoring all convoy vehicles for the correct distance by adjusting speed.
// If the distance between convoy vehicles gets too far the forward vehicle will slowdown and eventually wait until the follower gets back
// in acceptable distance.
//
// Usage:
// - Define a route for the convoy by placing and naming markers on the map.
// - Place a Game Logic on the map at the location and direction where you want the convoy be spawned.
// - Put the initstring in the initialisation field of the Game Logic.
//
// NOTE: ** Functions module must be placed on the map **
//
// Explanation of initstring:
//   null= [1:objectname,2:side,[3:"nameofmarker1","nameofmarker2","nameofmarker3"],4:cycle,5:convoysize,6:delay,[7:"classname1","classname2","classname3"],[8:namevehicle1, namevehicle2, namevehicle3],9:wpmarkers,10:debug]execvm "convoy.sqf";
//
//  1 : _position    : objectname spawnpoint of convoy vehicles (default: this)
//  2: _side        : side of convoy vehicles (WEST, EAST, RESISTANCE,CIVILIAN)
//  3: _wparray    : array of markernames used to create waypoints (have to be between "")
//  4: _wpcycle    : turn on/off cycle waypoint (true/false)
//  5: _convoysize    : number of default spawned vehicles (default: 5)
//  6: _delay        : time between vehicle spawns, needed to prevent pile ups (default: 7)
//  7: _vehiclearray    : array of vehicle classnames by choice, will be spawned it the order left to right (default: [])
//  8: _customarray    : array of vehiclenames on the map (default: [])
//  9: _wpmarkers    : turn on/off display of waypoint markers on map (true/false)
// 10: _debug        : turn on/off debug messages (true/false)
//
// example default vehicles:        null= [this,WEST,["convoywp1","convoywp2","convoywp3"],false,5,7,[],[],true,false]execvm "convoy.sqf";
// example vehicle array:         null= [this,WEST,["convoywp1","convoywp2","convoywp3"],false,0,7,["HMMWV_M2","MTVR","HMMWV_M2"],[],true,false]execvm "convoy.sqf";
// example preplaced vehicle array:    null= [this,WEST,["convoywp1","convoywp2","convoywp3"],false,0,7,[],[veh1, veh2, veh3],true,false]execvm "convoy.sqf";
// =========================================================================================================

waitUntil {!isnil "bis_fnc_init" };
if (isServer) then {
    private ["_position", "_side", "_wparray", "_convoysize", "_delay", "_vehiclearray", "_customarray", "_wpmarkers", "_debug", "_wpcycle","_wpcount", "_vehiclecount", "_customcount", "_vehspawn", "_convoytype", "_convoycenter", "_convoygrp", "_vehicle", "_i", "_selectwp", "_wp", "_wpmarker", "_convoyarray", "_spawn", "_spawned", "_convoycount", "_convoy1", "_convoy2", "_cselect1", "_cselect2", "_customgrp", "_custom"];
    _position = _this select 0;     if (isNil ("_position")) exitWith {hint "CONVOY: \nPosition not defined."};
    _side = _this select 1;         if (isNil ("_side")) exitWith {hint "CONVOY: \nSide not defined."};
    _wparray = _this select 2;         if (isNil ("_wparray")) exitWith {hint "CONVOY: \nWaypoints not defined."};
    _wpcycle = _this select 3;         if (isNil ("_wpcycle")) exitWith {hint "CONVOY: \nCycle waypoint not defined."};
    _convoysize = _this select 4;     if (isNil ("_convoysize")) exitWith {hint "CONVOY: \nConvoysize not defined."};
    _delay = _this select 5;         if (isNil ("_delay")) exitWith {hint "CONVOY: \nDelay not defined."};
    _vehiclearray = _this select 6; if (isNil ("_vehiclearray")) exitWith {hint "CONVOY: \nVehicles not defined."};
    _customarray = _this select 7;     if (isNil ("_customarray")) exitWith {hint "CONVOY: \nVehicles not defined."};
    _wpmarkers = _this select 8;     if (isNil ("_wpmarkers")) exitWith {hint "CONVOY: \nMarkers true/false not defined."};
    _debug = _this select 9;         if (isNil ("_debug")) exitWith {hint "CONVOY: \nDebug true/false not defined."};
    
    _wpcount = (count _wparray);
    _vehiclecount = (count _vehiclearray);
    _customcount = (count _customarray);
    if (_vehiclecount >0 && _customcount >0) exitWith {hint "CONVOY: \nCannot use both vehicle arrays."};
    _vehspawn = 0;

    _convoytype = 0;
        if (_vehiclecount > 0) then {_convoytype = 1};
        if (_customcount > 0) then {_convoytype = 2};
            
    switch (_convoytype) do {
        case 0:
        {
        _convoycenter = createCenter _side;
        _convoygrp = createGroup _side;

        _vehicle = objNull;
        if (_side == WEST) then {_vehicle = "MTVR"};
        if (_side == EAST) then {_vehicle = "Kamaz"};
        if (_side == RESISTANCE) then {_vehicle = "V3S_Gue"};
        if (_side == CIVILIAN) then {_vehicle = "UralCivil2"};

            for "_i" from 0 to (_wpcount -1) do {
            _selectwp = (_wparray select _i);
            _wp = _convoygrp addWaypoint [(getmarkerpos _selectwp), 0];
            [_convoygrp,_i] setWaypointType "MOVE";
            [_convoygrp,_i] setWaypointCompletionRadius 30;
            [_convoygrp,_i] setwaypointCombatMode "BLUE";
            [_convoygrp,_i] setWaypointFormation "FILE";
            [_convoygrp,_i] setWaypointBehaviour "SAFE";
    
                if (_wpmarkers) then {
                _wpmarker_name = (_wparray select _i);
                _wpmarker = createMarker[_wpmarker_name,(getmarkerpos _selectwp)];
                _wpmarker setMarkerShape "ICON";
                _wpmarker_name setMarkerType "DOT";
                };
            };
        if (_wpcycle) then {
        _wp = _convoygrp addWaypoint [(getmarkerpos (_wparray select 0)), 0];
        _wp setWaypointType "CYCLE";
        };
        _convoyarray = [];
            
            while {_vehspawn < (_convoysize)} do {
            _spawn = [(getpos _position), (getdir _position), _vehicle, _convoygrp] call BIS_fnc_spawnVehicle;
            _spawned = (_spawn select 0);
            _spawned setVehicleVarname format ["Convoy_%1",(_vehspawn + 1)];
            _spawned addEventHandler ["dammaged", {if (_debug) then {hint format ["%1 has been damaged",_this select 0];}}];
            _spawned addEventHandler ["killed", {if (_debug) then {hint format ["%1 has been destroyed!",_this select 0];}}];    
            _convoyarray = _convoyarray + [_spawn];
            _convoycount = count _convoyarray;
            _vehspawn = _vehspawn + 1;
            
            _cargoNum = _spawned emptyPositions "cargo";
                if (_cargoNum > 0) then {
                _fillSlots = round (random _cargoNum);
                _pos = getpos _position;
                _locGr =  _pos findEmptyPosition [10, 100];
                sleep .2;
                    if (_locGr select 0 > 0)then {
                    _cargo = [_locGr, _side , _cargoNum,[],[],[],[],[_fillSlots,.5], _dir] call BIS_fnc_spawnGroup;
                    sleep .2;
                    {_x moveInCargo _spawned;} forEach units _cargo;
                    };
                };
                        
                if (_convoycount > 1) then {
                _convoy1 = (_convoyarray select _convoycount -1);
                _convoy2 = (_convoyarray select _convoycount -2);
                _cselect1 = _convoy1 select 0;
                _cselect2 = _convoy2 select 0;
                _spawn call { [_cselect1,_cselect2,_debug] execVM "convoy_control.sqf"; } ;
                };
            sleep _delay;        
            };
        };
        
        case 1:
        {
        _convoycenter = createCenter _side;
        _convoygrp = createGroup _side;
        
            for "_i" from 0 to (_wpcount -1) do {
            _selectwp = (_wparray select _i);
            _wp = _convoygrp addWaypoint [(getmarkerpos _selectwp), 0];
            [_convoygrp,_i] setWaypointType "MOVE";
            [_convoygrp,_i] setWaypointCompletionRadius 30;
            [_convoygrp,_i] setwaypointCombatMode "BLUE";
            [_convoygrp,_i] setWaypointFormation "FILE";
            [_convoygrp,_i] setWaypointBehaviour "SAFE";
    
                if (_wpmarkers) then {
                _wpmarker_name = (_wparray select _i);
                _wpmarker = createMarker[_wpmarker_name,(getmarkerpos _selectwp)];
                _wpmarker setMarkerShape "ICON";
                _wpmarker_name setMarkerType "DOT";
                };
            };
            if (_wpcycle) then {
            _wp = _convoygrp addWaypoint [(getmarkerpos (_wparray select 0)), 0];
            _wp setWaypointType "CYCLE";
            };    
        _convoyarray = [];
            
            for "_i" from 0 to (_vehiclecount -1) do {
            _spawn = [(getpos _position), (getdir _position),(_vehiclearray select _i), _convoygrp] call BIS_fnc_spawnVehicle;
            _spawned = (_spawn select 0);
            _spawned setVehicleVarname format ["Convoy%1",(_vehspawn + 1)];
            _spawned addEventHandler ["dammaged", {if (_debug) then {hint format ["%1 has been damaged",_this select 0];}}];
            _spawned addEventHandler ["killed", {if (_debug) then {hint format ["%1 has been destroyed!",_this select 0];}}];
            _convoyarray = _convoyarray + [_spawn];
            _convoycount = count _convoyarray;
            _vehspawn = _vehspawn + 1;
            
            _cargoNum = _spawned emptyPositions "cargo";
                if (_cargoNum > 0) then {
                _fillSlots = round (random _cargoNum);
                _pos = getpos _position;
                _locGr =  _pos findEmptyPosition [10, 100];
                sleep .2;
                    if (_locGr select 0 > 0)then {
                    _cargo = [_locGr, _side , _cargoNum,[],[],[],[],[_fillSlots,.5], _dir] call BIS_fnc_spawnGroup;
                    sleep .2;
                    {_x moveInCargo _spawned;} forEach units _cargo;
                    };
                };
            
                if (_convoycount > 1) then {
                _convoy1 = (_convoyarray select _convoycount -1);
                _convoy2 = (_convoyarray select _convoycount -2);
                _cselect1 = _convoy1 select 0;
                _cselect2 = _convoy2 select 0;
                _spawn call { [_cselect1,_cselect2,_debug] execVM "convoy_control.sqf"; } ;
                };
            sleep _delay;        
            };
        };
        
        case 2:
        {
        _convoygrp = group (_customarray select 0);
            for "_i" from 0 to (_wpcount -1) do {
            _selectwp = (_wparray select _i);
            _wp = _convoygrp addWaypoint [(getmarkerpos _selectwp), 0];
            [_convoygrp,_i] setWaypointType "MOVE";
            [_convoygrp,_i] setWaypointCompletionRadius 30;
            [_convoygrp,_i] setwaypointCombatMode "BLUE";
            [_convoygrp,_i] setWaypointFormation "FILE";
            [_convoygrp,_i] setWaypointBehaviour "SAFE";
    
                if (_wpmarkers) then {
                _wpmarker_name = (_wparray select _i);
                _wpmarker_name setMarkerType "DOT";
                _wpmarker = createMarker[_wpmarker_name,(getmarkerpos _selectwp)];
                _wpmarker setMarkerShape "ICON";
                };
            };
            if (_wpcycle) then {
            _wp = _convoygrp addWaypoint [(getmarkerpos (_wparray select 0)), 0];
            _wp setWaypointType "CYCLE";
            };    
        _convoyarray = [];
            
            for "_i" from 0 to (_customcount -1) do {
            _custom = (_customarray select _i);
            _custom addEventHandler ["dammaged", {if (_debug) then {hint format ["%1 has been damaged",_this select 0];}}];
            _custom addEventHandler ["killed", {if (_debug) then {hint format ["%1 has been destroyed!",_this select 0];}}];
            _convoyarray = _convoyarray + [_custom];
            _convoycount = count _convoyarray;

                if (_convoycount > 1) then {
                _convoy1 = (_convoyarray select _convoycount -1);
                _convoy2 = (_convoyarray select _convoycount -2);
                _cselect1 = _convoy1;
                _cselect2 = _convoy2;
                _custom call { [_cselect1,_cselect2,_debug] execVM "convoy_control.sqf"; } ;
                };
            sleep _delay;
            };        
        };
    };

};

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

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