AI mission spawned vehicles explode?

Martin Jensen

New Member
Hello

I have problems with AI missions and server_cleanup.fsm on my server.

When some enters one of the vehicles spawn at mission marker then it explodes..

I tried this fix:

http://opendayz.net/threads/dayz-1-8-phoenix-mods-admin-tools.13971/#post-73614

but I'm getting errors in my log, which i also got when trying to add admin tools and resulted in all car are reset on server restart...

Code:
23:52:42 File z\addons\dayz_server\system\server_cleanup.fsm, line 293: '/FSM/States/general_cleanup.init': Missing ';' at the end of line
23:52:42 Error context ,0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=
23:52:42 Warning Message: File z\addons\dayz_server\system\server_cleanup.fsm, line 293: '/FSM/States/general_cleanup.Sarge': '"' encountered instead of '='
23:52:42 Warning Message: Config : some input after EndOfFile.

Using: Pwnoz0r's DayZ 1.8.0.3 Private Server Pack

I have not found a solution yet, and really want missions and admin tools working..

Can anyone help me please?
 
Sure, here you go:

Code:
"//Check for hackers" \n
      " {" \n
      "      if(vehicle _x != _x && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=
      "        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
      " } forEach allUnits;" \n
      "" \n


And getting this in arma2oaserver.RPT when above script added:

Code:
Error context ,0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=
9:35:04 Warning Message: File z\addons\dayz_server\system\server_cleanup.fsm, line 293: '/FSM/States/general_cleanup.Sarge': '"' encountered instead of '='
9:35:04 Warning Message: Config : some input after EndOfFile.

I have no idea how to correct it..
 
I may have solved the problem..

Was searching and trying a few of the hacker fix scripts on the forum and found one that seems to work with my dayz:

Code:
"//Check for hackers" \n
      " //{" \n
      " //if(vehicle _x != _x && !(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 0.2;" \n
      " //_x setDamage 0.2;" \n
      " //};" \n

Don't see the errors in the log anymore, when I start and join the server.. Just need to see what happens, when entering spawned vehicle..

Anyone knows if spawned vehicle from AI missions are saved on server restart??
 
Searching some more, I found out the fix above may not be working and teleports vehicles when restart..

Think i need i make something like this:

http://opendayz.net/threads/bliss-saving-newly-created-vehicles-to-the-db-almost.7341/#post-14622

I've changed the files like this:

server_cleanup.sqf:

Code:
"//Check for hackers" \n
      " //{" \n
      " //if(vehicle _x != _x && !(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 0.2;" \n
      " //_x setDamage 0.2;" \n
      " //};" \n
      " //} forEach allUnits;" \n

fnc_saveVehicle.sqf

Code:
private ["_targetObj","_targetClass","_targetPos","_saveWorldVehicleID","_instanceVehicleID","_key","_data","_result","_status","_count"];
_targetObj = _this;
_targetClass = typeOf _targetObj;
_targetPos = getPos _targetObj;
 
_saveWorldVehicleID = 0;
_instanceVehicleID = 0;
 
diag_log("xSAVE: Attempting to save "+ str(_targetClass)+" at "+str(_targetPos));
 
//Wait for HIVE to be free
waitUntil{!hiveInUse};
hiveInUse = true;
//Send request
_key = format["CHILD:999:select world_vehicle.id from world_vehicle, vehicle where vehicle.id = world_vehicle.vehicle_id and vehicle.class_name = '?' and world_vehicle.world_id = '%2' LIMIT 1:[""%1""]:", _targetClass,1];
diag_log ("xSAVE: Query: " + str(_key));
_data = "HiveEXT" callExtension _key;
sleep 0.1;
hiveInUse = false;
//Release HIVE
_result = call compile format ["%1", _data];
diag_log ("xSAVE: STATUS: " + str(_result));
    _status = _result select 0;
    if (_status == "CustomStreamStart") then {
        _count = _result select 1; //Number of Rows
        waitUntil{!hiveInUse};
        hiveInUse = true;
            for "_i" from 1 to _count do {
            //Loop though the results
                diag_log ("xSAVE: Retreving World Vehicle ID with:  " + str(_key));
                _data = "HiveEXT" callExtension _key;
                _result = call compile format ["%1", _data];
                _saveWorldVehicleID = _result select 0;
            };
            sleep 0.1;
        hiveInUse = false;
 
        diag_log ("xSAVE: Found world_vehicle.id: " + str(_saveWorldVehicleID));
            //Now we have the world vehicle id, we can save this to the database
            if (_saveWorldVehicleID > 0 ) then {
                waitUntil{!hiveInUse};
                hiveInUse = true;
                _key = format["CHILD:999:INSERT INTO `instance_vehicle`(`world_vehicle_id`,`last_updated`, `created`) VALUES ('?','CURRENT_TIMESTAMP','CURRENT_TIMESTAMP'):[%1]:",_saveWorldVehicleID];
                diag_log ("xSAVE: Attempting to write to hive with:  " + str(_key));
                _data = "HiveEXT" callExtension _key;
                _result = call compile format ["%1", _data];
                diag_log ("xSAVE: STATUS: " + str(_result));
                sleep 0.1;
                _key = format["CHILD:999:SELECT `id` FROM `instance_vehicle` WHERE `world_vehicle_id`='?' ORDER BY `id` DESC LIMIT 1:[%1]:",_saveWorldVehicleID];
                _data = "HiveEXT" callExtension _key;
                sleep 0.1;
                hiveInUse = false;
 
                _result = call compile format ["%1", _data];
                diag_log ("xSAVE: STATUS: " + str(_result));
                _status = _result select 0;
                if (_status == "CustomStreamStart") then {
                _count = _result select 1;
 
                    waitUntil{!hiveInUse};
                    hiveInUse = true;
                    for "_i" from 1 to _count do {
                    _data = "HiveEXT" callExtension _key;
                    _result = call compile format ["%1", _data];
                    diag_log ("Vehicle ID Result" + str(_result));
                    _instanceVehicleID = _result select 0;
                    };
                    sleep 0.1;
                    hiveInUse = false;
                };
 
                _targetObj setVariable ["lastUpdate",time];
                _targetObj setVariable ["ObjectID", str(_instanceVehicleID), true];
                _targetObj setVariable ["CharacterID", "0", true];
                _targetObj setVariable ["ObjectUID", "0", true];
 
                _hitpoints = _targetObj call vehicle_getHitpoints;
                _dam = 0.01;
                _targetObj setFuel 1;
                {
                    _selection = getText(configFile >> "cfgVehicles" >> typeOf _targetObj >> "HitPoints" >> _x >> "name");
                    [_targetObj,_selection,_dam] call object_setFixServer;
                } forEach _hitpoints;
                _targetObj call fnc_vehicleEventHandler;
                dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_targetObj];
                [_targetObj,"all"] call server_updateObject;
            };
            //End Save
    };

server_functions.sqf

add here near the top

Code:
server_sendToClient =        compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_sendToClient.sqf";
server_Wildgenerate =        compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\zombie_Wildgenerate.sqf";
server_plantSpawner =        compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_plantSpawner.sqf";
 
//Xyberviri Functions
server_saveVehicle =    compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fnc_saveVehicle.sqf"; //Saves _this Vehicle to the instance_vehicle if it has a valid world id.
"dayzSaveVehicle" addPublicVariableEventHandler {_id = (_this select 1) spawn server_saveVehicle};  //This is a event handler to call this function from client side
 
spawnComposition = compile preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"; //"\z\addons\dayz_code\compile\object_mapper.sqf";
fn_bases = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fn_bases.sqf";

But now I'm stuck.. What do I else need to change?

I don't get any errors now.. But I think I need to change something in MySQL, but don't know what..
 
All you had to change was this line
Code:
      "      if(vehicle _x != _x && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=

To be
Code:
      "      if(vehicle _x != _x && (vehicle _x getVariable ["Mission",0] != 1) && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=
 
Commenting out the "check for hacker" script works on exploding vehicles. But I will try your fix also..

The problem i have now is that AI spawned cars are deleted on restart..

Some way i can save it, or inform the players that the car is only temporary..

//Edit

When added the script you posted i get error:

Code:
9:35:29 File z\addons\dayz_server\system\server_cleanup.fsm, line 293: '/FSM/States/general_cleanup.init': Missing ';' at the end of line
9:35:29 Error context ,0] != 1) && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=
9:35:29 Warning Message: File z\addons\dayz_server\system\server_cleanup.fsm, line 293: '/FSM/States/general_cleanup.Mission': '"' encountered instead of '='
9:35:29 Warning Message: Config : some input after EndOfFile.
 
What that code does is checks if its a valid hive vehicle, and if not it kills whoever gets in it. If you comment this out, a hacker could spawn in a tank and drive it around with mostly no issues.
 
Replaced the file with default and made the change you mentioned:

Code:
"//Check for hackers" \n
      " {" \n
      "      if(vehicle _x != _x && (vehicle _x getVariable ["Mission",0] != 1) && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=
      "        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
      " } forEach allUnits;" \n

But I'm still getting:

Code:
File z\addons\dayz_server\system\server_cleanup.fsm, line 293: '/FSM/States/general_cleanup.init': Missing ';' at the end of line
11:52:54 Error context ,0] != 1) && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=
11:52:54 Warning Message: File z\addons\dayz_server\system\server_cleanup.fsm, line 293: '/FSM/States/general_cleanup.Mission': '"' encountered instead of '='
11:52:54 Warning Message: Config : some input after EndOfFile.
 
I don't believe that line is the default line.

Get a clean copy of your server_cleanup.fsm from your host and copy that code block.
 
OKay I've downloaded Pwnoz0r/DayZ-Private-Server again

Here is the default script:

Code:
      "//Check for hackers" \n
      " {" \n
      "      if(vehicle _x != _x && !(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
      " } forEach allUnits;" \n

The whole file:
http://pastebin.com/aZgS8qnZ

And with the change you mentioned:

Code:
       "//Check for hackers" \n
       " {" \n
       "  if(vehicle _x != _x && (vehicle _x getVariable ["Mission",0] != 1) && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=
       "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
       " } forEach allUnits;" \n


And the error from the log:

Code:
12:24:32 File z\addons\dayz_server\system\server_cleanup.fsm, line 293: '/FSM/States/general_cleanup.init': Missing ';' at the end of line
12:24:32 Error context ,0] != 1) && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=
12:24:32 Warning Message: File z\addons\dayz_server\system\server_cleanup.fsm, line 293: '/FSM/States/general_cleanup.Mission': '"' encountered instead of '='
12:24:32 Warning Message: Config : some input after EndOfFile.

I'm starting to get frustrated now.. Anyone got a working copy of the file?
 
The correct line is
Code:
      "      if(vehicle _x != _x && (vehicle _x getVariable ["Mission",0] != 1) && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n

As I said the line you gave me originally was an incorrect line.
 
Here is the code I've added:

Code:
"//Check for hackers" \n
      " {" \n
      "      if(vehicle _x != _x && (vehicle _x getVariable ["Mission",0] != 1) && (vehicle _x getVariable ["Sarge",0] != 1) && !(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
      " } forEach allUnits;" \n
      "" \n

And it seems to work.. No errors in log.. Thanks Vampire!


What about the AI spawned vehicles is it possible to save them to DB, or somehow make the scroll menu colors different on them.. So my players knows that the car is not saved on restarts..

I know that I would be pissed to find a car and fill it with loot, just to get deleted on restart..

I did find this topic:
http://opendayz.net/threads/bliss-saving-newly-created-vehicles-to-the-db-almost.7341/#post-14622

I've made the files. But I'm lost on how to setup MySQL to save it..
 
I'm not sure about that unless you change the files to actually spawn in the vehicles hived.

But then again, do you really want that many UAZ's and Humvees sitting around?

Imagine every mission that runs, even if its just 6 missions per day, thats 12 vehicles roughly that even if they weren't taken are now sitting where a mission had spawned in once.
 
Yeah, that would be a problem..

What about using the save vehicle function, can it be modified to add it DB if not existing?

Otherwise the only solution i can think of, is to inform the players using my welcome message script.. But the problem is, if someone takes a car a leaves a other place.. Then they have no way of telling if it's DB spawned or mission spawned..
 
You could maybe add a check that if the object has no characterID it warns them.

Something like this should work when called from the init.sqf

Code:
while (true) do {
    waitUntil {vehicle player != player};
    _pVehicle = vehicle player;
    if (_pVehicle getVariable "Mission" == 1) then {
        cutText [format["This is a mission vehicle that will despawn on restart!"], "PLAIN DOWN"];
        sleep 5;
        cutText [format["You have been warned. Your loss if you leave anything inside it!"], "PLAIN DOWN"];
    };
    waitUntil {vehicle player = player};
};

It first waits for the player to enter a vehicle, when it does it checks their vehicle to see if it is a mission vehicle. If it is, it gives them a warning. It then waits for them to exit the vehicle before waiting for them to enter a vehicle again.
 
Awesome, that would differently solve my problems..

But when trying out the script on my test server i get this error:

Code:
12:19:01 "PRELOAD_ Functions\init [[<No group>:0 (FunctionsManager)],any]"
12:19:01 "MPframework inited"
12:19:01 Error in expression <IN DOWN"];
};
waitUntil {vehicle player = player};
};>
12:19:01  Error position: <= player};
};>
12:19:01  Error Missing ;
12:19:01 File mpmissions\dayz_1.Chernarus\init.sqf, line 227
12:19:01 Error in expression <IN DOWN"];
};
waitUntil {vehicle player = player};
};>
12:19:01  Error position: <= player};
};>
12:19:01  Error Missing ;
12:19:01 File mpmissions\dayz_1.Chernarus\init.sqf, line 227
12:19:02 Error in expression <stom\radioChatter\radioChatter.sqf"};
 
 
while (true) do {
waitUntil {vehicle pla>
12:19:02  Error position: <while (true) do {
waitUntil {vehicle pla>
12:19:02  Error while: Type Bool, expected code
12:19:02 File mpmissions\dayz_1.Chernarus\init.sqf, line 219


Perhaps not inserted correctly in my init.sqf?

here is my init.sqf with the script at the bottom: http://pastebin.com/DsfPL0uL

And thanks Vampire, for take your time helping me with this..
 
Back
Top