[SOLVED] [1.7.4.4] DayZ Vehicles Not Spawning / Populating DB

Jarrrk

Moderator
Title kinda self explanatory, plus get this when starting the server:
Code:
Starting MySQL database. Please wait 5-10 seconds.
OK.
 
 
Executing spawn script...
ERROR 1054 (42S22) at line 1: Unknown column 'MaxDamage' in 'field list'
OK.

Which is this line in the start .bat file:
Code:
echo Executing spawn script... .\MySQL\bin\mysql --user=root --password=root --host=127.0.0.1 --port=3316 --database=hivemind --execute="call pMain()" ping 127.0.0.1 -n 5 >NUL .\MySQL\cecho {0A} OK.{07}
So something with pMain()?
 
replace pSpawn with this:

Code:
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

and pCleaupOOB with this:

Code:
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 > 15360) THEN
            DELETE FROM object_data
                WHERE ObjectUID = @rsObjectUID;
        END IF;
        
        SET intLineCount = intLineCount - 1;

    END WHILE;

END
 
Use Navicat Lite to access your database and it's in the Functions section
 
Updated the repo to fix the issue. Sorry for the lack of coding and such trying to do this on an Galaxy S3 my laptop is getting blue screens of death. (BSOD's)
 
Updated the repo to fix the issue. Sorry for the lack of coding and such trying to do this on an Galaxy S3 my laptop is getting blue screens of death. (BSOD's)


well everyone have there own way to do.. At least we find the errors and patch them.
 
Hey DOC, trying to use navicat to import your .txt files into my DB, not having any luck with it. (never tried before) Is it even possible? i've tried importing the object_spawn as a text file with all the defaults. I get stuck at the "you can define the field mappings" part. it is asking for input for the ObjectUID, Classname, Worldspace, and Description lines, and all i have in the dropdown menu is "INSERT INTO `object_spawns` VALUES ('110', 'ATV_US_EP1', '[148,[12949.8,13493.8,0.0407028]]', '');". Am i doing something wrong?
 
Hey verbal. Which txt files are you trying to import?

If it is inserting data into the table (ie an sql script that puts cars into object_data for example) then it needs to be executed as a query. To do this, open the table in navicat and then select file -> "Query Table". A new window aiw tha big blank area will open. Paste the sql code from the txt file into that blank are and then select the green button at the top that says "Run". This will execute that piece of code .
 
First off, thanks for making those 2 .txt files available, it makes adding vehicles in quantity so much faster. I have a few custom locations i added to, but this will make it better. your spawns file worked perfectly , but object_classes gave me this error

[SQL] INSERT INTO `object_classes` VALUES ('V3S_Civ', 0.25000, 2, '0.75', '[]', '0.2', '[]');
[Err] 1136 - Column count doesn't match value count at row 1

you have 2 extra columns at the end, is this for your updated tables?
and can i just add 2 blank columns to the end of my table to make these work?
 
You need to follow the changes to database structure in the original post - those sql files are intended to be used with the improved spawn functions and not the default ones :) Changes to database structure only will work but the other two columns (MaxFuel and Inventory) will not have any effect
 
Didnt know how to add, so i just went down and did a replace funtion in notepad for 0.2, '[]' to nothing, and then i had to shorten you chance variable, but in the end it all worked out. I will eventually change to your structure when i have learned navicat, and mysql better. That way i can fix my own screwups. but thank you it was still very helpful.​
 
Hi, so far the server is working perfectly except for the fact that no vehicles have spawned, i've replaced pSpawn and pCleaupOOB the code above and I still can't find anything.

Now i'm very new to this, do I just have to wait for the vehicles? or do they only spawn in certain areas? or are they just random spawns of a certain amount of vehicles? or do I have to manually spawn them myself? if that's the case how do I do that?

Sorry to bring back a kind of old thread.
 
Back
Top