Skilled Illusionist
- Joined
- Oct 28, 2008
- Messages
- 379
- Reaction score
- 47
Hello,
Today im going to show you how to add buildings (Fleets and etc are they same way.)
Let's start!
First open the file vars.php in the include folder.
You will see alot of arrays and numbers.
First you will need to give your new item a number.
Buildings are the numbers 0-99
Researches are the numbers 100-199
Fleets are 200-299
Defences are 400-499
Missels are 500-599
And the admirals are 600-699
In this example we are going to add a building.
First we need to create a new type as building. So you search for the array resourse
Wich looks like this
If you want to add a building go to the last building (number 44) and add a new line.
For example
Same for fleets and missels and etc
Now you can choose. If you want your people to have to build other buildings before they can build a building. You can add requirements. Note that this is optional!!
Then you add in the array requirements a line like this
Explaination: 45 is your buildings number. The requirements can be researches or other buildings. So you look up the number of the building or research and you put it before the "=>" after the "=>" you put the level it has to be.
Now we need to set the price of your building/research/fleet/...
So if you scroll down you'll find the array pricelist ($pricelist). The array looks simular to the others. You just need to add a line for your building. With you buildings number.
Just like this.
obliviously The amount of metal needed will be after'metal' => ...
.
The array after pricelist is only for Fleets and defences so if you want to add a building it's useless!Bu for the people who want to it's just the same as we did with all the other stuff.
Now if you want your building to produce for example metal. You will have to add some lines in the array prodgrid. You can use the other values as example.
The first rule is the base amount of production. Then you get a formula. This is how it calculates how much it produces at higher levels. (the - after returns means that you lose materials)
So now that we have made a price and etc we will to add your buildings id in the right list.
At the bottom of the page you will see this
These are all the buildings fleets tech and etc you use. So add your buildings number to the right list.
Note that if you want your bulding to be able of producing things it needs to be added to the prod list.
Ok now that we've add the buildings vars we need to give it a name. This will be done in the language files. So go to the folder ./language/YOURLANGUAGE/
And open the file tech.mo in notepad.
Now search for
You will again see an array. Now add the number of your building to the list like this
Now your building has a name.
Now it needs a discription.
So scroll down to this and add a line.
Now if you want to add a building. You will have to open the file batimentbuildingpage.php in the folder ./includes/functions/
And you will have to add the number of your building in the array
just like that.
Now login and you will see your building at the botom of the list!
It wont have a picture yet. Very easy to add the picture. You go to ./skins/xnova/gebaeude/
and add the picture to it. You'll have to call it "45.gif" (45 as the number of you building).
BUT You're planet will be lvl 0 forever because there is not database value for it. So you will have to go to your database to table planets (game_planets by default) and add a colum with the type you've inserted in the resource array.
Here is a SQL of it
And if you want your building to produce materials you will have to add another colum
Wich i will add later.
I WILL ADD GUIDE TO CREATE AN INFO PAGE SOON!!!
Any questions please post.
Greetz Aropop
Today im going to show you how to add buildings (Fleets and etc are they same way.)
Let's start!
First open the file vars.php in the include folder.
You will see alot of arrays and numbers.
First you will need to give your new item a number.
Buildings are the numbers 0-99
Researches are the numbers 100-199
Fleets are 200-299
Defences are 400-499
Missels are 500-599
And the admirals are 600-699
In this example we are going to add a building.
First we need to create a new type as building. So you search for the array resourse
Wich looks like this
PHP:
$resource = array(
1 => "metal_mine",
2 => "crystal_mine",
3 => "deuterium_sintetizer",
4 => "solar_plant",
.....
.....
For example
PHP:
......
44 => "silo",
45 => "TestBuilding",
......
Now you can choose. If you want your people to have to build other buildings before they can build a building. You can add requirements. Note that this is optional!!
Then you add in the array requirements a line like this
PHP:
45 => array( 15 => 1, 113 => 12),
Now we need to set the price of your building/research/fleet/...
So if you scroll down you'll find the array pricelist ($pricelist). The array looks simular to the others. You just need to add a line for your building. With you buildings number.
Just like this.
PHP:
45 => array ( 'metal' => 20000, 'crystal' => 20000, 'deuterium' => 1000, 'energy' => 0, 'factor' => 2),
.
The array after pricelist is only for Fleets and defences so if you want to add a building it's useless!Bu for the people who want to it's just the same as we did with all the other stuff.
Now if you want your building to produce for example metal. You will have to add some lines in the array prodgrid. You can use the other values as example.
The first rule is the base amount of production. Then you get a formula. This is how it calculates how much it produces at higher levels. (the - after returns means that you lose materials)
So now that we have made a price and etc we will to add your buildings id in the right list.
At the bottom of the page you will see this
PHP:
$reslist['build'] = array ( 1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 45, 44, 41, 42, 43);
$reslist['tech'] = array ( 106, 108, 109, 110, 111, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 199 );
$reslist['fleet'] = array ( 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215 );
$reslist['defense'] = array ( 401, 402, 403, 404, 405, 406, 407, 408, 502, 503 );
$reslist['officier'] = array ( 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615);
$reslist['prod'] = array ( 1, 2, 3, 4, 12, 212 );
Note that if you want your bulding to be able of producing things it needs to be added to the prod list.
Ok now that we've add the buildings vars we need to give it a name. This will be done in the language files. So go to the folder ./language/YOURLANGUAGE/
And open the file tech.mo in notepad.
Now search for
PHP:
$lang['tech'] = array(
PHP:
45 => "Mytestbuilding",
Now it needs a discription.
So scroll down to this and add a line.
PHP:
$lang['res']['descriptions'] = array(
.....
45 => "This is my own test building!!!",
Now if you want to add a building. You will have to open the file batimentbuildingpage.php in the folder ./includes/functions/
And you will have to add the number of your building in the array
PHP:
$Allowed['1'] = array( 1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 44, 45);
Now login and you will see your building at the botom of the list!
It wont have a picture yet. Very easy to add the picture. You go to ./skins/xnova/gebaeude/
and add the picture to it. You'll have to call it "45.gif" (45 as the number of you building).
BUT You're planet will be lvl 0 forever because there is not database value for it. So you will have to go to your database to table planets (game_planets by default) and add a colum with the type you've inserted in the resource array.
Here is a SQL of it
Code:
ALTER TABLE `game_planets` ADD COLUMN `testbuilding` BIGINT(11) NOT NULL DEFAULT 0 AFTER `last_jump_time`;
Wich i will add later.
I WILL ADD GUIDE TO CREATE AN INFO PAGE SOON!!!
Any questions please post.
Greetz Aropop
Last edited: