I've been playing around with this for a couple of weeks and had enough fun with it to share it here. I figured out how to save the variables needed for the power grid provided by AEG to the database, allowing for persistent power states between server restarts. In my opinion, this kind of thing could - with a little work from the modding community - become a small step towards a much-needed endgame in DayZ. Sure, restoring a power plant is not going to be something that can realistically be achieved in this kind of scenario, but 1. it's a game, and 2. with some creativity, you can come up with alternate scenarios.
For example, on my lan server, I'm saving the amount of time the plants have been running, made several crafting recipes (purified water, mechanical items, etc) require powered buildings, set the substations to fail randomly, and the power plants to fail permanently after a few days (lots of fun).
This works on Chernarus, but can easily be ported to other maps as long as you know the power grid variable names. It's also fully server-side, so clients will not need to download any extra files unless you are using the addon version of AEG (in which case they need that).
NOTES:
- A word of warning, this requires you to have access to, and be comfortable with editing your custom database. I made the setUpPowerGrid script as beginner-friendly as possible, giving relevant log output for everything I could think of that can possibly go wrong. Your server will still crash if you don't set up the new table this requires in the hive properly, though.
- Think of this as more of a modders' resource than of an actual release. It's why I posted it in this section.
- This is made for DayZ 1.7.6.1. As long as nothing changed about the custom hive call (Child:999) in the hiveExt.dll, this should work on later versions, as well.
- In case there are any differences on how you would set this up on different server packages, I'm using the reality pack and MySQL administrator to maintain the hive.
Instructions:
1. Database Preparation:
(manual)
Add a new table called 'power_status' to your database. Create the following variables in this new table:
(script)
If you don't want to manually add all that, execute something like this in your database administration application:
Some examples of variations in the above default values:
- All power on: Change everything to true.
- Everything operational, but not transmitting (best if you don't plan to add breaker repair actions):
Set everything in 'distributionFunctional' and 'transmissionfunctional' to true
- only power plants/smokestacks on:
Change 'plantStatus' to '[true,true]'
continued in the next post.
For example, on my lan server, I'm saving the amount of time the plants have been running, made several crafting recipes (purified water, mechanical items, etc) require powered buildings, set the substations to fail randomly, and the power plants to fail permanently after a few days (lots of fun).
This works on Chernarus, but can easily be ported to other maps as long as you know the power grid variable names. It's also fully server-side, so clients will not need to download any extra files unless you are using the addon version of AEG (in which case they need that).
NOTES:
- A word of warning, this requires you to have access to, and be comfortable with editing your custom database. I made the setUpPowerGrid script as beginner-friendly as possible, giving relevant log output for everything I could think of that can possibly go wrong. Your server will still crash if you don't set up the new table this requires in the hive properly, though.
- Think of this as more of a modders' resource than of an actual release. It's why I posted it in this section.
- This is made for DayZ 1.7.6.1. As long as nothing changed about the custom hive call (Child:999) in the hiveExt.dll, this should work on later versions, as well.
- In case there are any differences on how you would set this up on different server packages, I'm using the reality pack and MySQL administrator to maintain the hive.
Instructions:
1. Database Preparation:
(manual)
Add a new table called 'power_status' to your database. Create the following variables in this new table:
Code:
Variable name | Type | Flags | Default
-------------------------------------------------------------------------------------------------------------------
power_worldID | INT(2) | Primary Key, Not Null, Unsigned | your instance id
plantStatus | VARCHAR(16) | Not Null | '[false,false]'
distributionStatus | VARCHAR(40) | Not Null | '[false,false,false,false,false,false]'
transmissionStatus | VARCHAR(52) | Not Null | '[false,false,false,false,false,false,false,false]'
distributionFunctional | VARCHAR(40) | Not Null | '[false,false,false,false,false,false]'
transmissionFunctional | VARCHAR(52) | Not Null | '[false,false,false,false,false,false,false,false]'
-------------------------------------------------------------------------------------------------------------------
(script)
If you don't want to manually add all that, execute something like this in your database administration application:
Code:
delimiter $$
CREATE TABLE `power_status` (
`power_worldID` int(2) unsigned NOT NULL AUTO_INCREMENT,
`plantStatus` varchar(16) NOT NULL DEFAULT '[false,false]',
`distributionStatus` varchar(40) NOT NULL DEFAULT '[false,false,false,false,false,false]',
`transmissionStatus` varchar(52) NOT NULL DEFAULT '[false,false,false,false,false,false,false,false]',
`distributionFunctional` varchar(40) NOT NULL DEFAULT '[false,false,false,false,false,false]',
`transmissionFunctional` varchar(52) NOT NULL DEFAULT '[false,false,false,false,false,false,false,false]',
PRIMARY KEY (`power_worldID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8$$
Some examples of variations in the above default values:
- All power on: Change everything to true.
- Everything operational, but not transmitting (best if you don't plan to add breaker repair actions):
Set everything in 'distributionFunctional' and 'transmissionfunctional' to true
- only power plants/smokestacks on:
Change 'plantStatus' to '[true,true]'
continued in the next post.