dayZ (arma) AI Controlled Bus Route.

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:

Code:
//All rights reserved Andrew Gregory aka axeman [email protected]
    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;
 
You can stop the bus stopping at bus stops by removing the line with setwayPointTimeout. Messaging is being worked on with one of the new branches. I would assume you want messages to the passengers not every player on the server every time the bus moves down the road ?

Actually, I was looking for a server wide message, just so people know where it's at. Maybe not for each and every little place, but at least for major land marks, like Kamenka (the end of the road), Cherno, Elektro and when it reaches whatever the name is of the town it starts in.
 
@NeverUsedID: The problem with the messages, do you need to ask the client to wait for the publicvariable BusMessage before calling the message script ? Also interested in how the public variables are working out ?

At the end of this we should have an awesome bus service :)

Hi,
iam not sure what you mean.

First of all: we fixed the problem with the messages shown not up on our Server. We need to compile a new dayz_server.pbo with bliss/reality perlfiles and build.pl with switches --messages and --killmsgs. After that the messages are working fine.

I dont know if we need to check if the publicvariable is set, but i think with this way we can be sure that all works fine even if the variable is undefined. I will ask Wofu to join the forum he knows much more about coding.

I try to explain how i understand this:
The Serverpart of the script is changing the public variable tourbusses (array) and addPublicVariableEventHandler will recognize all changes and execute the script onMessageReceived.sqf when a change occurs. "BusMessage" addPublicVariableEventHandler will transfer two values from server to the client: variable name and variable value. That the only way we know to transfer values from a variable on the server to a variable on clientside.

@stealth: all your _waypoint arrays have the same name. You need to change it. f.e. _waypoints1, _waypoints2 and then you need to change the code that every bus takes another waypointarray.

badly coded: you can make this inside for [{_iX = 0}, {_iX < _bussesToSpawn}, {_iX = _iX + 1}] do :

if (_iX == 1) then
for [{_jX = 0}, {_jX <= (count _waypoints1)}, {_jX = _jX + 1}] do
{

....

if (_iX == 2) then
for [{_jX = 0}, {_jX <= (count _waypoints2)}, {_jX = _jX + 1}] do

{
....
the should be a better way to code that, dont know if arma knows 3d arrays for example.
Next steps (if we have the time):
1. Splitt the route in 3 parts, so theta the busses dont need to drive trough the big town (to prevent stops at zombies a little bit.
2. add a way to get informations about the buses positions.
a. if a player has a radio he can ask via 0-0-0 radiocommand where the next stop is. Or via dropdown menu at a busstop ( I think that's the better way. Maybe we add both ;))
 
NeverUsedID,
Thankyou for that advice, On another note I have myself a Chernarus test server now as Ovaron has some cool gear deleting bugs, so considering coming back to Chernarus, So added you bus script straight in but for some reason I can still damage/destroy bus and kill driver, is the a fix for this yet?
 
NeverUsedID,
Thankyou for that advice, On another note I have myself a Chernarus test server now as Ovaron has some cool gear deleting bugs, so considering coming back to Chernarus, So added you bus script straight in but for some reason I can still damage/destroy bus and kill driver, is the a fix for this yet?

No, we Never had Problems with that invulnerable Code. Make sure that you have the latest arma2 Beta on our server
 
Hi all.

Since i added sarge ai bus stays at berezino and respawns up to more than 12 buses and so on,while the driver is spawning all the time and walks up to kamenka and his mate stays in bus .btw the spawn of the first or second bus is badly ,spawning in a house or zaun
I would prefer to keep both scripts ,is this possible to get it run with sarge ai or is this incompatible to your bus ai ?

Cheers fox

Ive some videos about this ,if u wish i can upload it....

send from my Galaxy S2 using tapatalk


Axeman keep up the good work !
 
Hi all.

Since i added sarge ai bus stays at berezino and respawns up to more than 12 buses and so on,while the driver is spawning all the time and walks up to kamenka and his mate stays in bus .btw the spawn of the first or second bus is badly ,spawning in a house or zaun
I would prefer to keep both scripts ,is this possible to get it run with sarge ai or is this incompatible to your bus ai ?

Cheers fox

Ive some videos about this ,if u wish i can upload it....

send from my Galaxy S2 using tapatalk


Axeman keep up the good work !

Sry, id never used sarge AI, so i dont know any about that.
 
Maybe this is stupid, but do I need to add a bus spawn for this to work or does it spawn its own bus? Added the script in, followed directions to a T, but not seeing a bus after a restart. I'll double check everything when I get home to make sure i didn't miss anything but the install is so easy I doubt I did.
 
Maybe this is stupid, but do I need to add a bus spawn for this to work or does it spawn its own bus? Added the script in, followed directions to a T, but not seeing a bus after a restart. I'll double check everything when I get home to make sure i didn't miss anything but the install is so easy I doubt I did.
The bus spawns on its own. To test the code, follow the instructions in your own mission (not a DayZ one), place a player at the end of the road in Berezino, and wait a bit. You should see a man behind the gate, and then a bus soon after.
 
Where and how do I change the loadout for the AI retaliation squad? Player are purposely killing the bus driver so they can then kill the AI squad for the good loot!

Also, do the AI squad only target the killer of the driver? Or will they carry on attacking anybody in the vicinity?
 
in short:

1. search the files for nvgoggles. (the reason why we disabled the ai. There is a hidebody or remove loot after kill needed)
2. AI attacks everybody
 
Ah, thanks, would be even better if they can't be looted at all :)
Don't think that is possible but as neverusedId says you can add on on killed eventhandler to remove all weapons and inventory then remove the body.

For multiple buses spawning, would guess that each player joining is spawning a new bus ? I hadn't found that in testing. Or sarge's Ai are killing the bus causing another to re spawn and the original bus is healing itself. ?
 
Well thanx BattlEye for the update, now my bus route gets me kicked all the time and for the life of me I cannot find the relevant line to change so my server works.
 
A couple but most times #20, I have also seen #8 but think that was to do with one of the other mods so I started with a clean mission file and added bus only, made appropriate BattlEye script.txt adjustments but kept getting kicked on script restriction #20, Tested with a real old battleye file and got in no problems, but the file has been heacvily modified for teasting and it is a bit like running your server with battleye off which I DO NOT want to do.
 
Okay, it looks like it has to do with waypoints. Look around line 15-25 in your scritpt.txt and look for something with 5 in front and with waypoint in the name. "5 addwaypoint" f.e.. Change the 5 to 1 and Test again. This will activate logging, but disable kick. Its quick and dirty but should work. You can place directly after 5 addwaypoint (just an example) !"busroute\scriptNAMEwith_iWpStartInBody" to only allow the busscript to do that. Then you dont need to change 5 to 1.
 
Back
Top