Vehicle Spawns with random damage and inventory

Dordanov

New Member
I already made some changes to the 1.7.4.4 server package for random vehicle damage and posted them on the Tunngle thread for pwnoz0r's server package, but there are quite some changes to the database structure and spawn script since that version, so I decided to redo the random damage for the newest version.
I also post them here because this forum seems to be a little more active, so more people that might be looking for things like this could benefit from them.

While I was busy scripting I also decided to add in random inventory for items and a random skin per object if the object can have different skins. (like the blue/green/red skoda for example)

Random damage
The random damage works with an object_parts table that defines all parts for the vehicle objecttypes, with editable chances for completely repaired and completely broken chances for those parts.
When a vehicle is spawned, and the Hitpoints value for that spawn location is empty ( '[]' ) the script will generate random damage for all defined parts for that vehicle type. (0.25 is 25% chance)

Random inventory
The random inventory works with an object_items table that defines all items that can be spawned for a vehicle type (or ALL if they are applicable to all vehicle types) and a chance to spawn that item. The Min and Max items to spawn in a vehicle are editable in the pMain function and are default set to 2 and 5.

Random skin
Some vehicle have different skins/colors available, but are essentialy the same vehicle ofcourse. I made some changes in the spawn script that allow vehicles to spawn with a different skin instead of always the same skin on the same spot.
For the Skoda for example there are like 3 skins, same for the Ural (Blue, Yellow, and the V3S version) and so on.
The object_skins table contains all different skins for a classname (for now 1 of the skins is chosen as main skin in the classname column)
I did consider making the system spawn a random vehicle type and making the spawns type based (like spawn any random car, spawn aany random truck, spawn any random helicopter on locations) but that would require some structure changes I'd rather not do. The more I change the table structures, the harder it will be to make these changes still work after a new version/database changes from the server package.

Anyway, here are the scripts for my changes:

object_parts table
Code:
/*Table structure for table `object_parts` */
DROP TABLE IF EXISTS `object_parts`;
CREATE TABLE `object_parts` (
  `ObjectType` varchar(50) NOT NULL,
  `PartName` varchar(50) NOT NULL,
  `CompletelyBrokenChance` double(13,5) NOT NULL DEFAULT '0.00000',
  `CompletelyRepairedChance` double(13,5) NOT NULL DEFAULT '0.00000',
  PRIMARY KEY (`ObjectType`,`PartName`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*Data for the table `object_parts` */
insert  into `object_parts`(`ObjectType`,`PartName`,`CompletelyBrokenChance`,`CompletelyRepairedChance`) values ('car','karoserie',0.25000,0.30000),('car','motor',0.25000,0.30000),('car','palivo',0.25000,0.30000),('car','wheel_1_1_steering',0.25000,0.45000),('car','wheel_1_2_steering',0.25000,0.45000),('car','wheel_2_1_steering',0.25000,0.45000),('car','wheel_2_2_steering',0.25000,0.45000),('helicopter','karoserie',0.25000,0.30000),('helicopter','motor',0.25000,0.30000),('helicopter','palivo',0.25000,0.30000),('helicopter','elektronika',0.33000,0.50000),('helicopter','mala vrtule',0.33000,0.50000),('helicopter','velka vrtule',0.33000,0.50000),('boat','motor',0.25000,0.30000),('bike','karoserie',0.25000,0.30000),('bike','wheel_1_damper',0.25000,0.45000),('bike','wheel_2_damper',0.25000,0.45000),('motorcycle','karoserie',0.25000,0.30000),('motorcycle','motor',0.25000,0.30000),('motorcycle','palivo',0.25000,0.30000),('motorcycle','Pravy predni tlumic',0.25000,0.45000),('motorcycle','Pravy zadni tlumic',0.25000,0.45000),('atv','karoserie',0.25000,0.30000),('atv','motor',0.25000,0.30000),('atv','palivo',0.25000,0.30000),('atv','wheel_1_1_steering',0.25000,0.45000),('atv','wheel_1_2_steering',0.25000,0.45000),('atv','wheel_2_1_steering',0.25000,0.45000),('atv','wheel_2_2_steering',0.25000,0.45000),('truck','karoserie',0.25000,0.30000),('truck','motor',0.25000,0.30000),('truck','palivo',0.25000,0.30000),('truck','wheel_1_1_steering',0.25000,0.45000),('truck','wheel_1_2_steering',0.25000,0.45000),('truck','wheel_2_1_steering',0.25000,0.45000),('truck','wheel_2_2_steering',0.25000,0.45000),('truck','wheel_3_1_steering',0.25000,0.45000),('truck','wheel_3_2_steering',0.25000,0.45000),('bus','karoserie',0.25000,0.30000),('bus','motor',0.25000,0.30000),('bus','palivo',0.25000,0.30000),('bus','wheel_1_1_steering',0.25000,0.45000),('bus','wheel_1_2_steering',0.25000,0.45000),('bus','wheel_2_1_steering',0.25000,0.45000),('bus','wheel_2_2_steering',0.25000,0.45000),('bus','wheel_3_1_steering',0.25000,0.45000),('bus','wheel_3_2_steering',0.25000,0.45000),('farmvehicle','karoserie',0.25000,0.30000),('farmvehicle','motor',0.25000,0.30000),('farmvehicle','palivo',0.25000,0.30000),('farmvehicle','wheel_1_1_steering',0.25000,0.45000),('farmvehicle','wheel_1_2_steering',0.25000,0.45000),('farmvehicle','wheel_2_1_steering',0.25000,0.45000),('farmvehicle','wheel_2_2_steering',0.25000,0.45000);

object_items table:
Code:
/*Table structure for table `object_items` */
DROP TABLE IF EXISTS `object_items`;
CREATE TABLE `object_items` (
`ObjectType` varchar(50) NOT NULL,
`Item` varchar(100) NOT NULL,
`Chance` float DEFAULT '0',
PRIMARY KEY (`ObjectType`,`Item`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `object_items` */
insert into `object_items`(`ObjectType`,`Item`,`Chance`) values ('ALL','Binocular',1.68),('ALL','FoodCanBakedBeans',8.91),('ALL','FoodCanFrankBeans',8.91),('ALL','FoodCanPasta',8.91),('ALL','FoodCanSardines',8.91),('ALL','ItemBandage',8.91),('ALL','ItemCompass',1.4),('ALL','ItemFlashlight',0.84),('ALL','ItemKnife',2.24),('ALL','ItemMap',4.2),('ALL','ItemMatchbox',1.68),('ALL','ItemPainkiller',5),('ALL','ItemSodaCoke',8.91),('ALL','ItemSodaEmpty',72.87),('ALL','ItemSodaMdew',0.28),('ALL','ItemSodaPepsi',8.91),('ALL','ItemWatch',4.2),('ALL','ItemWaterbottle',5),('ALL','ItemWaterbottleUnfilled',5),('ALL','TrashJackDaniels',22.87),('ALL','TrashTinCan',72.87),('car','ItemJerrycan',3.92),('car','PartEngine',0.98),('car','PartFueltank',1.96),('car','PartGeneric',3.92),('car','PartGlass',3.92),('car','PartWheel',4.9),('helicopter','30Rnd_556x45_StanagSD',0.99),('helicopter','30Rnd_9x19_MP5',1.98),('helicopter','30Rnd_9x19_MP5SD',0.99),('helicopter','ItemBloodbag',1.98),('helicopter','ItemFlashlightRed',1.91),('helicopter','ItemGPS',0.19),('helicopter','ItemMorphine',0.99),('helicopter','NVGoggles',0.96),('helicopter','Skin_Camo1_DZ',3.48),('helicopter','Skin_Sniper1_DZ',2.17),('offroad','',0),('offroad','20Rnd_762x51_DMR',3.96),('offroad','30Rnd_556x45_Stanag',3.96),('offroad','ItemHatchet',10.78),('offroad','ItemHeatPack',4.35),('offroad','ItemTent',0.98),('offroad','ItemToolbox',1.96),('offroad','Skin_Sniper1_DZ',2.17),('offroad','TrapBear',0.98);

object_skins table
Code:
/*Table structure for table `object_skins` */
DROP TABLE IF EXISTS `object_skins`;
CREATE TABLE `object_skins` (
  `classname` varchar(50) NOT NULL,
  `skin` varchar(50) NOT NULL,
  PRIMARY KEY (`classname`,`skin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `object_skins` */
insert  into `object_skins`(`classname`,`skin`) values ('AH6X_DZ','AH6X_DZ'),('AN2_DZ','AN2_DZ'),('ATV_US_EP1','ATV_CZ_EP1'),('ATV_US_EP1','ATV_US_EP1'),('BAF_Offroad_W','BAF_Offroad_D'),('BAF_Offroad_W','BAF_Offroad_W'),('BAF_Offroad_W','LandRover_CZ_EP1'),('BAF_Offroad_W','LandRover_TK_CIV_EP1'),('car_hatchback','car_hatchback'),('car_sedan','car_sedan'),('Fishing_Boat','Fishing_Boat'),('hilux1_civil_3_open','datsun1_civil_1_open'),('hilux1_civil_3_open','datsun1_civil_3_open'),('hilux1_civil_3_open','hilux1_civil_1_open'),('hilux1_civil_3_open','hilux1_civil_3_open'),('hilux1_civil_3_open','hilux1_civil_3_open_EP1'),('Ikarus','Ikarus'),('Ikarus','Ikarus_TK_CIV_EP1'),('Lada1_TK_CIV_EP1','Lada1'),('Lada1_TK_CIV_EP1','Lada1_TK_CIV_EP1'),('Lada1_TK_CIV_EP1','Lada2'),('Mi17_DZ','Mi17_DZ'),('Old_bike_TK_CIV_EP1','Old_bike_TK_CIV_EP1'),('Old_bike_TK_CIV_EP1','Old_bike_TK_INS_EP1'),('S1203_TK_CIV_EP1','S1203_TK_CIV_EP1'),('Skoda','Skoda'),('Skoda','SkodaBlue'),('Skoda','SkodaGreen'),('Skoda','SkodaRed'),('SUV_TK_EP1','SUV_TK_EP1'),('tractor','tractor'),('TT650_TK_CIV_EP1','M1030'),('TT650_TK_CIV_EP1','Old_moto_TK_Civ_EP1'),('TT650_TK_CIV_EP1','TT650_INS'),('TT650_TK_CIV_EP1','TT650_TK_CIV_EP1'),('UAZ_Unarmed_TK_EP1','UAZ_Unarmed_TK_CIV_EP1'),('UAZ_Unarmed_TK_EP1','UAZ_Unarmed_TK_EP1'),('UH1H_DZ','UH1H_DZ'),('UralCivil','UralCivil'),('UralCivil','UralCivil2'),('UralCivil','V3S_Civ'),('Volha_1_TK_CIV_EP1','VolhaLimo_TK_CIV_EP1'),('Volha_1_TK_CIV_EP1','Volha_1_TK_CIV_EP1'),('Volha_1_TK_CIV_EP1','Volha_2_TK_CIV_EP1');
 
Continued:


pMain function
Code:
BEGIN
# maximum number of INSTANCE id's USED.
#-----------------------------------------------
DECLARE sInstance VARCHAR(8) DEFAULT 1;
#-----------------------------------------------
#maximum number of vehicles allowed !!! theoretical max. amount
#-----------------------------------------------
DECLARE iVehSpawnMax INT DEFAULT 100;
#-----------------------------------------------
# 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 != 'TrapBear'  #exclude trap
  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, Type
    INTO @rsClassname, @rsChance, @rsMaxNum, @rsDamage, @rsObjectType
    FROM object_classes ORDER BY RAND() LIMIT 1;
  #count number of same class (including alternate skins) already spawned
  SELECT COUNT(*)
    INTO iNumClassExisting
    FROM object_data
    WHERE Instance = sInstance
    AND (Classname = @rsClassname OR Classname IN (SELECT SKIN FROM object_skins WHERE Classname = @rsClassname));
  IF (iNumClassExisting < @rsMaxNum) THEN
    IF (rndspawn(@rschance) = 1) THEN
    #reset the skin beforehand for the occasion where no skin is found and it keeps the value of the previous loop (apparently the value is not set when no results are found)
    SET @rsSkin = '';  
  
    #select a skin to use for the class (if any available)
    Select Skin INTO @rsSkin From object_skins where [EMAIL]Classname=@rsClassname[/EMAIL] ORDER BY RaND() LIMIT 1;
  
    #if no alternate skins can be found: just use the default skin
    IF ( @rsSkin = null OR @rsSkin='' ) THEN
      SET @rsSkin = @rsClassname;
    END IF;
      
    #prevent the old value of the previous being remembered
    Set @rsObjectUID = 0;
  
    #select the spawn to use for this class/skin.
    SELECT ObjectUID, sInstance, Worldspace, Inventory, Hitpoints
      INTO @rsObjectUID, @rsInstance, @rsWorldSpace, @rsInventory, @rsHitpoints
      FROM object_spawns
      WHERE (Classname = @rsClassname OR Classname IN (SELECT SKIN FROM object_skins WHERE Classname = @rsClassname))
        AND NOT ObjectUID IN (SELECT objectuid FROM object_data WHERE instance = sInstance)
      ORDER BY RAND()
      LIMIT 0, 1;
  
    #double check if there was a spawn left, maybe we have a greater spawn number than there are spawn locations defined?
  
    IF ( @rsObjectUID > 0 ) THEN
    
      #if there is no hardcoded damage defined for the spawn: generate random damaged parts.
      IF (@rsHitpoints = '[]') THEN
 
      SET @rsHitpoints = '';
      SET @firstVehiclePart = 1;
      
      #Cursors and for-loops are rather annoying in MySQL, so I chose to use a temp table I can use.
      DROP TEMPORARY TABLE IF EXISTS temp_vehicle_parts;
      CREATE TEMPORARY TABLE temp_vehicle_parts (PartName VARCHAR(50), CompletelyBrokenChance DOUBLE(13,5), CompletelyRepairedChance DOUBLE(13,5));
    
      INSERT INTO temp_vehicle_parts SELECT PartName, CompletelyBrokenChance, CompletelyRepairedChance FROM object_parts WHERE [EMAIL]ObjectType=@rsObjectType[/EMAIL];
        
      WHILE EXISTS (SELECT PartName FROM temp_vehicle_parts LIMIT 0,1) DO
        SELECT PartName, CompletelyBrokenChance, CompletelyRepairedChance
        INTO @partName, @completelyBrokenChance, @completelyRepairedChance
        FROM temp_vehicle_parts
        LIMIT 0,1;
      
        IF @firstVehiclePart = 0 THEN
        SET @rsHitpoints = CONCAT(@rsHitpoints,',');
        END IF;
      
      
        SET @rsHitpoints = CONCAT(@rsHitPoints, '["', @partName,'",');
      
        IF ( RAND() <= @completelyBrokenChance ) THEN
          SET @rsHitpoints = CONCAT(@rsHitpoints, '1');
        ELSEIF ( RAND() <= @completelyRepairedChance ) THEN
        SET @rsHitpoints = CONCAT(@rsHitpoints, '0');
        ELSE
        SET @rsHitpoints = CONCAT(@rsHitpoints, (FLOOR(RAND() * 10000) / 10000));
        END IF;
        SET @rsHitpoints = CONCAT(@rsHitpoints, ']');
      
        #remove the part from the parts to process
        DELETE FROM temp_vehicle_parts
        WHERE PartName = @partName;
      
        SET @firstVehiclePart = 0;
      END WHILE;
    
      DROP TABLE temp_vehicle_parts;
    
      SET @rsHitpoints = CONCAT('[', @rsHitpoints, ']');
      END IF; # (@rsHitpoints = '[]')
      #if there is no hardcoded inventory defined: generate random inventory
      #remember: bikes and boats do not have inventory.
      IF ( @rsInventory = '[]' ) AND NOT (@rsObjectType IN ('bike', 'smallboat', 'mediumboat', 'largeboat')) THEN
      #example:
      #[[[],[]],[["FoodCanFrankBeans","ItemPainkiller","ItemHeatPack"],[1,1,1]],[[],[]]]
      #[[[],[]],[["ItemTent","ItemHeatPack","FoodCanBakedBeans"],[1,1,1]],[[],[]]]
      #ItemWaterbottle
      SET @minItems = 2;
      SET @maxItems = 5;
      SET @maxTries = 100; # in case there are no items to be spawned for a certain objectType, prevent a deadlock with this counter.
    
      SET @tries = 0;
      SET @itemCounter = 0;
    
      SET @rsItemStrings = '';
      SET @rsItemCounters = '';
      SET @isFirstItem = 1;
    
      WHILe ( @tries < @maxTries AND @itemCounter < @maxItems ) DO
        #select an item to try to spawn it
        SELECT Item, Chance
        INTO @rsItem, @rsChance
        FROm object_items
        Where ObjectType IN (@rsObjectType, 'ALL')
        ORDER BY RAND()
        LIMIT 0,1;
      
        # generate a random percentage value, and check if it's smaller than the chance to spawn: if so: spawn it.
        IF ( @rsChance > 0 AND @rsChance <= (Rand()*100) ) THEN
        #concat comma's if needed after the first item
        IF ( @isFirstItem = 0 ) THEN
          SET @rsItemStrings = CONCAT(@rsItemStrings, ',');
          SET @rsItemCounters = CONCAT(@rsItemCounters, ',');
        END iF;
      
        SET @rsItemStrings = CONCAT(@rsItemStrings, '"');
        SET @rsItemStrings = CONCAT(@rsItemStrings, @rsItem);
        SET @rsItemStrings = CONCAT(@rsItemStrings, '"');
        SET @rsItemCounters = CONCAT(@rsItemCounters, '1');
      
        SET @itemCounter = @itemCounter + 1;
        SET @isFirstItem = 0;
        #after adding an item there is a 50% chance of immediately stopping to generate more items if the minItems are now achieved.
        IF ( @itemCounter >= @minItems AND Rand() <= 0.5 ) THEN
          SET @tries = @maxTries;
        END IF;
        
      
        ENd IF;            
        SET @tries = @tries + 1;
      
      END WHILE;
    
    
      SET @rsInventory = '';
      SET @rsInventory = CONCAT(@rsInventory, @itemCounter);
      SET @rsInventory = CONCAT(@rsInventory, '[[[],[]],[[');
      SET @rsInventory = CONCAT('[[[],[]],[[', @rsItemStrings);
      SET @rsInventory = CONCAT(@rsInventory, '],[');
      SET @rsInventory = CONCAT(@rsInventory, @rsItemCounters);
      SET @rsInventory = CONCAT(@rsInventory, ']],[[],[]]]');
    
      END IF;
    
    
      #insert the spawn into the object_data table
      INSERT INTO object_data (ObjectUID, Instance, Classname, Damage, CharacterID, Worldspace, Inventory, Hitpoints, Fuel, Datestamp)
      VALUES (@rsObjectUID, @rsInstance, @rsSkin, 0.05, '0', @rsWorldspace, @rsInventory, @rsHitpoints, RAND(0.75), SYSDATE());
    
    END IF;
    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
 
Continued:

If you want to skins to perform properly and efficient, the entries in the spawn table that you want to be able to spawn in any of the different available skins should all be using their main skin, and only those main skins should have entries in the object_classes table. Here are my modified versions of both:

object_classes:
Code:
/*Table structure for table `object_classes` */
DROP TABLE IF EXISTS `object_classes`;
CREATE TABLE `object_classes` (
  `Classname` varchar(32) NOT NULL DEFAULT '',
  `Chance` varchar(4) NOT NULL DEFAULT '0',
  `MaxNum` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `Damage` varchar(20) NOT NULL DEFAULT '0',
  `Type` text NOT NULL,
  PRIMARY KEY (`Classname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
/*Data for the table `object_classes` */
insert  into `object_classes`(`Classname`,`Chance`,`MaxNum`,`Damage`,`Type`) values ('car_hatchback','0.73',3,'0.05000','car'),('Fishing_Boat','0.61',1,'0.05000','largeboat'),('S1203_TK_CIV_EP1','0.69',2,'0.05000','bus'),('tractor','0.7',3,'0.05000','farmvehicle'),('UAZ_Unarmed_TK_EP1','0.7',3,'0.05000','car'),('UH1H_DZ','0.59',2,'0.05000','helicopter'),('Volha_1_TK_CIV_EP1','0.71',2,'0.05000','car'),('Ikarus','0.59',2,'0.05000','bus'),('ATV_US_EP1','0.70',6,'0.05000','atv'),('BAF_Offroad_W','0.54',3,'0.05000','car'),('car_sedan','0.59',1,'0.05000','car'),('hilux1_civil_3_open','0.59',4,'0.05000','car'),('Old_bike_TK_CIV_EP1','0.64',4,'0.05000','bike'),('PBX','0.59',1,'0.05000','smallboat'),('Skoda','0.68',4,'0.05000','car'),('Smallboat_1','0.59',2,'0.05000','mediumboat'),('Smallboat_2','0.59',2,'0.05000','mediumboat'),('TentStorage','0.59',0,'0.05000','tent'),('TT650_TK_CIV_EP1','0.72',5,'0.05000','motorcycle'),('UralCivil','0.59',3,'0.05000','truck'),('Mi17_DZ','0.49',2,'0.05000','helicopter'),('AN2_DZ','0.62',1,'0.05000','plane'),('Hedgehog_DZ','0',0,'0','Hedgehog'),('Wire_cat1','0',0,'0','wire'),('Sandbag1_DZ','0',0,'0','Sandbag'),('AH6X_DZ','0.48',2,'0.05000','helicopter'),('Lada1_TK_CIV_EP1','0.59',3,'0.05000','car'),('SUV_TK_EP1','0.39',1,'0.05000','car');
 
Continued:

object_spawns
Code:
/*Table structure for table `object_spawns` */
DROP TABLE IF EXISTS `object_spawns`;
CREATE TABLE `object_spawns` (
  `ObjectUID` bigint(20) NOT NULL DEFAULT '0',
  `Classname` varchar(32) DEFAULT NULL,
  `Worldspace` varchar(64) DEFAULT NULL,
  `Inventory` longtext,
  `Hitpoints` varchar(999) NOT NULL DEFAULT '[]',
  `MapID` varchar(255) NOT NULL DEFAULT '',
  `Last_changed` int(10) DEFAULT NULL,
  PRIMARY KEY (`ObjectUID`,`MapID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
/*Data for the table `object_spawns` */
insert  into `object_spawns`(`ObjectUID`,`Classname`,`Worldspace`,`Inventory`,`Hitpoints`,`MapID`,`Last_changed`) values (348,'BAF_Offroad_W','[64,[9653.4443,13555.063,0]]','[]','[]','110',NULL),(718,'tractor','[-3,[11934.478,9518.6309,0]]','[]','[]','106',NULL),(719,'tractor','[-3,[12288.495,11094.473,0]]','[]','[]','107',NULL),(347,'hilux1_civil_3_open','[-1,[12276.199,10586.779,0]]','[]','[]','108',NULL),(720,'tractor','[0,[6158.7725,9005.5732,0]]','[]','[]','109',NULL),(717,'tractor','[-3,[12118.503,9445.8721,0]]','[]','[]','105',NULL),(716,'tractor','[-3,[12090.864,9453.6055,0]]','[]','[]','104',NULL),(811,'UH1H_DZ','[27,[9686.75,3604.3081,0]]','[]','[]','0',NULL),(311,'Volha_1_TK_CIV_EP1','[124,[9676.3398,8880.75,0]]','[]','[]','1',NULL),(111,'ATV_US_EP1','[84,[8837.4805,2844.75,0]]','[]','[]','2',NULL),(112,'ATV_US_EP1','[294,[8830.5,2863.95,0]]','[]','[]','3',NULL),(611,'TT650_TK_EP1','[13,[8783.2061,11723.631,0]]','[]','[]','4',NULL),(612,'TT650_TK_EP1','[-17,[8636.0049,6856.8818,0]]','[]','[]','5',NULL),(511,'Old_bike_TK_CIV_EP1','[160,[8346.9404,2458.27,0]]','[]','[]','6',NULL),(512,'Old_bike_TK_CIV_EP1','[197,[8342.5996,2460.51,0]]','[]','[]','7',NULL),(211,'Fishing_Boat','[253,[8299.9502,2358.95,0]]','[]','[]','8',NULL),(312,'UAZ_Unarmed_TK_EP1','[160,[8115.6299,9295.5,0]]','[]','[]','9',NULL),(513,'Old_bike_TK_CIV_EP1','[285,[8091.2998,3350.3101,0]]','[]','[]','10',NULL),(313,'Volha_1_TK_CIV_EP1','[185,[8039.1299,2916.3899,0]]','[]','[]','11',NULL),(514,'Old_bike_TK_CIV_EP1','[4,[8027.8701,7076.1699,0]]','[]','[]','12',NULL),(314,'Skoda','[49,[8001.5898,3342.51,0]]','[]','[]','13',NULL),(515,'Old_bike_TK_CIV_EP1','[130,[7919.9063,7231.3369,0]]','[]','[]','14',NULL),(315,'hilux1_civil_3_open','[215,[7807.3442,3539.9856,0]]','[]','[]','15',NULL),(812,'UH1H_DZ','[-23,[7154.9399,8157.1401,0]]','[]','[]','16',NULL),(316,'UAZ_Unarmed_TK_EP1','[340,[6850.1362,2480.0134,0]]','[]','[]','17',NULL),(411,'Ikarus','[202,[6575.8828,2868.105,0]]','[]','[]','18',NULL),(613,'TT650_TK_EP1','[46,[6404.5347,3209.2341,0]]','[]','[]','19',NULL),(813,'UH1H_DZ','[34,[6360.2271,2767.6943,0]]','[]','[]','20',NULL),(317,'UAZ_Unarmed_TK_EP1','[231,[6319.1499,7733.6499,0]]','[]','[]','21',NULL),(516,'Old_bike_TK_CIV_EP1','[70,[6294.96,7833.77,0]]','[]','[]','22',NULL),(318,'Skoda','[99,[6293.1201,7827.1201,0]]','[]','[]','23',NULL),(412,'Ikarus','[102,[6237.4902,7705.6602,0]]','[]','[]','24',NULL),(319,'Volha_1_TK_CIV_EP1','[222,[5136.8501,2362.4299,0]]','[]','[]','25',NULL),(320,'hilux1_civil_3_open','[246,[4952.6401,5616.5098,0]]','[]','[]','26',NULL),(814,'AH6X_DZ','[2,[12010.7,12637.2,0]]','[]','[]','27',NULL),(321,'UAZ_Unarmed_TK_EP1','[226,[4790.1299,2571.3501,0]]','[]','[]','28',NULL),(413,'Ikarus','[304,[4564.6948,4506.1382,0]]','[]','[]','29',NULL),(815,'Mi17_DZ','[156,[7660.271,3982.0063,0]]','[]','[]','30',NULL),(911,'AN2_DZ','[252,[4530.52,10785.1,0]]','[]','[]','31',NULL),(816,'UH1H_DZ','[268,[4238.04,10781.7,0]]','[]','[]','32',NULL),(113,'ATV_US_EP1','[313,[4087.0901,11669.4,0]]','[]','[]','33',NULL),(114,'ATV_US_EP1','[121,[4059.3201,11658.4,0]]','[]','[]','34',NULL),(711,'tractor','[-32,[3790.79,8961.0898,0]]','[]','[]','35',NULL),(115,'ATV_US_EP1','[274,[3748.5901,5990.8701,0]]','[]','[]','36',NULL),(414,'Ikarus','[180,[3728.0701,8669.0098,0]]','[]','[]','37',NULL),(322,'BAF_Offroad_W','[162,[3702.04,6044.3101,0]]','[]','[]','38',NULL),(517,'Old_bike_TK_CIV_EP1','[51,[3572.6201,2545.29,0]]','[]','[]','39',NULL),(323,'BAF_Offroad_W','[71,[3708.5,5999.4199,0]]','[]','[]','40',NULL),(518,'Old_bike_TK_CIV_EP1','[202,[2947.2,2036.92,0]]','[]','[]','41',NULL),(519,'Old_bike_TK_CIV_EP1','[-3,[2882.28,5270.4902,0]]','[]','[]','42',NULL),(520,'Old_bike_TK_CIV_EP1','[-149,[2792.48,3114.03,0]]','[]','[]','43',NULL),(415,'Ikarus','[309,[2768.26,6000.1602,0]]','[]','[]','44',NULL),(324,'Volha_1_TK_CIV_EP1','[82,[2578.5901,5084.1099,0]]','[]','[]','45',NULL),(325,'BAF_Offroad_W','[141,[11953.279,9107.3896,0]]','[]','[]','46',NULL),(326,'car_hatchback','[287,[1967.1801,9147.2197,0]]','[]','[]','47',NULL),(416,'UralCivil','[233,[1915.7,12442.2,0]]','[]','[]','48',NULL),(417,'S1203_TK_CIV_EP1','[183,[13367.5,6601.1099,0]]','[]','[]','49',NULL),(327,'UAZ_Unarmed_TK_EP1','[89,[13127.792,11561.818,0]]','[]','[]','50',NULL),(418,'UralCivil','[330,[13088.4,7108.5698,0]]','[]','[]','51',NULL),(328,'Skoda','[186,[12903.9,4431.3799,0]]','[]','[]','52',NULL),(419,'S1203_TK_CIV_EP1','[-38,[12167.4,9748.5498,0]]','[]','[]','53',NULL),(420,'S1203_TK_CIV_EP1','[376,[12130.7,3516.8899,0]]','[]','[]','54',NULL),(817,'UH1H_DZ','[7,[12057.56,12626.336,0]]','[]','[]','55',NULL),(614,'TT650_TK_EP1','[272,[11945.3,9130.3398,0]]','[]','[]','56',NULL),(116,'ATV_US_EP1','[-37,[11483.7,11382.7,0]]','[]','[]','57',NULL),(421,'S1203_TK_CIV_EP1','[245,[11463.3,7545.9302,0]]','[]','[]','58',NULL),(117,'ATV_US_EP1','[42,[11461.1,11380.5,0]]','[]','[]','59',NULL),(712,'tractor','[191,[11424.036,7355.7295,0]]','[]','[]','60',NULL),(329,'hilux1_civil_3_open','[210,[11351.6,6633.52,0]]','[]','[]','61',NULL),(818,'UH1H_DZ','[160,[11216.4,4234.8101,0]]','[]','[]','62',NULL),(330,'BAF_Offroad_W','[322,[7201.5181,3034.3232,0]]','[]','[]','63',NULL),(331,'Volha_1_TK_CIV_EP1','[189,[10812.7,2686.29,0]]','[]','[]','64',NULL),(422,'Ikarus','[241,[10641.2,8073.2202,0]]','[]','[]','65',NULL),(332,'Volha_1_TK_CIV_EP1','[306,[10454.8,8872.0996,0]]','[]','[]','66',NULL),(423,'Ikarus','[62,[10320.025,2157.7627,0]]','[]','[]','67',NULL),(819,'AH6X_DZ','[113,[6880.2007,11454.291,0]]','[]','[]','68',NULL),(820,'Mi17_DZ','[-188,[7220.6538,9116.3428,0]]','[]','[]','69',NULL),(333,'SUV_TK_EP1','[-93,[9157.7549,11019.93,0]]','[]','[]','70',NULL),(334,'car_sedan','[-68,[7438.0454,5180.8857,0]]','[]','[]','71',NULL),(615,'TT650_TK_EP1','[-71,[8330.4639,5971.6885,0]]','[]','[]','72',NULL),(335,'Lada1_TK_CIV_EP1','[-120,[8440.3926,5975.1753,0]]','[]','[]','73',NULL),(521,'Old_bike_TK_CIV_EP1','[-138,[8511.4111,6044.689,0]]','[]','[]','74',NULL),(336,'hilux1_civil_3_open','[-134,[6448.6953,6543.1836,0]]','[]','[]','75',NULL),(337,'Volha_1_TK_CIV_EP1','[-14,[6208.9775,10403.117,0]]','[]','[]','76',NULL),(338,'Lada1_TK_CIV_EP1','[105,[6027.7988,10459.635,0]]','[]','[]','77',NULL),(522,'Old_bike_TK_CIV_EP1','[-63,[5986.3462,10373.445,0]]','[]','[]','78',NULL),(339,'hilux1_civil_3_open','[7,[5969.1924,10313.057,0]]','[]','[]','79',NULL),(118,'ATV_US_EP1','[-32,[5984.6064,10161.703,0]]','[]','[]','80',NULL),(340,'Skoda','[-163,[9691.2695,6551.8672,0]]','[]','[]','81',NULL),(821,'Mi17_DZ','[4,[13584.044,3199.9648,0]]','[]','[]','82',NULL),(912,'AN2_DZ','[134,[5172.3457,2172.7046,0]]','[]','[]','83',NULL),(913,'AN2_DZ','[108,[5260.3203,2261.9851,0]]','[]','[]','84',NULL),(914,'AN2_DZ','[-212,[5156.3555,2651.9055,0]]','[]','[]','85',NULL),(915,'AN2_DZ','[-125,[4809.2461,2539.2903,0]]','[]','[]','86',NULL),(341,'BAF_Offroad_W','[-95,[4713.7666,2616.6179,0]]','[]','[]','87',NULL),(616,'TT650_TK_EP1','[37,[4360.8408,2482.9688,0]]','[]','[]','88',NULL),(342,'car_sedan','[19,[4454.373,2453.6816,0]]','[]','[]','89',NULL),(119,'ATV_US_EP1','[-190,[4564.9624,2371.521,0]]','[]','[]','90',NULL),(523,'Old_bike_TK_CIV_EP1','[-56,[4570.3975,2421.6531,0]]','[]','[]','91',NULL),(822,'AH6X_DZ','[-190,[13112.096,10432.461,0]]','[]','[]','92',NULL),(343,'hilux1_civil_3_open','[-161,[13145.874,10416.225,0]]','[]','[]','93',NULL),(424,'UralCivil','[108,[13109.942,10302.45,0]]','[]','[]','94',NULL),(425,'UralCivil','[-161,[13098.729,10248.01,0]]','[]','[]','95',NULL),(426,'S1203_TK_CIV_EP1','[-3,[12996.397,10078.24,0]]','[]','[]','96',NULL),(344,'Lada1_TK_CIV_EP1','[-171,[12989.563,10075.743,0]]','[]','[]','97',NULL),(345,'hilux1_civil_3_open','[-75,[12987.494,10039.641,0]]','[]','[]','98',NULL),(713,'tractor','[-75,[12670.277,10015.792,0]]','[]','[]','99',NULL),(714,'tractor','[108,[12684.55,10074.417,0]]','[]','[]','100',NULL),(427,'UralCivil','[-25,[12683.362,9825.7119,0]]','[]','[]','101',NULL),(346,'Lada1_TK_CIV_EP1','[-122,[12283.381,9464.5566,0]]','[]','[]','102',NULL),(715,'tractor','[-3,[12102.996,9451.2998,0]]','[]','[]','103',NULL),(823,'AH6X_DZ','[-117,[9698.9893,13686.655,0]]','[]','[]','111',NULL);

All this works perfectly fine for me, but in the odd case something goes wrong executing a script, or I might have made an error copying my code, I do recommend to MAKE A DATABASE BACKUP BEFORE ATTEMPTING TO GET THIS TO WORK!

I tried to make it easily editable additions, so anyone with access to the database can view the parts, items and skins table and tweak them to their liking. Also note that everything can be made optional.

If you don't want random damage you can set hardcoded Hitpoints values in the object_spawns table for your objects, or comment out the part that generates Hitpoints in the pMain function.

If you don't want random inventory for your vehicles you can set hardcoded Inventory values in the object_spawns table or clear the object_items table so it has no items to spawn.

If you don't want random skins you can clear the object_skins table, and it will use the skin/classname defined in the object_spawns table.

Enjoy!

Edit: Sorry I had to do this over different posts, but my entire post was over 30k characters due to the table dumps in it, and there is a 10k character limit per post :p
 
Back
Top