Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Adding Buildings, fleets, researchs and defenses and modify them!

Status
Not open for further replies.
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
PHP:
$resource = array(
	  1 => "metal_mine",
	  2 => "crystal_mine",
	  3 => "deuterium_sintetizer",
	  4 => "solar_plant",
.....
.....
If you want to add a building go to the last building (number 44) and add a new line.
For example
PHP:
......
	 44 => "silo",
	 45 => "TestBuilding",
......
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
PHP:
 45 => array(  15 =>   1, 113 =>  12),
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.
PHP:
45 => array ( 'metal' =>   20000, 'crystal' =>   20000, 'deuterium' =>    1000, 'energy' =>    0, 'factor' =>   2),
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
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 );
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
PHP:
$lang['tech'] = array(
You will again see an array. Now add the number of your building to the list like this
PHP:
 45 => "Mytestbuilding",
Now your building has a name.
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);
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
Code:
ALTER TABLE `game_planets` ADD COLUMN `testbuilding` BIGINT(11) NOT NULL DEFAULT 0 AFTER `last_jump_time`;
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
 
Last edited:
Newbie Spellweaver
Joined
Mar 13, 2009
Messages
10
Reaction score
0
Hey,

your Guides have been very helpful to me,
Also this one.
But i made a Building.
and a Technology.
i need the technology for the building.


But. can you maybe explain how i can add technology to m yserver aswell?
because i can't research my technology.

i modified the pages you told in this topic.
and also Researchbuildingpage or something.

Can you maybe give me some more info,
about a lsit with files i need to take a look at and what i should change?

But still
Thanks Alot!
+Thanks
 
Last edited by a moderator:
Skilled Illusionist
Joined
Oct 28, 2008
Messages
379
Reaction score
47
OK i'm going to do 2 language explantion now (for the people who want to know the answer).
Ok, if you want a technology you'll have to add an sql to your USERS table. The sql is the same only that you'll have to put it in the users table. If you get error's or your technology doesn't go correectly please post again

Ok, je moet gewoon voor je technologie een SQLcommando naar je users tabel (normaal gezien game_users). Dan kan je hem beginnen onderzoeken
 
Newbie Spellweaver
Joined
Mar 13, 2009
Messages
10
Reaction score
0
Well,

I need to know
How to Add Ships.
i added it to vars.php
tech.mo

i cant find anythign at fleetbuildingpage
so can you tell me which files i have to edit.
because this topic says,
AddingBuildings,Fleets'',researchs and defenses and modify them!.
onyl i see how to add buildings.

so maybe further and more explaination would be nice
For the Real noobs like me ;)
 
Skilled Illusionist
Joined
Oct 28, 2008
Messages
379
Reaction score
47
Well,

I need to know
How to Add Ships.
i added it to vars.php
tech.mo

i cant find anythign at fleetbuildingpage
so can you tell me which files i have to edit.
because this topic says,
AddingBuildings,Fleets'',researchs and defenses and modify them!.
onyl i see how to add buildings.

so maybe further and more explaination would be nice
For the Real noobs like me ;)
Well adding buildings isn't simple because the people who made the source sometimes were really lasy so i had to search deep into the code to find the errors.
Ok now to add a ship, add all info in tech.mo, vars.php, info.mo
Then open fleetbuildingpage.php
and search this line
PHP:
	foreach($lang['tech'] as $Element => $ElementName) {
the line under it is a if statement. It MUST look like this
PHP:
if ($Element > 201 && $Element <= 399) {
It could be that there is something simular to this
PHP:
if ($Element > 201 && $Element <= 215) {
and then it only take the fleets from id 201 to 215 .
Hope it works now
 
Newbie Spellweaver
Joined
Mar 13, 2009
Messages
10
Reaction score
0
ah i see, but don't you mean
''if ($Element > 201 && $Element <= 215) { ''
is in infos.php ?
 
Skilled Illusionist
Joined
Oct 28, 2008
Messages
379
Reaction score
47
ah i see, but don't you mean
''if ($Element > 201 && $Element <= 215) { ''
is in infos.php ?

No in fleetbuildingpage.php
(try to pay attention while reading :glare:)
 
Newbie Spellweaver
Joined
Jul 28, 2010
Messages
8
Reaction score
1
Parse error: syntax error, unexpected T_LNUMBER, expecting ')' in /www/99k.org/g/a/m/game76/htdocs/daichienthienha/language/en/tech.mo on line 192 , what this ?
anyone help me ?
 
Last edited:
Initiate Mage
Joined
May 23, 2009
Messages
1
Reaction score
0
Hello,
Today im going to show you how to add buildings (Fleets and etc are they same way.)
Let's start!
............

............
Greetz Aropop


I really like your tutorial! but i can't get it to work.
i followed your tut and even looked at your other thread on adding sample 'Platforms' building.
it gives no errors niter shows the building on the list.
i also tried lowering and removing requirements for it.
i am using 'Xnova 8.0 Sp1 (Full English Translation) Repack'.

please help...:/:


---------------------------
Edit: nvm... found the problem!! thanks for the great tut!!
 
Last edited:
Status
Not open for further replies.
Back
Top