Spawning Vehciles?

underground

New Member
I'm using Stapo's Light Server package, and Sahrani 0.21 and having trouble spawning vehicles. It spawns a couple of them but not very many.
@echo off
Resources\mysql.exe --user=root --password=XXXXXX--host=127.0.0.1 --port=3306 --database=dayz_sahrani --execute="call pMain()"
start .\Expansion\beta\arma2oaserver.exe -port=2302 -mod=expansion\beta;expansion\beta\expansion;@DayZ_Sahrani;@Server_DayZSahrani -name=DayZ -config=Config_DayZSahrani\ServerSettings.cfg -cfg=Config_DayZSahrani\Arma2Config.cfg -profiles=Config_DayZSahrani
exit
I also have my pMain function as follows.
BEGIN

DECLARE iSpawnNumVeh SMALLINT(3) DEFAULT 50;

CALL pCleanup();
CALL pFixMaxNum;

SELECT SUM(MaxNum) FROM object_classes WHERE Chance >= '0.1' INTO @iMaxNumTotal;
IF (ISNULL(@iMaxNumTotal)) THEN
SET @iMaxNumTotal = 0;
END IF;
IF (iSpawnNumVeh > @iMaxNumTotal) THEN
SET iSpawnNumVeh = @iMaxNumTotal;
END IF;

WHILE (fGetVehCount() < iSpawnNumVeh) DO
CALL pSpawn();
END WHILE;

END
My pSpawn function
BEGIN
DECLARE bSpawned TINYINT(1) DEFAULT 0;
DECLARE iLID INT DEFAULT 0;

WHILE (bSpawned = 0) DO

SET iLID = LAST_INSERT_ID();

INSERT INTO object_data (ObjectUID, Instance, Classname, Damage, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Datestamp)
SELECT ot.ObjectUID, '1', ot.Classname, ot.Damage, '0', ot.Worldspace, '[]', ot.Hitpoints, '0.05', SYSDATE()
FROM (SELECT oc.Classname, oc.Chance, oc.MaxNum, oc.Damage, oc.Hitpoints, os.ObjectUID, os.Worldspace
FROM object_classes AS oc
INNER JOIN object_spawns AS os
ON oc.Classname = os.Classname
ORDER BY RAND()) AS ot
WHERE NOT EXISTS (SELECT od.ObjectUID
FROM object_data AS od
WHERE ot.ObjectUID = od.ObjectUID)
AND fGetClassCount(ot.Classname) < ot.MaxNum
AND fGetSpawnFromChance(ot.Chance) = 1
LIMIT 1;

IF (LAST_INSERT_ID() <> iLID) THEN
SET bSpawned = 1;
END IF;

END WHILE;
END
My cleanupOOB
BEGIN

DECLARE intLineCount INT DEFAULT 0;
DECLARE intDummyCount INT DEFAULT 0;
DECLARE intDoLine INT DEFAULT 0;
DECLARE intWest INT DEFAULT 0;
DECLARE intNorth INT DEFAULT 0;

SELECT COUNT(*)
INTO intLineCount
FROM object_data;

SELECT COUNT(*)
INTO intDummyCount
FROM object_data
WHERE Classname = 'dummy';

WHILE (intLineCount > intDummyCount) DO

SET intDoLine = intLineCount - 1;

SELECT ObjectUID, Worldspace
INTO @rsObjectUID, @rsWorldspace
FROM object_data
LIMIT intDoLine, 1;

SELECT REPLACE(@rsWorldspace, '[', '') INTO @rsWorldspace;
SELECT REPLACE(@rsWorldspace, ']', '') INTO @rsWorldspace;
SELECT REPLACE(SUBSTRING(SUBSTRING_INDEX(@rsWorldspace, ',', 2), LENGTH(SUBSTRING_INDEX(@rsWorldspace, ',', 2 -1)) + 1), ',', '') INTO @West;
SELECT REPLACE(SUBSTRING(SUBSTRING_INDEX(@rsWorldspace, ',', 3), LENGTH(SUBSTRING_INDEX(@rsWorldspace, ',', 3 -1)) + 1), ',', '') INTO @North;

SELECT INSTR(@West, '-') INTO intWest;
SELECT INSTR(@North, '-') INTO intNorth;

IF (intNorth = 0) THEN
IF (@North = NULL) THEN
SET @North = '';
SELECT CONVERT(@North, DECIMAL(16,8)) INTO intNorth;
END IF;
IF (@North != NULL) THEN
SELECT CONVERT(@North, DECIMAL(16,8)) INTO intNorth;
END IF;
END IF;

IF (intWest > 0 OR intNorth > 25600) THEN
DELETE FROM object_data
WHERE ObjectUID = @rsObjectUID;
END IF;

SET intLineCount = intLineCount - 1;

END WHILE;

END
Also I have my object_classes table set to spawn a MAX of each vehicle at 15 and the chance is set to 9 on each vehicle. And I'm only getting a maximum spawns of 53. I also am not sure if I need a vehicle spawn script or not but I do not have one if I do. Any ideas how to increase the number of spawns? Thank you much for your help.
 
Changed the max of each to 20, and chance to 0.9.
I chaned the pMain in the database to 700, but still get a max of 50~ vehicles.

Am I missing something?
 
You need spawn points for all the vehicles. I don't remember how many come with default, but it isn't a ton.
 
Yeah there are 1,333 vehicle spawn points in the SQL tables... They are a limited number of vehicles defined there, but obviously that's easily editable to any of our new vehicles... although there are not a ton of spawn points available for all the large planes/heli's, and some of the spawns are for positions that are slightly altered in our version compared to when they were originally done, however it's VERY few.

We had lots of great ideas for the spawn system to auto randomize but no work ever got done on it.

It's all available on the github in mission form too, and there are some tools in there that make it easier to convert between .beidi/sqf format for positions...

With how simple the random spawn logic seems to be I might eventually do the random vehicles spawning too, that was the idea of having so many positions, that you would never know where X car was in X town, it could be in any of the towns in a certain zone...
 
so what do I have to do to up the vehicle count on the server? 53 on an island that large is pretty low considering the number of people living there (or rather, used to live there).
 
so what do I have to do to up the vehicle count on the server? 53 on an island that large is pretty low considering the number of people living there (or rather, used to live there).
 
You have to execute pMain() a TON of times to get it to spawn more, call it like 20-30 times, restart the server, check the vehicle count, call it again a ton, restart etc... I have no clue why it works like that but it's been that way for every map/mod I ever admined for... it doesn't just look at the max and spawn that many...
 
Back
Top