Doc
Valued Member!
Ok, these threads appear every day and noones seems to be able to find my original post on how to fix these. If you have any MySQL errors relating to unknown column 'MaxDamage' or a problem with a decimal value '', etc. Then you need to follow these simple instructions
replace pSpawn with this:
and pCleaupOOB with this:
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