So I've been having a little problem that I have not been able to figure out. I'm using pwzors files for 1.7.4.4. Vehicles are spawning ok after updating the pSpawn and pMain funtions. I'm trying to change the type of vehicles that spawn and their numbers but haven't been able to make this work. I get the same few vehicles and it won't spawn more that 47 to the object_data table.
I've increased iSpawnNumVeh in pMain to 100 so i should get 100 vehicles right?
I've changed the chance and max num in the object_classes table and the max num gets reset back to default every time I rerun the server.bat file.
So I have two questions?
What am I doing wrong to increase the amount of spawned vehicles?
How can I increase the likely hood of a UAZ or BAF spawning as they always get set to maxnum=0?
pMain
pSpawn
Object_classes
I've increased iSpawnNumVeh in pMain to 100 so i should get 100 vehicles right?
I've changed the chance and max num in the object_classes table and the max num gets reset back to default every time I rerun the server.bat file.
So I have two questions?
What am I doing wrong to increase the amount of spawned vehicles?
How can I increase the likely hood of a UAZ or BAF spawning as they always get set to maxnum=0?
pMain
Code:
BEGIN
DECLARE iSpawnNumVeh SMALLINT(3) DEFAULT 100;
CALL pCleanup();
CALL pFixMaxNum;
SELECT SUM(MaxNum) FROM object_classes INTO @iMaxNumTotal;
IF (iSpawnNumVeh > @iMaxNumTotal) THEN
SET iSpawnNumVeh = @iMaxNumTotal;
END IF;
WHILE (fGetVehCount() < iSpawnNumVeh) DO
CALL pSpawn();
END WHILE;
END
pSpawn
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
Object_classes
Code:
ATV_US_EP1 0.7 7 0.05 [["motor",1],["palivo",0.368047],["wheel_1_1_steering",0.331809],["wheel_1_2_steering",1],["wheel_2_1_steering",0.0473658],["wheel_2_2_steering",0.332376],["karoserie",0.355141],["wheel_1_3_steering",0.0401988],["wheel_2_3_steering",1]]
ATV_CZ_EP1 0.64 0 0.05 [["motor",0.8],["palivo",0.8],["wheel_1_1_steering",1],["wheel_1_2_steering",1],["wheel_2_1_steering",0.0156045],["wheel_1_3_steering",0.0401988],["wheel_2_3_steering",1]]
PBX 0.7 0 0.05 []
Smallboat_1 0.99 0 0.05 []
Smallboat_2 0.99 0 0.05 []
S1203_TK_CIV_EP1 0.67 4 0.05 [["glass1",1],["glass2",1],["glass3",1],["motor",0.8],["palivo",0.8],["wheel_1_1_steering",1],["wheel_1_2_steering",1],["wheel_2_1_steering",1],["wheel_2_2_steering",1],["sklo predni P",1],["sklo predni L",1],["karoserie",1],["wheel_1_4_steering",1],["wheel_2_4_steering",1],["wheel_1_3_steering",1],["wheel_2_3_steering",1],["glass4",1]]
BAF_Offroad_W 0.50 0 0.05 []
hilux1_civil_3_open 0.71 0 0.05 [["motor",0.95],["karoserie",0.95],["palivo",0.95],["wheel_1_1_steering",1]]
car_hatchback 0.66 1 0.05 [["motor",0.8],["karoserie",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["wheel_2_2_steering",1]]
Volha_2_TK_CIV_EP1 0.64 6 0.05 [["motor",0.8],["karoserie",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["wheel_2_2_steering",1]]
UAZ_CDF 0.99 0 0.05 [["glass1",1],["glass2",1],["glass3",1],["motor",0.8],["palivo",0.8],["wheel_1_1_steering",1],["wheel_1_2_steering",1],["wheel_2_1_steering",1],["wheel_2_2_steering",1],["sklo predni P",1],["sklo predni L",1],["karoserie",1],["wheel_1_4_steering",1],["wheel_2_4_steering",1],["wheel_1_3_steering",1],["wheel_2_3_steering",1],["glass4",1]]
Lada2 0.25 0 0.05 [["motor",0.8],["karoserie",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["wheel_2_2_steering",1]]
Ural_TK_CIV_EP1 0.7 0 0.05 [["motor",0.8],["karoserie",1],["palivo",0.8]]
V3S_Civ 0.72 1 0.05 [["wheel_1_1_steering",1],["wheel_1_2_steering",1],["wheel_1_3_steering",0.0401988],["wheel_2_1_steering",0.0156045],["wheel_2_3_steering",1],["motor",0.8],["palivo",0.8]]
Ikarus 0.25 7 0.05 [["motor",1],["palivo",0.8],["wheel_1_1_steering",1],["wheel_1_2_steering",1],["wheel_2_1_steering",0.0156045],["wheel_1_3_steering",0.0401988],["wheel_2_3_steering",1]]
Old_bike_TK_INS_EP1 0.50 0 0.05 []
Old_bike_TK_CIV_EP1 0.50 10 0.05 []
TT650_Civ 0.99 0 0.05 []
TT650_Ins 0.99 0 0.05 [["motor",0.8],["wheel_1_1_steering",1],["wheel_1_2_steering",1]]
tractor 0.10 0 0.05 [["motor",1],["sklo predni P",0.0275828],["karoserie",1],["palivo",0.00205799],["wheel_2_1_steering",0.0156045],["wheel_1_3_steering",1],["wheel_2_3_steering",0.0161143],["wheel_1_2_steering",0.0082898],["glass1",1],["glass3",0.0224173]]
UH1H_DZ 0.60 6 0.05 [["glass1",1],["glass2",1],["glass3",1],["glass4",1],["glass5",1],["NEtrup",1.1998],["motor",1],["elektronika",1],["mala vrtule",1],["velka vrtule",1],["munice",1.07084],["sklo predni P",1.04818],["sklo predni L",1.11816],["glass6",1.0402]]