Jump to content
  • 0

Set Damage On Age Event Problem


williamjbrown

Question

So here is the situation I will try to explain this as best as possible in order for SOMEONE to help me

 

Ok here we go. 

 

So simply. Our database is not running our SetDamageOnAge event to damage all objects to 0.1 damage. Thus meaning no one can maintain there objects because technically they are all still 100% health. Not as simple as this. Stay with me...

 

So once we figured out the event wasn't running and people couldn't maintain we said okay. Lets do some trouble shooting to get to the bottom of this and find the problem. Here we ran a query. As follows:

UPDATE `object_data` SET `Damage`=0.1 WHERE `Inventory` = '[]'

So basically we wanted to quickly update all the objects to .1 to see if running a query would have an effect on the objects within the database. This script did work. It set every object to 0.1. So we said great its just the event not running. 

 

We jump in game and try to maintain some bases and nada. 0 objects can be maintained. Strange okay we had a look at the maintain_area.sqf file and found this:

if (damage _x >= 0.1) then { 

So we said okay technically nothing is greater than 0.1 right now. So again we go ahead and run another query but just set it to 0.2. 

UPDATE `object_data` SET `Damage`=0.2 WHERE `Inventory` = '[]' 

But you guessed it still nothing. 

 

The thing is, if you shoot a wall a bunch to damage it manually it eventually comes up as maintainable. So we find that object in the database. The damage is not being updated from what the in-game damage is displaying.

 

Okay so we go ahead and maintain the object. 

 

We set that one object to 0.5 damage. Still not maintainable.

 

But if we then shoot it and make it maintainable and then maintainable it sets the 0.5 damage back to 0.0. So the script is working as it should it sets the damage back to 0.0. 

 

For some reason our database won't update the damage to in-game. The maintain area script does set the damage back to 0.0 though

 

For the love of god I can't figure this out and I really don't want to set never to de-spawn objects as the server would build up lag really quick. Any help will be useful!! 

 

 

 

 

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

^^this. It *needs* a restart if you poke straight into tables.. When it's an event in your DB, and runs once a day (you actually have to enable the event, I use HeidiSQL to browse/maintain DB's and is very easy to find/change the events there) then it will work no matter what.

 

Normally you restart your server every 3 hours, but an event once a day is more then enough.

Link to comment
Share on other sites

  • 0

 

Are your certain that the MYSQL event scheduler is enabled?

 

add to my.cnf file.
event_scheduler=on
restart your mysql server.
 
Run MYSQL to check status.
select @@GLOBAL.event_scheduler;

 

 

All is working well. Event's are on. Just doesn't seem to change the values. Running a manual SQL function seems to be the only way. I have just set a personal reminder to run a edited SQL every 12 days so players can maintain. 

 

Ah well not a huge deal. 

Link to comment
Share on other sites

  • 0

The only differences that I can find between the other events is the definer if that has anything to do with it? 

 

This is the definer for the other events:

[email protected]

This is the definer for the edited SetDamageOnAge:

user-2723@%

Will that change anything regarding events having access or something along those lines? 

Link to comment
Share on other sites

  • 0

 I came across this thread while searching for database related issue. Since the last post seem unanswered (at the risk of necromancy) I'll go ahead and share our way of doing it, it might help another searcher.

 

 

We're doing auto-aging of buildables via a batch script which is executed in maintenance time window in between restarts, below is the calling script.

This is better in my opinion as database events stop being a thing to set up / monitor.

If you ever need to migrate machines [due to game server hosting provider change etc.] you simply copy the folder and you're done.

(You just monitor your batch scripts for a few restarts and then if they work that's it).

 

 

@echo off

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: CONFIG - begin
set mysql_exe_path="C:\my_data\program_files\MySQL\MySQL Server 5.6\bin"
:: CONFIG - end
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Run MySQL database maintenance scripts
cd /d %mysql_exe_path%
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\DB_Cleanup-Object-Untouched_Level_1__24h.sql
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\DB_Cleanup-Object-Threshold_After_Spawn_Level_1__3h.sql
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\DB_Cleanup-Object-Untouched_Level_2__3d.sql
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\DB_Cleanup-Object-Untouched_Level_3__7d.sql
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\DB_Cleanup-Object-Untouched_Level_4__14d.sql
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\DB_Cleanup-Object-Untouched_Level_5__5w.sql
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\DB_Cleanup-Player_24h.sql

:: Apply damage  to buildable objects
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\setDamageOnAge.sql

:: Cleanup completely damaged buildables
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\DB_Cleanup-Object-Delete_buildable_with_damage_more_than_1.00.sql

:: Delete "No Key Left" Vehicles
mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\DB_Cleanup-Object-DeleteNoKeyLeftVehicles.sql

:: with file based traders, no need for this any more
::mysql.exe --user=dbadminCHANGETHIS --password=passwordCHANGETHIS --host=127.0.0.1 --port=3306 --database=overpochcher < C:\dayz_mod_server\__SQL_scripts\Modify_Trader_Data.Replenish_Stocks.sql
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


:: We're done here.
@exit

 

 

 

 

And the corresponding SQL script is:

-- ------------------------------------------------------------------------------------------------------------------------------------------------------------
-- EXECUTION FREQUENCY: 		To be executed before each server restart (every 3 hours).
-- SUMMARY:							Apply damage to all buildables that have not been updated for longer than 24 hours (i.e.: not maintained by the owner). 
--												If existing damage is none, apply 0.10 damage.
--												If existing damage is more than 0.10, apply 0.07 damage.
-- 
-- 
-- This is based on a 14 day maintenance server setup. 
-- 
-- 1st day = 10% damage
-- Remaining days = 7% damage 
-- 
-- (90% / 13 days =%6.92 damage per day, rounded up to %7.0 for additional days)
-- ------------------------------------------------------------------------------------------------------------------------------------------------------------
USE overpochcher;
UPDATE `object_data`
	SET `Damage` = IF( `Damage` = 0.0, 0.1, `Damage` + 0.07 )
	WHERE `LastUpdated` <= DATE_SUB(NOW(), INTERVAL 1 DAY)
		AND `Classname` REGEXP 'wall|floor|door|ladder|stair'
		AND `ObjectUID` <> 0
		AND `CharacterID` <> 0
		AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') );

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...