Jumat, 06 Juni 2014

Cara Edit Command Src Map

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.

COMPILE LEWAT PUTTY :
cd server
make clean
make sql

Hasilnya :



Tidak ada komentar:

Posting Komentar