IPB

Welcome Guest ( Log In | Register )



2 Pages V   1 2 >  
Reply to this topicStart new topic
[Guide] How to add a Map to @go
Zathrox
post Dec 10 2008, 09:40 PM
Post #1


BA Game Designer!
****

Group: eA Level 5 (Super)
Posts: 321
Joined: 18-April 07
From: Wales
Member No.: 224,747



Ok, before we begin with the guide on how to edit the source code and add your own maps to "@go" you're going to need to do Three things:

Firstly: You need to have an understanding on how to compile eAthena, if you don't know how to do this, I suggest you go read these guides: Compiling with GCC and Compiling with VC then come back here once you have at least some knowledge of what you're doing.

Secondly: Make a backup of all your work, messing around with the source code on eAthena could mess-up your server completely, so it's always best to make a nice safe, backup.

Third and Finally: Have an Idea of what you want to do, before you go messing around with the source code. If you just want to add a random map for testing purposes, then great, go find a map and get some coordinates you like, and write them down ready. Now the best idea for this is to add a custom town if you have one, or if you're using a specific map as your main town for the players, then you may wish to add that map to @Go

Now, lets get started, As All or most of you know, @go is a teleportation command implemented into eAthena that can warp you to specific regions, usually the main towns of ragnarok. Today I'm going to show you how to add you're own maps to this command.

Since, I said it's always best to have an idea, I'm going to add the: Midgarts Expedition Camp from Episode 13.1 to the command and at the end of the guide, I'll also show you how to modify one of the existing maps into a different one.

Ok, firstly I find it's always best to start of with this file, now go to this file and scroll down a little:
src/common/mapindex.h:
CODE
//Some definitions for the mayor city maps.
#define MAP_PRONTERA "prontera"
#define MAP_GEFFEN "geffen"
#define MAP_MORROC "morocc"
#define MAP_ALBERTA "alberta"
#define MAP_PAYON "payon"
#define MAP_IZLUDE "izlude"
#define MAP_ALDEBARAN "aldebaran"
#define MAP_LUTIE "xmas"
#define MAP_COMODO "comodo"
#define MAP_YUNO "yuno"
#define MAP_AMATSU "amatsu"
#define MAP_GONRYUN "gonryun"
#define MAP_UMBALA "umbala"
#define MAP_NIFLHEIM "niflheim"
#define MAP_LOUYANG "louyang"
#define MAP_JAWAII "jawaii"
#define MAP_AYOTHAYA "ayothaya"
#define MAP_EINBROCH "einbroch"
#define MAP_LIGHTHALZEN "lighthalzen"
#define MAP_EINBECH "einbech"
#define MAP_HUGEL "hugel"
#define MAP_RACHEL "rachel"
#define MAP_VEINS "veins"
#define MAP_JAIL "sec_pri"
#define MAP_NOVICE "new_1-1"
#define MAP_MOSCOVIA "moscovia"

As you can see above, all I simply done was define the map I wanted to do and put a simple code to recognise it later on: MAP_MIDGARTS and then added the name of the map itself in speech markers "": "mid_camp" at the end of the last map that was defined and that was Moscovia.
CODE
#define MAP_JAIL "sec_pri"
#define MAP_NOVICE "new_1-1"
#define MAP_MOSCOVIA "moscovia"
+#define MAP_MIDGARTS "mid_camp"

Now, once you've done that, you'll need to out and find the next file, atcommand.c, Once you've found it, open up the file and go to Edit >> Find >> @go >> Press Find Twice >> until you find @go, it's roughly around line 2150 in SVN 13394:
src/map/atcommand.c:
CODE
        { MAP_PRONTERA,    156, 191 }, //  0=Prontera
        { MAP_MORROC,      156,  93 }, //  1=Morroc
        { MAP_GEFFEN,      119,  59 }, //  2=Geffen
        { MAP_PAYON,       162, 233 }, //  3=Payon
        { MAP_ALBERTA,     192, 147 }, //  4=Alberta
        { MAP_IZLUDE,      128, 114 }, //  5=Izlude
        { MAP_ALDEBARAN,   140, 131 }, //  6=Al de Baran
        { MAP_LUTIE,       147, 134 }, //  7=Lutie
        { MAP_COMODO,      209, 143 }, //  8=Comodo
        { MAP_YUNO,        157,  51 }, //  9=Yuno
        { MAP_AMATSU,      198,  84 }, // 10=Amatsu
        { MAP_GONRYUN,     160, 120 }, // 11=Gonryun
        { MAP_UMBALA,       89, 157 }, // 12=Umbala
        { MAP_NIFLHEIM,     21, 153 }, // 13=Niflheim
        { MAP_LOUYANG,     217,  40 }, // 14=Louyang
        { MAP_NOVICE,       53, 111 }, // 15=Training Grounds
        { MAP_JAIL,         23,  61 }, // 16=Prison
        { MAP_JAWAII,      249, 127 }, // 17=Jawaii
        { MAP_AYOTHAYA,    151, 117 }, // 18=Ayothaya
        { MAP_EINBROCH,     64, 200 }, // 19=Einbroch
        { MAP_LIGHTHALZEN, 158,  92 }, // 20=Lighthalzen
        { MAP_EINBECH,      70,  95 }, // 21=Einbech
        { MAP_HUGEL,        96, 145 }, // 22=Hugel
        { MAP_RACHEL,      130, 110 }, // 23=Rachel
        { MAP_VEINS,       216, 123 }, // 24=Veins
        { MAP_MOSCOVIA,    223, 184 }, // 25=Moscovia

What I've done here is simply copy Moscovia and pasted it down below itself then changed the copy of MAP_MOSCOVIA to MAP_MIDGARTS like I defined in the previous file. Then the two numbers next to it, is the simple coordinates you wish the player to spawn to when using the command @GO.
CODE
        { MAP_RACHEL,      130, 110 }, // 23=Rachel
        { MAP_VEINS,       216, 123 }, // 24=Veins
        { MAP_MOSCOVIA,    223, 184 }, // 25=Moscovia
+        { MAP_MIDGARTS,    100, 100 }, // 26=Midgarts Camp

Note: However, if you want the effect to be randomly placed when using @go to that map, you can simply put: "{ MAP_MIDGARTS, 0, 0 }, which will create an effect similar to a flywing.

Now onto the next part, in the same file, just slightly below will be this something similar to this:
CODE
        clif_displaymessage(fd, " 0=Prontera         1=Morroc       2=Geffen");
        clif_displaymessage(fd, " 3=Payon            4=Alberta      5=Izlude");
        clif_displaymessage(fd, " 6=Al De Baran      7=Lutie        8=Comodo");
        clif_displaymessage(fd, " 9=Yuno             10=Amatsu      11=Gonryun");
        clif_displaymessage(fd, " 12=Umbala          13=Niflheim    14=Louyang");
        clif_displaymessage(fd, " 15=Novice Grounds  16=Prison      17=Jawaii");
        clif_displaymessage(fd, " 18=Ayothaya        19=Einbroch    20=Lighthalzen");
        clif_displaymessage(fd, " 21=Einbech         22=Hugel       23=Rachel");
        clif_displaymessage(fd, " 24=Veins           25=Moscovia");

Now, once you've found that, you need to add your town to this list, it's the default message that pops up when you just type @go into the menu, follow what I've put down below:
CODE
        clif_displaymessage(fd, " 21=Einbech         22=Hugel       23=Rachel");
+        clif_displaymessage(fd, " 24=Veins           25=Moscovia       26=Midgarts Camp" );

Note: Always make sure the numbers are aligned perfectly vertical in the text file and also, make sure, when adding the first map, that the "" is moved ahead of it as shown in the example above.

Now onto the final part of the Guide, this is the section which will define the "search criteria" for the town when using the @GO command in-game.
In the same file, just slightly down from the last section is this:
CODE
    // try to identify the map name
    } else if (strncmp(map_name, "einbroch", 5) == 0 ||
               strncmp(map_name, "ainbroch", 5) == 0) {
        town = 19;
    } else if (strncmp(map_name, "lighthalzen", 3) == 0) {
        town = 20;
    } else if (strncmp(map_name, "einbech", 3) == 0) {
        town = 21;
    } else if (strncmp(map_name, "hugel", 3) == 0) {
        town = 22;
    } else if (strncmp(map_name, "rachel", 3) == 0) {
        town = 23;
    } else if (strncmp(map_name, "veins", 3) == 0) {
        town = 24;
    } else if (strncmp(map_name, "moscovia", 3) == 0) {
        town = 25;
    }

I've reduced the amount of code in the section above, mainly because it was too large and pointless, for explaining how to do the next part.
Now moving on, the next part is pretty simple, all you ave to do is copy and paste Moscovia and edit the details like I've done below:
CODE
    } else if (strncmp(map_name, "moscovia", 3) == 0) {
        town = 25;
    } else if (strncmp(map_name, "midgarts", 3) == 0) {
        town = 26;
    }

Notes: The number after the Hint/name is the amount of characters that can be typed into the chatbox to be matched to when using @go so if I type "@go midgar" since the first 3 letters match the "search criteria" it should warp you to the midgarts camp in the new world.

Then once you've added that last bit, save and close the files and recompile your server using the methods in the guides mentioned above and you should be sorted with a new modified @Go command.

I Hope it Helps a lot of server owners out there. I'll request that the guide stays open, so players can post help for the time being, but if a moderator or administrator would like to copy it to the Guides: Customisation Section and then close that copy of the guide, then they are more than welcome too.

Zathrox~
Go to the top of the page
 
+Quote Post
Maion
post Dec 31 2008, 08:32 AM
Post #2


-- Wonderer --
***

Group: eA Level 5 (Super)
Posts: 145
Joined: 16-September 07
From: United Kingdom
Member No.: 244,617



soo ive manage to do it with my test server, what i am affraid of is when uploading it to my hoster, which files should i upload?
Go to the top of the page
 
+Quote Post
BrianL
post Dec 31 2008, 08:53 AM
Post #3


awesome possum =]
Group Icon

Group: Global Moderators
Posts: 4,624
Joined: 20-March 07
From: California
Member No.: 221,079



.../src/map/atcommand.c

and .../src/common/mapindex.h (if you edited added a map name there)

http://www.eathena.ws/wiki/index.php/@go
Go to the top of the page
 
+Quote Post
Toshin
post Dec 31 2008, 02:30 PM
Post #4


Meu nome e adolfo !
***

Group: eA Level 3 (Normal)
Posts: 130
Joined: 23-December 08
From: Amazonas - Brasil
Member No.: 277,220



To modify, and the same thing?

Tranks!
Go to the top of the page
 
+Quote Post
Zathrox
post Jan 1 2009, 08:50 AM
Post #5


BA Game Designer!
****

Group: eA Level 5 (Super)
Posts: 321
Joined: 18-April 07
From: Wales
Member No.: 224,747



@sbakers: simply upload all the files you edited, depending on which hoster it is, however, you'll need to recompile the files again, to change the map-server to read the edited files, so if your with lets say systeminplace, upload the files you edited and click recompile. however, if you can't do soo due to a different host, you have to upload the map-server files as well if I am correct.

@Toshin: Yeah to modify an existing one, just change the map in mapindex.h and then put the coordinates in X X in atcommand.c good example for modifying one would be for morroc to morroc ruins with the new destruction of the town, etc

This post has been edited by Zathrox: Jan 1 2009, 08:53 AM
Go to the top of the page
 
+Quote Post
Maion
post Jan 1 2009, 12:09 PM
Post #6


-- Wonderer --
***

Group: eA Level 5 (Super)
Posts: 145
Joined: 16-September 07
From: United Kingdom
Member No.: 244,617



it works, thank you very much...
Go to the top of the page
 
+Quote Post
Zathrox
post Jan 1 2009, 12:22 PM
Post #7


BA Game Designer!
****

Group: eA Level 5 (Super)
Posts: 321
Joined: 18-April 07
From: Wales
Member No.: 224,747



No Problem!
Go to the top of the page
 
+Quote Post
Symptom
post Jul 19 2009, 03:25 PM
Post #8


*hums*
***

Group: eA Level 5 (Super)
Posts: 186
Joined: 22-June 09
Member No.: 293,905



This is a great guide,

10/10

Keep up the great work.
Go to the top of the page
 
+Quote Post
GMSilence
post Sep 20 2009, 08:06 AM
Post #9


eA Regular
****

Group: eA Level 5 (Super)
Posts: 256
Joined: 30-May 08
Member No.: 263,310



Do I have to add the "+" infront of it?

like...
+#define MAP_MIDGARTS "mid_camp"

or could I leave the "+" out?
Thanks for the great guide. (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
 
+Quote Post
BrianL
post Sep 20 2009, 12:41 PM
Post #10


awesome possum =]
Group Icon

Group: Global Moderators
Posts: 4,624
Joined: 20-March 07
From: California
Member No.: 221,079



No, you don't add the + too.

In diff files, + indicates line(s) to add
- indicates line(s) to remove.
Go to the top of the page
 
+Quote Post
renzloX08
post Feb 7 2010, 02:09 AM
Post #11


Scripter Wanna be
***

Group: eA Level 3 (Normal)
Posts: 60
Joined: 11-January 10
From: Philippines
Member No.: 306,224



thank you very much for this guide
Go to the top of the page
 
+Quote Post
Mysteriouss
post Feb 26 2010, 03:04 PM
Post #12


I'm the best around - No one Competes!
******

Group: eA Level 5 (Super)
Posts: 969
Joined: 1-January 09
From: Canada
Member No.: 277,725



Nice guide. However I already knew how to do this, but I do got one question. Whats the real name of ra_temple? I've been trying to figure it our for a while.. I tried RA_TEMPLE but it wouldnt work.
Go to the top of the page
 
+Quote Post
Jerhia
post Nov 25 2010, 03:16 AM
Post #13


Quietly Enduring, Silently Suffering, Patiently Waiting.
***

Group: eA Level 3 (Normal)
Posts: 93
Joined: 23-August 07
From: Endless Love City
Member No.: 241,619



Perfectly working ty so much but 1 problem i got here. Only GM can do @go 26 or the @go home i put! Normal player cant do it. Why?


nvm fixed thanks .


This post has been edited by Jerhia: Nov 25 2010, 07:38 AM
Go to the top of the page
 
+Quote Post
Nifflheim
post Apr 20 2011, 08:28 PM
Post #14


Leaning eA
**

Group: eA Level 3 (Normal)
Posts: 31
Joined: 29-January 11
From: Lost Realm
Member No.: 327,499



hello (IMG:style_emoticons/default/smile.gif) your compiler links won't work.
Go to the top of the page
 
+Quote Post
Kenpachi
post Apr 21 2011, 01:09 AM
Post #15


familiam dehonestans aka black sheep
Group Icon

Group: eA Community Contributors
Posts: 2,889
Joined: 18-June 07
From: Germany
Member No.: 233,255



http://www.eathena.ws/wiki/index.php/Compiling
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 17th December 2014 - 04:51 PM
Bridged By IpbWiki: Integration Of Invision Power Board and MediaWiki © GlobalSoft