Origins Server?

For those interested, I know that for some reason or another - the Procedures and Functions do not always write correctly; so here are the majority of them.

Code:
-- ----------------------------
-- Procedure structure for `pCleanup`
-- ----------------------------
DROP PROCEDURE IF EXISTS `pCleanup`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pCleanup`()
BEGIN
 
CALL pCleanupOOB();
 
DELETE
  FROM object_data
  WHERE Damage = '1';
 
DELETE
  FROM object_data
  WHERE DATE(object_data.Datestamp) < CURDATE() - INTERVAL 9 DAY
  AND CharacterID = 0
  AND (Inventory = '[]'
  OR (Inventory = '[[[],[]],[[],[]],[[],[]]]'
  AND Classname = 'TentStorage'));
 
UPDATE object_data, character_data
  SET object_data.characterID = 0, object_data.Datestamp = CURDATE()
  WHERE object_data.CharacterID = character_data.CharacterID
  AND character_data.Alive = 0
  AND DATE(character_data.Datestamp) < CURDATE() - INTERVAL 3 DAY;
 
UPDATE object_data, character_data
  SET object_data.characterID = 0, object_data.Datestamp = CURDATE()
  WHERE object_data.CharacterID = character_data.CharacterID
  AND DATE(character_data.LastLogin) < CURDATE() - INTERVAL 7 DAY;
 
END
;;
DELIMITER ;
 
-- ----------------------------
-- Procedure structure for `pCleanupOOB`
-- ----------------------------
DROP PROCEDURE IF EXISTS `pCleanupOOB`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pCleanupOOB`()
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
;;
DELIMITER ;
 
-- ----------------------------
-- Procedure structure for `pFixMaxNum`
-- ----------------------------
DROP PROCEDURE IF EXISTS `pFixMaxNum`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pFixMaxNum`()
BEGIN
 
        DECLARE iCounter INT DEFAULT 0;
 
        SELECT COUNT(*) INTO @iClassesCount FROM object_classes WHERE Classname<>'';
        WHILE (iCounter < @iClassesCount) DO
                SELECT Classname, MaxNum INTO @Classname, @MaxNum FROM object_classes LIMIT iCounter,1;
                SELECT COUNT(*) INTO @iMaxClassSpawn FROM object_spawns WHERE Classname LIKE @Classname;
                IF (@MaxNum > @iMaxClassSpawn) THEN
                        UPDATE object_classes SET MaxNum = @iMaxClassSpawn WHERE Classname = @Classname;
                END IF;
                SET iCounter = iCounter + 1;
        END WHILE;
 
END
;;
DELIMITER ;
 
-- ----------------------------
-- Procedure structure for `pMain`
-- ----------------------------
DROP PROCEDURE IF EXISTS `pMain`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pMain`()
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
;;
DELIMITER ;
 
-- ----------------------------
-- Procedure structure for `pSpawn`
-- ----------------------------
DROP PROCEDURE IF EXISTS `pSpawn`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `pSpawn`()
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
;;
DELIMITER ;
 
-- ----------------------------
-- Function structure for `fGetClassCount`
-- ----------------------------
DROP FUNCTION IF EXISTS `fGetClassCount`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `fGetClassCount`(`clname` varchar(32)) RETURNS smallint(3)
    READS SQL DATA
BEGIN
 
        DECLARE iClassCount SMALLINT(3) DEFAULT 0;
 
        SELECT COUNT(*)
                INTO iClassCount
                FROM object_data
                WHERE Classname = clname;
 
        RETURN iClassCount;
END
;;
DELIMITER ;
 
-- ----------------------------
-- Function structure for `fGetSpawnFromChance`
-- ----------------------------
DROP FUNCTION IF EXISTS `fGetSpawnFromChance`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `fGetSpawnFromChance`(`chance` double) RETURNS tinyint(1)
    NO SQL
BEGIN
 
        DECLARE bspawn TINYINT(1) DEFAULT 0;
 
        IF (RAND() <= chance) THEN
                SET bspawn = 1;
        END IF;
 
        RETURN bspawn;
 
END
;;
DELIMITER ;
 
-- ----------------------------
-- Function structure for `fGetVehCount`
-- ----------------------------
DROP FUNCTION IF EXISTS `fGetVehCount`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `fGetVehCount`() RETURNS smallint(3)
    READS SQL DATA
BEGIN
 
DECLARE iVehCount SMALLINT(3) DEFAULT 0;
 
SELECT COUNT(*)
  INTO iVehCount
  FROM object_data, object_classes
  WHERE object_data.Classname = object_classes.Classname; 
 
RETURN iVehCount;
END
;;
DELIMITER ;
 
Can someone please upload their object_data tables?
For some reason I am not getting any loot trucks spawning on Salvation Island.
 
In your database, run 'call pMain()' or atleast 'call pCleanup()'. The Urals are spawned per these procedures

Great, Ive found the lines where you can edit their loot etc.

How do I make it so when the server starts these's are activated or 'run'?

My initial server automatically done this but since I made some changes to the PBO using your addons they no longer activate.
 
I was bored so figured I'd throw up this easy DB dump. Throw it into a .bat or .cmd and simply run it or link it into your BEC Scheduler (if linked, take out the "C:\Windows\System32\timeout /t 3000" and "goto start" lines.)

Code:
::Made by FireFlightMedicX
::Updated 05/28/2013
@echo off
:start
echo Running DB dump...
cd /D "C:\FILE\PATH\TO\mysql\bin"
mysqldump --user=USER --password=PASS  --result-file="C:\FILE\PATH\TO\mysql\bin\Origins_backup.%DATE:~10,4%%DATE:~7,2%%DATE:~4,2%_%time:~0,2%%time:~3,2%%time:~6,2%.sql" dayz_origins
echo Done
C:\Windows\System32\timeout /t 3000
goto start
 
Great, Ive found the lines where you can edit their loot etc.

How do I make it so when the server starts these's are activated or 'run'?

My initial server automatically done this but since I made some changes to the PBO using your addons they no longer activate.

@Drew_Reid: >
Here are our restarters, for the ural spawn you will need to add your own DB login details etc.

BEC restarter:

Code:
::Made by eRazeri
::Updated by trichome[iOGC] 24/04/2013
::Update by Broadsword/Raze[iOGC] 18/05/2013
@echo off
:start
C:\Windows\System32\tasklist /FI "IMAGENAME eq Bec.exe" 2>NUL | C:\Windows\System32\find /I /N "Bec.exe">NUL
if "%ERRORLEVEL%"=="0" goto loop
:: Start Bec
echo Bec monitoring is not running, will be started now
cd /D "e:\programs\Bec"
start "" /wait "E:\programs\Bec\Bec.exe" -f Config_Origins.cfg
echo Bec started succesfully
:: Cleanup and respawn vehicles in the Origins DB hive
cd /D E:\
mysql --user=*********--password=************ --execute="call pCleanup()" dayz_origins
echo Ural spawn script started succesfully
goto started
:loop
cls
echo Bec Origins is already running, running monitoring loop
:started
C:\Windows\System32\timeout /t 120
C:\Windows\System32\tasklist /FI "IMAGENAME eq Bec.exe" 2>NUL | C:\Windows\System32\find /I /N "Bec.exe">NUL
if "%ERRORLEVEL%"=="0" goto loop
goto start

Origins Restarter:

Code:
::Made by eRazeri
::Updated by trichome[iOGC] 24/04/2013
::Update by Broadsword/Raze[iOGC] 18/05/2013
@echo off
:start
C:\Windows\System32\tasklist /FI "IMAGENAME eq arma2oaserver.exe" 2>NUL | C:\Windows\System32\find /I /N "arma2oaserver.exe">NUL
if "%ERRORLEVEL%"=="0" goto loop
:: Start Arma2 Origins Server
echo Server monitored is not running, will be started now
cd /D "f:\programs\arma2"
start "" /wait "F:\programs\arma2\Expansion\beta\arma2oaserver.exe" -port=2302 "-config=dayz_1.origins.tavi\config.cfg" "-cfg=dayz_1.origins.tavi\basic.cfg" "-profiles=dayz_1.origins.tavi" -name=Origins "-mod=@DayzOrigins;@dayz_1.origins.tavi" -noPause -noSound -nosplash -cpuCount=3 -exThreads=1 -maxMem=2048 -noCB
echo Server started succesfully
goto started
:loop
cls
echo Origins Server is already running, running monitoring loop
:started
C:\Windows\System32\timeout /t 30
C:\Windows\System32\tasklist /FI "IMAGENAME eq arma2oaserver.exe" 2>NUL | C:\Windows\System32\find /I /N "arma2oaserver.exe">NUL
if "%ERRORLEVEL%"=="0" goto loop
goto start
 
Who is the one with the Github up? Please can I get a link to it, I have some serious additions I have found and made that I would like to add
 
Also as for the self bloodbagging for lvl 3 hero's and bandits this should do the trick but needs some testing.

First open fn_selfActions.sqf

under the private [ ] block add this code in

Code:
_humanity = player getvariable ["humanity", 0];

Once you have done that find and locate the bloodbag script inside that file.

change this line
Code:
if((speed player <= 1) && hasBagItem && _canDo ) then {

to

Code:
if(speed player <= 1 && hasBagItem && _canDo && (_humanity =>15000 || _humanity =< -15000)) then {

if that does not work could you let me know.

maybe it works, but with these editions disappear actions repair vehicle parts.
 
Hey guys, I've just got my origins server up and running but I now have one problem.
Ive overwritten my sql with one posted on here before, and now the vehicles on sektor B do not spawn with the loot in them. I dont want to re-generate them because I may risk my server of playing up again! sigh.

Does anyone have the worldspace locations for all of them and I can rebuild them with my custom loot.

Thank you,

ps, great work guys, alot of informative stuff in this thread.


You need to run the pcleanup function to spawn them.
Should be run on every restart to restock the vehicles.
 
Great, Ive found the lines where you can edit their loot etc.

How do I make it so when the server starts these's are activated or 'run'?

My initial server automatically done this but since I made some changes to the PBO using your addons they no longer activate.


You can use some of the startup scripts posted here, or here's one I use, and since I don't use Bec, I removed those lines.
This will also update your ban list with a couple community run ban list sites.

https://github.com/MajorPainage/OriginsStart
 
When i use the github files i had the error "requesting authentification"
when i used other files the combat time doesnt stop!

Can anyone help me pls ?
 
Procedure execution failed
1054 - Unknown column 'Inventory' in 'field list'

Procedure pMain not working...

@SanKen: Did you ever get this working? If not, lemme know and I might be able to help.
yeah, this problem improves query that somewhere here.
https://github.com/MajorPainage/Origins/blob/master/sqlfile/2_dayz_origins_vehicle_fix.sql

I have two problems ....
1. GraveCross does not work is the body ...
2. Server FPS on 5player = 10-12....
how to fix this GraveCross

And it is by files of cortez

PLZ help..
 
Fix one problem, create another.

Now I'm getting a problem where it seems to spawn daytime no matter what and no AI are spawning on Salvation Island
 
Back
Top