HNSC General Gavin
New Member
Got the scripts working, but driver's seat is still unlocked and if I go into it, the AI just sit in the back.
I did not change the lockDriver line, and I was told that it works only 3 posts ago.
My busdriver script:
I did not change the lockDriver line, and I was told that it works only 3 posts ago.
My busdriver script:
Code:
//All rights reserved Andrew Gregory aka axeman axeman@thefreezer.co.uk
private["_vehlocked","_dir","_axWPZ","axBusGroup","axBuspawnpos","_unitpos","_spawnAIDriver","_rndLOut","_ailoadout","axBusWP","_getinWP","axBusWPradius","axBusFirstWayPoint","axBusRouteWaypoints","axBusWPIndex","_driverKilled","_lookforsurvivors"];
busUnit = objNull;
axBusGroup = createGroup resistance;
axBuspawnpos = [13128.2,10381.9,0];
_unitpos = [13125.2,10416,0];
axBusWPradius = 2;//waypoint radius
axDriversMate = objNull;
axDriver = objNull;
//Load Bus Route
_axWPZ=0;
axBusWPIndex = 2;
axBusFirstWayPoint = [13101.4,10339.1,_axWPZ];
axBusWP = axBusGroup addWaypoint [axBusFirstWayPoint, axBusWPradius,axBusWPIndex];
axBusWP setWaypointType "MOVE";
//Create waypoints
axBusRouteWaypoints = [[12984,8362.67,_axWPZ],[13279.1,6991.32,_axWPZ],[13464.2,6255.24,_axWPZ],[13386.8,5405.25,_axWPZ],[12025.6,3481.76,_axWPZ],[10504.4,2324.99,_axWPZ],[10321.8,2149.75,_axWPZ],[10028,2071.8,_axWPZ],[9503.53,2028.21,_axWPZ],[6587.65,2884.59,_axWPZ],[6354.47,2452.24,_axWPZ],[4565.79,2432.13,_axWPZ],[1907.21,2240.25,_axWPZ],[1689.06,2209.53,_axWPZ],[1845.55,2219.14,_axWPZ],[1940.8,2255.24,_axWPZ],[3559.56,2448.9,_axWPZ],[4541.37,2443.16,_axWPZ],[5816.09,2167.39,_axWPZ],[6408.19,2685.99,_axWPZ],[6570.5,2877.59,_axWPZ],[9945.28,2049.85,_axWPZ],[10283.4,2146.71,_axWPZ],[10389.4,2221.85,_axWPZ],[10498.9,2320.29,_axWPZ],[10888.2,2772.58,_axWPZ],[12025.9,3485.04,_axWPZ],[13005.9,3816.02,_axWPZ],[13451.5,6211.28,_axWPZ],[13419.9,6557.19,_axWPZ],[13287.7,6961.19,_axWPZ],[12930.4,10133,_axWPZ]];
{
axBusWPIndex=axBusWPIndex+1;
axBusWP = axBusGroup addWaypoint [_x, axBusWPradius,axBusWPIndex];
axBusWP setWaypointType "MOVE";
axBusWP setWaypointTimeout [10, 15, 20];//thanks orcthrasher :)
diag_log format ["BUS:Waypoint Added: %2 at %1",_x,axBusWP];
} forEach axBusRouteWaypoints;
//Create Loop Waypoint
axBusWP = axBusGroup addWaypoint [axBusFirstWayPoint, axBusWPradius,axBusWPIndex+1];
axBusWP setWaypointType "CYCLE";
//Create Bus
//axBus = ["","","",["Ikarus",axBuspawnpos]] execVM "vehicle\createaxBusicle.sqf";
_dir = 244;
axBus = "Ikarus" createVehicle axBuspawnpos;
axBus setDir _dir;
axBus setPos getPos axBus;
//_hitpoints = axBus call vehicle_getHitpoints;
_dam = 0;
axBus setFuel 1;
axBus allowDammage false;
axBus addEventHandler ["HandleDamage", {false}];
_vehlocked = locked axBus;
//diag_log format ["BUS: Vehicle Spawn Attempted: %1 is Locked:%2",axBus,_vehlocked];
//Create Driver and Drivers Mate
for [{ x=1 },{ x <3 },{ x = x + 1; }] do {
_rndLOut=floor(random 3);
_ailoadout=
switch (_rndLOut) do
{
case 0: {["AK_47_M","30Rnd_762x39_AK47"]};
case 1: {["M4A1_AIM_SD_camo","30Rnd_556x45_StanagSD"]};
case 2: {["M1014","8Rnd_B_Beneli_74Slug"]};
};
"Functionary1" createUnit [_unitpos, axBusGroup, "busUnit=this;",0.6,"Private"];
busUnit enableAI "TARGET";
busUnit enableAI "AUTOTARGET";
busUnit enableAI "MOVE";
busUnit enableAI "ANIM";
busUnit enableAI "FSM";
busUnit allowDammage false;
busUnit addEventHandler ["HandleDamage", {false}];
busUnit setCombatMode "GREEN";
busUnit setBehaviour "CARELESS";
//clear default weapons / ammo
removeAllWeapons busUnit;
//add random selection
_aiwep = _ailoadout select 0;
_aiammo = _ailoadout select 1;
busUnit addweapon _aiwep;
busUnit addMagazine _aiammo;
busUnit addMagazine _aiammo;
busUnit addMagazine _aiammo;
//set skills
busUnit setSkill ["aimingAccuracy",1];
busUnit setSkill ["aimingShake",1];
busUnit setSkill ["aimingSpeed",1];
busUnit setSkill ["endurance",1];
busUnit setSkill ["spotDistance",0.6];
busUnit setSkill ["spotTime",1];
busUnit setSkill ["courage",1];
busUnit setSkill ["reloadSpeed",1];
busUnit setSkill ["commanding",1];
busUnit setSkill ["general",1];
if(x==1)then{
busUnit assignAsCargo axBus;
busUnit moveInCargo axBus;
_mateKilled = busUnit addEventHandler ["killed", {_this+[axBus,axBusGroup] execVM "busroute\crewKilled.sqf"}];
}
else{
axBusGroup selectLeader busUnit;
axDriver = busUnit;
//busUnit addEventHandler ["init", {_this execVM "busroute\driverMonitor.sqf"}];//Testing
_driverKilled = busUnit addEventHandler ["killed", {_this+[axBus,axBusGroup] execVM "busroute\crewKilled.sqf"}];
axBus addEventHandler ["engine", {_this execVM "busroute\monitorBus.sqf"}];
sleep 16;
busUnit assignAsDriver axBus;
//busUnit action ["GetInDriver", axBus];
busUnit moveInDriver axBus;
//busUnit moveInCargo axBus;//For Testing
};
};
axBus lockDriver true;