sold67 10 Posted May 30, 2013 I can't seem to make the GPK in the script below follow the MTVR. It looks alright to to me, but I don't script, so someone else might be able to spot why it doesn't want to follow the MTVR/Convoytruck. It'll spawn both the GPK and the MTVR, but only the MTVR will start to move the idea is to have the GPK escort the convoy and engage anyone that tries to attack it. // script written by Eddie Vedder for the Chernarus life Revivved mission sleep 10; govconvoygroup = createGroup west; _counter = 0; _counter2 = 0; _added = false; _sidewon = "Neither"; while {true} do { //waits for respawn sleep (convoyrespawntime*54); "hint ""The Government convoy will leave in a few minutes."";" call broadcast; sleep (convoyrespawntime*6); //Gets position to spawn _array = [[convspawn1, 10], [convspawn2, 10], [convspawn3, 10], [convspawn4, 10], [convspawn5, 10]]; _spawn = (floor(random(count _array))); _pos = (_array select _spawn) select 0; _radius = (_array select _spawn) select 1; // spawn markers truck and soldiers _markerobj = createMarker ["convoy",[0,0]]; _markername = "convoy"; _markerobj setMarkerShape "ICON"; "convoy" setMarkerType "Marker"; "convoy" setMarkerColor "ColorRed"; "convoy" setMarkerText "Government Convoy"; convoy_marker_active = 1; convoyhascash=true; publicvariable "convoyhascash"; convoytruck = "Ural_TK_CIV_EP1" createVehicle getPos _pos;; gpk = "HMMWV_M1151_M2_DES_EP1" createVehicle getPos _pos;; convoytruck setVehicleInit " convoytruck = this; this setVehicleVarName ""convoytruck""; this lock true; this setAmmoCargo 0; this setDir getdir _pos; clearweaponcargo this; clearmagazinecargo this; "; gpk setVehicleInit " gpk = this; this setVehicleVarName ""gpk""; this lock true; this setAmmoCargo 1; this setDir getdir _pos; "; processinitcommands; publicvariable "convoytruck"; publicvariable "gpk"; deleteVehicle convoysoldier; convoysoldier = govconvoygroup createUnit ["US_Soldier_Officer_EP1", _pos, [], _radius, "FORM"]; convoysoldier setvehicleinit 'convoysoldier = this;this setVehicleVarName "convoysoldier";'; removeAllWeapons convoysoldier; convoysoldier addweapon "revolver_gold_EP1"; convoysoldier addmagazine "6Rnd_45ACP"; convoysoldier addmagazine "6Rnd_45ACP"; convoysoldier addmagazine "6Rnd_45ACP"; deleteVehicle convoyguard1; convoyguard1 = govconvoygroup createUnit ["US_Soldier_EP1", _pos, [], _radius, "FORM"]; convoyguard1 setvehicleinit 'convoyguard1 = this;this setVehicleVarName "convoyguard1";'; removeAllWeapons convoyguard1; convoyguard1 addmagazine "30Rnd_556x45_Stanag"; convoyguard1 addmagazine "30Rnd_556x45_Stanag"; convoyguard1 addmagazine "30Rnd_556x45_Stanag"; convoyguard1 addweapon "SCAR_L_CQC_Holo"; deleteVehicle convoyguard2; convoyguard2 = govconvoygroup createUnit ["US_Soldier_EP1", _pos, [], _radius, "FORM"]; convoyguard2 setvehicleinit 'convoyguard2 = this;this setVehicleVarName "convoyguard2";'; removeAllWeapons convoyguard2; convoyguard2 addmagazine "30Rnd_556x45_Stanag"; convoyguard2 addmagazine "30Rnd_556x45_Stanag"; convoyguard2 addmagazine "30Rnd_556x45_Stanag"; convoyguard2 addweapon "SCAR_L_CQC_Holo"; deleteVehicle convoyguard3; convoyguard3 = govconvoygroup createUnit ["US_Soldier_EP1", _pos, [], _radius, "FORM"]; convoyguard3 setvehicleinit 'convoyguard3 = this;this setVehicleVarName "convoyguard3";'; removeAllWeapons convoyguard3; convoyguard3 addmagazine "30Rnd_556x45_Stanag"; convoyguard3 addmagazine "30Rnd_556x45_Stanag"; convoyguard3 addmagazine "30Rnd_556x45_Stanag"; convoyguard3 addweapon "SCAR_L_CQC_Holo"; deleteVehicle convoyguard4; convoyguard4 = govconvoygroup createUnit ["US_Soldier_EP1", _pos, [], _radius, "FORM"]; convoyguard4 setvehicleinit 'convoyguard4 = this;this setVehicleVarName "convoyguard4";'; removeAllWeapons convoyguard4; convoyguard4 addmagazine "30Rnd_556x45_Stanag"; convoyguard4 addmagazine "30Rnd_556x45_Stanag"; convoyguard4 addmagazine "30Rnd_556x45_Stanag"; convoyguard4 addweapon "SCAR_L_CQC_Holo"; processInitCommands; deleteVehicle gpksoldier; gpksoldier = govconvoygroup createUnit ["US_Soldier_Officer_EP1", _pos, [], _radius, "FORM"]; gpksoldier setvehicleinit 'gpksoldier = this;this setVehicleVarName "gpksoldier";'; removeAllWeapons gpksoldier; gpksoldier addweapon "revolver_gold_EP1"; gpksoldier addmagazine "6Rnd_45ACP"; gpksoldier addmagazine "6Rnd_45ACP"; gpksoldier addmagazine "6Rnd_45ACP"; deleteVehicle gpksoldier1; gpksoldier1 = govconvoygroup createUnit ["US_Soldier_Officer_EP1", _pos, [], _radius, "FORM"]; gpksoldier1 setvehicleinit 'gpksoldier1 = this;this setVehicleVarName "gpksoldier1";'; removeAllWeapons gpksoldier; gpksoldier1 addweapon "revolver_gold_EP1"; gpksoldier1 addmagazine "6Rnd_45ACP"; gpksoldier1 addmagazine "6Rnd_45ACP"; gpksoldier1 addmagazine "6Rnd_45ACP"; deleteVehicle gpksoldier2; gpksoldier2 = govconvoygroup createUnit ["US_Soldier_Officer_EP1", _pos, [], _radius, "FORM"]; gpksoldier2 setvehicleinit 'gpksoldier2 = this;this setVehicleVarName "gpksoldier2";'; removeAllWeapons gpksoldier; gpksoldier2 addweapon "revolver_gold_EP1"; gpksoldier2 addmagazine "6Rnd_45ACP"; gpksoldier2 addmagazine "6Rnd_45ACP"; gpksoldier2 addmagazine "6Rnd_45ACP"; deleteVehicle gpksoldier3; gpksoldier3 = govconvoygroup createUnit ["US_Soldier_Officer_EP1", _pos, [], _radius, "FORM"]; gpksoldier3 setvehicleinit 'gpksoldier3 = this;this setVehicleVarName "gpksoldier3";'; removeAllWeapons gpksoldier; gpksoldier3 addweapon "revolver_gold_EP1"; gpksoldier3 addmagazine "6Rnd_45ACP"; gpksoldier3 addmagazine "6Rnd_45ACP"; gpksoldier3 addmagazine "6Rnd_45ACP"; processInitCommands; govconvoygroup selectLeader convoysoldier; convoysoldier moveInDriver convoytruck; convoysoldier assignAsDriver convoytruck; gpksoldier moveInDriver gpk; gpksoldier assignAsDriver gpk; //make guards follow convoysoldier convoyguard1 dofollow convoysoldier; convoyguard2 dofollow convoysoldier; convoyguard3 dofollow convoysoldier; convoyguard4 dofollow convoysoldier; govconvoygroup setbehaviour "AWARE"; govconvoygroup setCombatMode "GREEN"; //Make GPK guards follow driver gpksoldier1 doFollow gpksoldier; gpksoldier2 doFollow gpksoldier; gpksoldier3 doFollow gpksoldier; govconvoygroupgpk setbehaviour "AWARE"; govconvoygroupgpk setCombatMode "RED"; //put guards in car with convoysoldier convoyguard1 moveincargo convoytruck; convoyguard1 assignAsCargo convoytruck; convoyguard2 moveInCargo convoytruck; convoyguard2 assignAsCargo convoytruck; convoyguard3 moveInCargo convoytruck; convoyguard3 assignAsCargo convoytruck; convoyguard4 moveInCargo convoytruck; convoyguard4 assignAsCargo convoytruck; sleep 2; convoysoldier commandMove getpos copbase1; //put GPK guards in car with gpksoldier gpksoldier1 moveincargo gpk; gpksoldier1 assignAsCargo gpk; gpksoldier2 moveInGunner gpk; gpksoldier2 assignAsGunner gpk; gpksoldier3 moveInCargo gpk; gpksoldier3 assignAsCargo gpk; sleep 2; gpksoldier doFollow convoytruck; //start mission loop "server globalchat ""The supply truck has spawned. The police must defend it against bandits and terrorists!"";" call broadcast; while {true} do { "if(alive player and isciv and player distance convoytruck <= 150)then{titleText [""The Government is operating in this area! Turn back or you will be shot!"", ""plain down""]};" call broadcast; "convoy" setmarkerpos getpos convoytruck; if (!alive convoyguard1) then { deletevehicle convoyguard1; }; if (!moneyintruck) exitwith { _sidewon = "Bandits"; }; if (!alive convoyguard2) then { deletevehicle convoyguard2; }; if (!alive convoyguard3) then { deletevehicle convoyguard3; }; if (!alive convoyguard4) then { deletevehicle convoyguard4; }; if (!alive convoysoldier and !_added) then { _added = true; stealgovmoney = convoytruck addAction ["Steal Government salaries", "stealgovmoney.sqf",[""],1,false,true,"","isciv"]; "if (isciv) then {server sidechat ""The government convoy driver is dead. Steal the police paycheck."";};" call broadcast; "if (iscop) then {server sidechat ""The governemnt convoy driver is dead. Get in his truck and drive it to the Cop Base"";};" call broadcast; convoytruck setVehicleLock "unlocked"; unassignVehicle convoyguard1; unassignVehicle convoyguard2; unassignVehicle convoyguard3; unassignVehicle convoyguard4; convoyguard1 action ["eject", convoytruck]; convoyguard2 action ["eject", convoytruck]; convoyguard3 action ["eject", convoytruck]; convoyguard4 action ["eject", convoytruck]; convoyguard1 dofollow convoytruck; convoyguard2 dofollow convoytruck; convoyguard3 dofollow convoytruck; convoyguard4 dofollow convoytruck; }; if (_counter >= 15) then { convoysoldier commandMove getpos copbase1; _counter = 0; }; if (convoytruck distance copbase1 < 150) exitwith { "if (iscop) then {bankaccount = (bankaccount + govconvoybonus); player sidechat format[""you received $%1 for the successfully escorting the convoy"", govconvoybonus];};" call broadcast; _sidewon = "Cops"; }; if (_counter2 >= 900) exitwith { _sidewon = "Neither"; }; if (!alive convoytruck) exitwith { "server globalchat ""The government truck has been destroyed the money has burned"";" call broadcast; _sidewon = "Neither"; }; _counter2 = _counter2 + 1; _counter = _counter + 1; sleep 1; }; //mission has ended resetting vars and deleting units (format ['server globalChat "%2 side won the government convoy mission, next truck leaves in %1 minutes!";', convoyrespawntime, _sidewon]) call broadcast; [_sidewon] call whowon; deletevehicle convoyguard1; deletevehicle convoyguard2; deletevehicle convoyguard3; deletevehicle convoyguard4; deletevehicle convoysoldier; deletevehicle convoytruck; deletemarker "convoy"; _endmissionounter = 0; _counter = 0; _counter2 = 0; _sidewon = "Neither"; moneyintruck = true; _added = false; }; //written by Gman The second problem I'm having is that the GPK doesn't seem to detect my presence and open fire on me in fact I haven't even seen the AI rotate the GPKs gun which worries me. I'm pretty stuck here! Does anyone have any idea what the problems could be? Share this post Link to post Share on other sites
Joe98 92 Posted May 31, 2013 Make vehicle A the leader Group vehicle A and vehicle B Give waypoints to vehicle A Vehicle B will follow In the waypoints set the formation to column Share this post Link to post Share on other sites
sold67 10 Posted May 31, 2013 I'm not using the map to tell it where to drive to because it is a life mission, so no waypoints. I tried grouping them before and it still wasn't working, but I might have done it incorrectly I will try it again. Thanks for the help. Share this post Link to post Share on other sites