Vehicles doesn't respawn on restart

Elc0m

New Member
I have a problem, when I destroy a vehicles it doesn't respawn to it's spawn point on restart. Do I need some custom script or something like that to make them respawn on restart?
 
I am also trying to get this fixed.. Is pMain suppose to automatically delete damaged vehicles AND respawn them back at their original spawn location?
 
pMain routine controls vehicle spawns.

You need to run it every restart to spawn new vehicles. Either schedule it as a service in mysql or run it with your startup batch file.

BEGIN

# maximum number of INSTANCE id's USED.
#-----------------------------------------------
DECLARE sInstance VARCHAR(8) DEFAULT i;
#-----------------------------------------------
#maximum number of vehicles allowed !!! theoretical max. amount
#-----------------------------------------------
DECLARE iVehSpawnMax INT DEFAULT 85;
#-----------------------------------------------

# DECLARE iVehSpawnMin INT DEFAULT 0; #ToDo !!!
DECLARE iTimeoutMax INT DEFAULT 250; #number of loops before timeout
DECLARE iTimeout INT DEFAULT 0; #internal counter for loops done; used to prevent infinite loops - DO NOT CHANGE
DECLARE iNumVehExisting INT DEFAULT 0; #internal counter for already existing vehicles - DO NOT CHANGE
DECLARE iNumClassExisting INT DEFAULT 0; #internal counter for already existing class types - DO NOT CHANGE
DECLARE i INT DEFAULT 1; #internal counter for vehicles spawns - DO NOT CHANGE

#Starts Cleanup
CALL pCleanup();

SELECT COUNT(*) #retrieve the amount of already spawned vehicles...
INTO iNumVehExisting
FROM Object_DATA
WHERE Instance = sInstance
AND Classname != '-' #exclude dummys
AND Classname != 'Hedgehog_DZ' #exclude hedgehog
AND Classname != 'Wire_cat1' #exclude wirecat
AND Classname != 'Sandbag1_DZ' #exclude Sanbag
AND Classname != 'BearTrap_DZ' #exclude BearTrap_DZ
AND Classname != 'TrapBearTrapFlare' #exclude TrapBearTrapFlare
AND Classname != 'TrapBearTrapSmoke' #exclude TrapBearTrapSmoke
AND Classname != 'Trap_Cans' #exclude Trap_Cans
AND Classname != 'TrapTripwireGrenade' #exclude TrapTripwireGrenade
AND Classname != 'TrapTripwireFlare' #exclude TrapTripwireFlare
AND Classname != 'TrapTripwireSmoke' #exclude TrapTripwireSmoke
AND Classname != 'CamoNet_DZ' #exclude CamoNet_DZ
AND Classname != 'StashSmall' #exclude StashSmall
AND Classname != 'StashMedium' #exclude StashMedium
AND Classname != 'DomeTentStorage' #exclude DomeTentStorage
AND Classname != 'TentStorage'; #exclude TentStorage

WHILE (iNumVehExisting < iVehSpawnMax) DO #loop until maximum amount of vehicles is reached

#select a random vehicle class
SELECT Classname, Chance, MaxNum, Damage
INTO @rsClassname, @rsChance, @rsMaxNum, @rsDamage
FROM object_classes ORDER BY RAND() LIMIT 1;

#count number of same class already spawned
SELECT COUNT(*)
INTO iNumClassExisting
FROM Object_DATA
WHERE Instance = sInstance
AND Classname = @rsClassname;

IF (iNumClassExisting < @rsMaxNum) THEN

IF (rndspawn(@rschance) = 1) THEN

INSERT INTO Object_DATA (ObjectUID, Instance, Classname, Damage, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Datestamp)
SELECT ObjectUID, sInstance, Classname, RAND(@rsDamage), '0', Worldspace, Inventory, Hitpoints, RAND(1), SYSDATE()
FROM object_spawns
WHERE Classname = @rsClassname
AND NOT ObjectUID IN (select objectuid from Object_DATA where instance = sInstance)
ORDER BY RAND()
LIMIT 0, 1;

SELECT COUNT(*)
INTO iNumVehExisting
FROM Object_DATA
WHERE Instance = sInstance
AND Classname != '-' #exclude dummys
AND Classname != 'Hedgehog_DZ' #exclude hedgehog
AND Classname != 'Wire_cat1' #exclude wirecat
AND Classname != 'Sandbag1_DZ' #exclude Sanbag
AND Classname != 'BearTrap_DZ' #exclude BearTrap_DZ
AND Classname != 'TrapBearTrapFlare' #exclude TrapBearTrapFlare
AND Classname != 'TrapBearTrapSmoke' #exclude TrapBearTrapSmoke
AND Classname != 'Trap_Cans' #exclude Trap_Cans
AND Classname != 'TrapTripwireGrenade' #exclude TrapTripwireGrenade
AND Classname != 'TrapTripwireFlare' #exclude TrapTripwireFlare
AND Classname != 'TrapTripwireSmoke' #exclude TrapTripwireSmoke
AND Classname != 'CamoNet_DZ' #exclude CamoNet_DZ
AND Classname != 'StashSmall' #exclude StashSmall
AND Classname != 'StashMedium' #exclude StashMedium
AND Classname != 'DomeTentStorage' #exclude DomeTentStorage
AND Classname != 'TentStorage'; #exclude TentStorage
#update number of same class already spawned
SELECT COUNT(*)
INTO iNumClassExisting
FROM Object_DATA
WHERE Instance = sInstance
AND Classname = @rsClassname;

END IF;
END IF;

SET iTimeout = iTimeout + 1; #raise timeout counter
IF (iTimeout >= iTimeoutMax) THEN
SET iNumVehExisting = iVehSpawnMax;
END IF;
END WHILE;
SET i = i + 1;
END
 
@cen

Ever since switching from Reality hive to Pwnoz0r i have had random vehicle spawning issues. I have always been using this before server start:

Code:
F:\MySQL\bin\mysql.exe --user=dayz --password=dayz --host=127.0.0.1 --port=3306 --database=hivemind --execute="call pMain(1)"

However i was used to the way I had Reality setup where any vehicle that was damaged would get removed and respawned back to original spawn location after restart, then it would auto refuel and repair it.. I quickly figured out that pMain did not do these functions so I added the following 2 procedures to mysql:

F:\MySQL\bin\mysql.exe --user=dayz --password=dayz --host=127.0.0.1 --port=3306 --database=hivemind --execute="call RemoveDamagedVeh"

Code:
BEGIN
    DELETE
        FROM object_data
        WHERE Damage >= '0.70000';
END

and

F:\MySQL\bin\mysql.exe --user=dayz --password=dayz --host=127.0.0.1 --port=3306 --database=hivemind --execute="call AutoRefuelRepairVeh"

Code:
BEGIN
update object_data set hitpoints="[]", fuel=1.00000, damage=0.00000;
END

Both of these run BEFORE pMain does.. Is this necessary to achieve what we are trying to achieve here?
 
pMain calls pCleanup routine as well which does the following:

Code:
#starts outofbounds cleanup
        CALL pCleanupOOB();
#move dead players to character_dead
#remove unused vehicles older then 14 days
#Remove camonets whose owner has been dead for 1 day
#remove tents/stashs whose owner has been dead for four days
#remove empty tents older than seven days
#remove barbed wire older than two days
#remove Tank Traps older than fifteen days
#remove Sandbags older than twenty days
#remove Bear Traps older than five days
#remove dead players from data table

and pCleanupOOB runs which catches out of bounds vehicles.

But I don't see any routines that clean up damaged vehicles, which is a concern.
 
Yes that is what I thought. That is why I made the above procedures to run at startup. I know Reality had pearl scripts that you could configure to run on startup that would clean up damaged vehicles on start up.
 
Back
Top