AI Air Patrols

How easily can this be implemented on a different map? Can I simply change these coordinates?

Code:
    //Create the helipads
  H_Cherno    = createVehicle ["HeliHRescue", [6829.689, 2786.207, 0], [], 0, "CAN_COLLIDE"];
  H_Electro = createVehicle ["HeliHRescue", [10370.874, 2349.9211, 0], [], 0, "CAN_COLLIDE"];
  H_NEAF    = createVehicle ["HeliHRescue", [12540.562, 12559.409, 0], [], 0, "CAN_COLLIDE"];
  H_NWAF    = createVehicle ["HeliHRescue", [4968.4971, 9500.4346, 0], [], 0, "CAN_COLLIDE"];
  H_BALOTA    = createVehicle ["HeliHRescue", [4730.28,2498.92,0], [], 0, "CAN_COLLIDE"];

Also what would I need to do with the coords in the init.sqf?
 
I'm calling the Chopper Patrol.sqf in my units\init.sqf. Because I'm testing this code on my own server, and deploying it on a friends' server, all of my stuff is within the units directory - I send him a new directory when I have an update to make.

As for the coordinates for a different map, I don't see why you couldn't change them - this is the easiest thing to do: open the map in an editor and place helipads where you want them to be, and save it. Open the saved mission.sqf that you just created. You'll see a bunch of lines that look like this:

Code:
[COLOR=#59739b][SIZE=13px]_vehicle_12 = objNull;
if (true) then
{
  _this = createVehicle ["HeliHRescue", [12540.562, 12559.409, -3.0517578e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_12 = _this;
  _this setVehicleVarName "H_NEAF";
  H_NEAF = _this;
  _this setPos [12540.562, 12559.409, -3.0517578e-005]; [/SIZE][/COLOR]
[SIZE=13px][COLOR=#59739b]};[/COLOR][/SIZE]

It's pretty clear how you can convert this to
Code:
H_NEAF= createVehicle ["HeliHEmpty", [12540.562, 12559.409, 0], [], 0, "CAN_COLLIDE"];

The coords that are passed from the init are just where the chopper and troops are created. I'd place it out of the way near your first waypoint. When the server starts, it takes the troops maybe 60 seconds to spawn, file into the chopper and lift off - it'll happen before any players log in on a public server.

Because of that 0,0 waypoint bug, I'd start your patrol near the bottom left corner of the map, and place your waypoints starting there. I'll take a look at the 0,0 waypoint bug and release an update when I can.
 
Should i to declare all scripts like this VehicleRearm.sqf , NPC_AngryZombies.sqf,NPC_AlertZombies.sqf or only Chopper Patrol.sqf in init.sqf file?
You need to call only chopper patrol from your init. The other files need to have a solider or a vehicle passed to them, so they need to be called within the chopper patrol.sqf. You can see that they're referencing soldiers / chopper as they're created.

The angry/alertzombies are some sad hacks I threw together to get zombies to be attracted to AI like they are to players, but it's an ugly kludge. Now that I have a v1.0 of a chopper patrol, I need to revisit these. I have another kludge to get zombies to kill AI troops, but it also is a sad hack.
 
I had to disable the code in my server overhead that destroyed vehicles that it didn't find in the database. As I've never used SQL before, I'm at a loss as to how to prevent this while still preventing hackers from injecting vehicles. I may have to add some code where it checks for vehicles that are public variables or something. Not sure yet.
use a setvariable "createdbyOrc",1, and check for that condition in the server_cleanup.fsm.

That's how i do it with my spawned in vehicles. The server still kills vehicles when players get near them (no impact for my solution, helis never land there), but if yours do, you might want to look into the logic there and check if your variable is set for that vehicle before letting the server logic delete it.

Sarge
 
use a setvariable "createdbyOrc",1, and check for that condition in the server_cleanup.fsm.

That's how i do it with my spawned in vehicles. The server still kills vehicles when players get near them (no impact for my solution, helis never land there), but if yours do, you might want to look into the logic there and check if your variable is set for that vehicle before letting the server logic delete it.

Sarge
Thanks! I'll look into that tonight!

We haven't had any problems with hackers spawning vehicles, because I think they assume they can't (or if they could, they could regardless of the normal protections). But I don't want them to figure out that they can and then go nuts.

I'd really like to look at your chopper code too - I've had some issues with NPC bandits shooting down the chopper (LOL!), so I think I'm going to spawn some soldier-filled cobras or hueys that protect the transport chopper and never land.
 
firste beta release to come this evening. Seems some people were already investigative enough to find it anyhow :)
 
What happens if people shoot at the air patrol?
Right now, they're behaving like normal AI troops - you can get away with killing one of them; after that they'll all turn on you. There are definitely some bugs though (in the basic ARMA setup). They don't seem to care if you run them over.

I have attached some hit/killed event handlers to them to try and deal with this, but it's not really working ATM - I need to put some more time into it.

What I'll probably do is somehow change the player side if you hit/damage the vehicle or solider with a joinSilent command.
 
I think this is what you're looking for. This "should" allow you to get into the vehicle without the server killing it.

Code:
  class check_for_hacker
    {
      name = "check_for_hacker";
      init = /*%FSM<STATEINIT""">*/"//Check for hackers" \n
      " {" \n
      "//    if(vehicle _x != _x) then {" \n
      "//        if  (!(vehicle _x in _safety) && ((typeOf vehicle _x) != ""ParachuteWest"")) then {" \n
      "//            diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
      "//            (vehicle _x) setDamage 1;" \n
      "//            _x setDamage 1;" \n
      "//        };" \n
      "//    };" \n
      " } forEach allUnits;" \n

that code should allow you to spawn the helicopters and allow players to enter them.
That code is from the server_cleanup.fsm in dayz_server\system.
Look for class check_for_hacker and comment out like the above example.

Take a look at
http://opendayz.net/index.php?threa...created-vehicles-to-the-db-almost.7341/page-2
Axeman might be able to help with that part.
 
don't do that, as i mentioned a lot of times before. By this you allow any hacker to spawn in vehicles ...
 
Hackers who know anything have bypassers, sadly. This is something I have been tossing around...just remove the whole thing....or keep letting it hassle me while hackers fuck shit up anyways.
 
I commented out that cleanup part - cuz it was making them blow up I think.
Feedback / questions:
why do the 2 helis spawn literally ontop of each other? And they aren't shooting zombies atm. Also - the 2 helis crashed into each other while trying to land in a very open space :(
 
I commented out that cleanup part - cuz it was making them blow up I think.
Feedback / questions:
why do the 2 helis spawn literally ontop of each other? And they aren't shooting zombies atm. Also - the 2 helis crashed into each other while trying to land in a very open space :(
? There shouldn't be two helis - are you calling the script twice?
 
Hackers who know anything have bypassers, sadly. This is something I have been tossing around...just remove the whole thing....or keep letting it hassle me while hackers fuck shit up anyways.
I've played with self-admited hackers, and afaik they can't inject vehicles. I knew one guy who could repair them and inject gear, but the server doesn't cross reference the database for gear like it does vehicles, because they actually exist as world table entries and vehicle instances; items don't.
 
I commented out that cleanup part - cuz it was making them blow up I think.
Feedback / questions:
why do the 2 helis spawn literally ontop of each other? And they aren't shooting zombies atm. Also - the 2 helis crashed into each other while trying to land in a very open space :(

If you want them to shoot at zombies, use my init file (it's not the main init, it's CALLED by the main init) with my zombie_generate - it's from Axeman's post about adding AI units.

Or you can just paste it in one of your own inits somewhere - this is the relevant code to get the soldiers on the right faction.

Code:
//units\init.sqf
 
waitUntil{initialized};
//0Day    
createCenter east;
createCenter resistance;
 
//Survivors 
WEST setFriend [RESISTANCE,1];
WEST setFriend [EAST,0];
//WEST setFriend [CIVILIAN,0];
 
//Bandits
EAST setFriend [RESISTANCE,0];
EAST setFriend [WEST,0];
EAST setFriend [CIVILIAN,0];
 
 
//AI Units
RESISTANCE setFriend [WEST,1];
RESISTANCE setFriend [EAST,0];
RESISTANCE setFriend [CIVILIAN,0];
 
 
//Make AI hate zombies
diag_log format ["Running zombie_generate"];
zombie_generate = compile preprocessFileLineNumbers "units\zombie_generate.sqf";
diag_log format ["Zombie generate complete"];

And you also need to call that zombie generate file that you can see at the bottom. This is all from axeman's original post about adding AI to the game.
 

Attachments

  • zombie_generate.sqf
    3 KB · Views: 11
First off, really great job with this script works great but there are a few bugs that i have noticed but not 100% sure of the root cause yet but i think everything is leading back to the fsm. Anyways only calling the script once but it seems to be spawning 4 helicopters at server start, which i am ok with, it's kinda cool watching them all take off >.<

The main issue is shooting the helicopters, have you shoot the helicopter it will instantly disappear, now i am not 100% sure but i would assume it's the fsm killing it which is odd because i have commented it out. Is there a way too make the AI a little bit more aggressive, Currently if u shoot at them they sit around and just look at you. Would be nice to have them shoot back or even engage bandits only depending on the person humanity.
 
I was able to look at some of Sarge's excellent code last night, so I'm going to try and update it today to make it more stable. Not sure about the 4 chopper thing; that's very odd - I've never seen it do that on my server, but I'll take a second look. I'll probably update the scripts today.
 
Back
Top