Neo

[Guide] How to add Custom Jobs

Recommended Posts

Introduction

     For our Example we will create the Custom Class "Shinobi" and its Child version i.e. "Baby Shinobi" along with their Cash Mounts/Halter Mounts. Each Job has 3 ID values :

 

1) Job ID - we will use 4230 & 4231 respectively for the jobs (4232 & 4233 will be reserved for the mounts client side).
 
2) Map ID - Also called EA Mask. If we are extending a class we OR the existing class with a modifier. Since Shinobi is going to be a seperate branch, we will use 0x11 for Shinobi and 0x11 | 0x2000 for Baby Shinobi (0x2000 is the JOBL_BABY mask).
 
3) Msg ID - Defined in messages.conf file. We will use 700 and 701.
 

Before we begin, A few points to note:

1) For the client side i will be using my own patch from NEMO not Xray clients - So dont ask me about Xray.

 

2) This guide is meant to be an overview towards adding jobs - meaning that your job will be enabled once you have done the changes     specified here . You can add further details on your own which depends on your Class.

 

3) If i am missing out on anything please let me know. Nobody is perfect including me :)

 

4) We will use Sprite and some data from Ninja class for the time being but you can add your own entries just as easily.

 

 

Server Source
1) src/common/mmo.h: look for JOB_REBELLION assignment and insert our Job IDs after it.
 

    post-315-0-68676500-1428870470_thumb.png

 

2) src/map/map.h: look for MAPID_BABY_CHASER and insert our Map IDs after it.
 
    post-315-0-44549600-1428871121_thumb.png
 
3) src/map/pc.c:
 
  i) find case JOB_BABY_CHASER: and insert our cases after it
 
  post-315-0-55101100-1428871122_thumb.png
  ii) find case MAPID_BABY_CHASER: and insert our cases after it
 
  post-315-0-58925500-1428871123_thumb.png
 
  iii) find case JOB_REBELLION: followed by return msg_txt(655); and insert our cases after it. (returns the Msg ID)
 
  post-315-0-59730400-1428871124_thumb.png
  iv) find { "Rebellion", JOB_REBELLION }, and insert our Job Names after it
 
  post-315-0-71409300-1428871125_thumb.png
 
4) src/map/itemdb.c: Here we check the job masks that is specified in item_db.conf. There is one limitation, however.
    Currently there is only 1 more slot left in the job mask since it is 32 bit. In case you need to add more you will need to
    change the variable to 64 bit.
   
    Find jobmask & 1<<30 and insert our class check after it.
 
    post-315-0-70198800-1428871120_thumb.png
 
5) src/char/inter.c: Find case JOB_REBELLION: and insert our case after it.(returns the Msg ID)
 
    post-315-0-60356300-1428871119_thumb.png
 
Server Config
1) db/const.txt:
   
  i) Find Job_Rebellion and insert our Job IDs after it
 
post-315-0-58043000-1428871858_thumb.png
 
  ii) Find EAJ_BABY_CHASER and insert our Map IDs after it
 
  post-315-0-79186700-1428871859_thumb.png
   
2) db/<pre-re|re>/exp.txt: Insert your IDs in one of the entries (or if you want to specify your own exp per level you can add that).
   Since our jobs are meant to be amongst First Class, we will simply add it into existing ones.
   
  i) Base:
  post-315-0-91168200-1428871860_thumb.png
  ii) Job:
  post-315-0-68764100-1428871861_thumb.png
3) db/<pre-re|re>/job_db.conf: Add entry for your Job. We will copy the entry from Ninja with slight changes for now.
 
   post-315-0-50928700-1428871864_thumb.png
 
4) db/job_db2.txt: Add entry for your Job. Again we will reuse the data from Ninja.
 
   post-315-0-64436400-1428871865_thumb.png
 
5) conf/help.txt: Insert your class entries to the @go message
 
   post-315-0-33733500-1428871863_thumb.png
 
6) conf/messages.conf: Add the Msg IDs after Shadow Chaser T
 
  post-315-0-61594600-1428871866_thumb.png
   
7) db/<pre-re|re>/skill_tree.conf: Add entry for your Job similar to the others.
 
   -pic to be added-
 
 
Client Lua Files
Now to make the client support Custom Jobs it should be patched with "Enable Custom Jobs" patch in NEMO
Also you should copy the lua files inside Support folder to different area so we can Add entries of our jobs. 
(LuaFiles514/Lua Files/Admin folder inside is what we need essentially)
 
1) PCIDs.lub :
 
  i) First we add all our Job IDs (look for JT_2004_JOB_LAST entry).
 
  post-315-0-35204400-1428872982_thumb.png
  ii) Next we connect the Cash Mount Job IDs to Main Job IDs (Look for JT_REBELLION mapping).
 
  post-315-0-11468600-1428872984_thumb.png  
  iii) Lastly we need to add our Baby Class & its mount to the Baby_List (Look for JT_LION_CRUSADER_B).
 
post-315-0-57454400-1428872985_thumb.png
   
2) PCNames.lub: To illustrate that different names can be assigned based on gender, I am calling them as Shinobi M & Shinobi F for Male & Female respectively.
 
  i) First we add the Job Name for Male Characters (Look for Rebellion)
post-315-0-47184100-1428872986_thumb.png
 
  ii) Next we make the Cash Mounts inherit Names from their respective Main Jobs - since Mounting don't change the name (Look for JT_PECO_REBELLION).
 
post-315-0-14475800-1428872988_thumb.png
   
  iii) Last but not least we add the Job Name for Female characters - Only necessary if it differs from Male name (Look for JT_SORCERER_B).
 
post-315-0-06784600-1428872989_thumb.png
   
3) PCPaths.lub: Here we specify the job specific prefix used by the client to get the job sprite.
  i) First we add the Path prefix for Jobs that is not shared with any existing ones.
   post-315-0-02896900-1428873061_thumb.png
  ii) Next we make the Jobs that has shared path inherit from existing (for e.g. Baby Jobs inherit from Adult versions).
 
post-315-0-52416800-1428873062_thumb.png
4)PCHands.lub: Here we specify the job specific prefix used by the client to get the weapon and shield sprite locations
 
  i) Like before, First we add the Hand prefix for Jobs that is not shared with any existing ones.
 
post-315-0-08866200-1428872980_thumb.png
  ii) Next we make the Jobs with shared prefix inherit from existing (e.g. Baby Jobs, Mounts, Baby Mounts etc. all can inherit from Adult versions).
 
post-315-0-24017600-1428872981_thumb.png
5)PCPals.lub: Here we specify the job specific prefix used by the client to get the Palette file location.
 
  i) Like before, First we add the Pal prefix for Jobs that is not shared with any existing ones.
 
post-315-0-07195100-1428872990_thumb.png
  ii) Next we make the Jobs with shared prefix inherit from existing (e.g. Baby Jobs, Mounts, Baby Mounts etc. all can inherit from Adult versions).
 
post-315-0-24455700-1428872991_thumb.png
 
Note: You can also optionally add entries in PCImfs.lub file in case you have an Imf file, but I haven't seen any issues even without it. 
Hence I am not pursuing it.
 
Once the edits are done pack it into your grf or put it in your data folder and use it.
With this much your job will be visible and able to do everything provided you have the sprite files in the right location.
 
spriteÀΰ£Á·¸öÅë³²<pathprefix>_³².spr and act for Male Job 
spriteÀΰ£Á·¸öÅë¿©<pathprefix>_¿©.spr and act for Female Job
 
Snapshot: (to be added)
 
 

Share this post


Link to post
Share on other sites

COOL GOOD WORD! :D

 

ty! :)

 

Now you have a guide on how to add custom skill of homunculus <--- Please *w*

 

 

that is kinda hard unless you are talking about the client part, because the server side part is kinda complicated depending on how you want the skill to work, since as you can see in source code, each skill is coded differently

Share this post


Link to post
Share on other sites
I'm having these errors while compiling. Any idea why?
 
itemdb.c
Line 358    //Custom JobsLine 359    if (jobmask & 1<<31)Line 360        bclass[0] |= 1<<MAPID_AKATSUIT;Line 361    if (jobmask & 1<<32)Line 362        bclass[0] |= 1<<MAPID_AKATSUKI;Line 363    if (jobmask & 1<<33)Line 364        bclass[0] |= 1<<MAPID_ANBU;

 

ERROR:
srcmapitemdb.c(361): warning C4293: '<<' : shift count negative or too big, undefined behaviorsrcmapitemdb.c(363): warning C4293: '<<' : shift count negative or too big, undefined behavior

 

 
pc.c
Line 6058	//Custom JobsLine 6059		case MAPID_AKATSUIT:              return JOB_AKATSUIT;Line 6060		case MAPID_AKATSUKI:              return JOB_AKATSUKI;Line 6061		case MAPID_ANBU:                  return JOB_ANBU;

 

 
ERROR:
srcmappc.c(6060): error C2196: case value '17' already usedsrcmappc.c(6061): error C2196: case value '17' already used 

 

 

Edited by Lord Ganja

Share this post


Link to post
Share on other sites

 

I'm having these errors while compiling. Any idea why?

 

itemdb.c

Line 358	//Custom Jobs
Line 359 if (jobmask & 1<<31)
Line 360 bclass[0] |= 1<<MAPID_AKATSUIT;
Line 361 if (jobmask & 1<<32)
Line 362 bclass[0] |= 1<<MAPID_AKATSUKI;
Line 363 if (jobmask & 1<<33)
Line 364 bclass[0] |= 1<<MAPID_ANBU;

ERROR:

srcmapitemdb.c(361): warning C4293: '<<' : shift count negative or too big, undefined behaviorsrcmapitemdb.c(363): warning C4293: '<<' : shift count negative or too big, undefined behavior

 

pc.c

Line 6058	//Custom JobsLine 6059		case MAPID_AKATSUIT:              return JOB_AKATSUIT;Line 6060		case MAPID_AKATSUKI:              return JOB_AKATSUKI;Line 6061		case MAPID_ANBU:                  return JOB_ANBU;

 

ERRORS:

srcmappc.c(6060): error C2196: case value '17' already usedsrcmappc.c(6061): error C2196: case value '17' already used

We only have one jobmask left

1<<31 (i.e 2147483648, which is limit of int, in which we store the jobmask)

1<<32 and 1<<33 are greater than 2.147 bil, thus it gets too big to be used,

For allowing more id, change the variable datatype: as Neo Said

 

  Currently there is only 1 more slot left in the job mask since it is 32 bit. In case you need to add more you will need to    change the variable to 64 bit. 

 

 

About Case 17:

maybe MAPID_AKATSUKI and MAPID_ANBU have values 17, that's why, change to 18/19

Share this post


Link to post
Share on other sites

@@Dastgir Thanks for the response. Anyway can you help me fix those issues?

I really don't have any idea how to change the variable from 32 bit to 64 bit..

 

And about the value 17, how to change it with 18/19?

 

:thx:  :thx:

src/map/map.h:

MAPID_AKATSUKI = 0x11

Other 2 should be

0x12 and 0x13

Share this post


Link to post
Share on other sites

 

@@Dastgir Thanks for the response. Anyway can you help me fix those issues?

I really don't have any idea how to change the variable from 32 bit to 64 bit..

 

And about the value 17, how to change it with 18/19?

 

:thx:  :thx:

src/map/map.h:

MAPID_AKATSUKI = 0x11

Other 2 should be

0x12 and 0x13

Thank you!  :D  :D

How about changing the variable from 32bit to 64bit?

Share this post


Link to post
Share on other sites

 

 

@@Dastgir Thanks for the response. Anyway can you help me fix those issues?

I really don't have any idea how to change the variable from 32 bit to 64 bit..

 

And about the value 17, how to change it with 18/19?

 

:thx:  :thx:

src/map/map.h:

MAPID_AKATSUKI = 0x11

Other 2 should be

0x12 and 0x13

Thank you!  :D  :DHow about changing the variable from 32bit to 64bit?
That's not a easy fix,

It needs to change variable type at many places in many files, which would be dome eventually when some new jobs are introduced.

Share this post


Link to post
Share on other sites

 

Introduction

     For our Example we will create the Custom Class "Shinobi" and its Child version i.e. "Baby Shinobi" along with their Cash Mounts/Halter Mounts. Each Job has 3 ID values :

 

1) Job ID - we will use 4230 & 4231 respectively for the jobs (4232 & 4233 will be reserved for the mounts client side).
 
2) Map ID - Also called EA Mask. If we are extending a class we OR the existing class with a modifier. Since Shinobi is going to be a seperate branch, we will use 0x11 for Shinobi and 0x11 | 0x2000 for Baby Shinobi (0x2000 is the JOBL_BABY mask).
 
3) Msg ID - Defined in messages.conf file. We will use 700 and 701.
 

Before we begin, A few points to note:

1) For the client side i will be using my own patch from NEMO not Xray clients - So dont ask me about Xray.

 

2) This guide is meant to be an overview towards adding jobs - meaning that your job will be enabled once you have done the changes     specified here . You can add further details on your own which depends on your Class.

 

3) If i am missing out on anything please let me know. Nobody is perfect including me :)

 

4) We will use Sprite and some data from Ninja class for the time being but you can add your own entries just as easily.

 

 

Server Source
1) src/common/mmo.h: look for JOB_REBELLION assignment and insert our Job IDs after it.
 

    attachicon.gifCJob_mmo_h.PNG

 

2) src/map/map.h: look for MAPID_BABY_CHASER and insert our Map IDs after it.
 
 
3) src/map/pc.c:
 
  i) find case JOB_BABY_CHASER: and insert our cases after it
 
  ii) find case MAPID_BABY_CHASER: and insert our cases after it
 
 
  iii) find case JOB_REBELLION: followed by return msg_txt(655); and insert our cases after it. (returns the Msg ID)
 
  iv) find { "Rebellion", JOB_REBELLION }, and insert our Job Names after it
 
 
4) src/map/itemdb.c: Here we check the job masks that is specified in item_db.conf. There is one limitation, however.
    Currently there is only 1 more slot left in the job mask since it is 32 bit. In case you need to add more you will need to
    change the variable to 64 bit.
   
    Find jobmask & 1<<30 and insert our class check after it.
 
 
5) src/char/inter.c: Find case JOB_REBELLION: and insert our case after it.(returns the Msg ID)
 
 
Server Config
1) db/const.txt:
   
  i) Find Job_Rebellion and insert our Job IDs after it
 
 
  ii) Find EAJ_BABY_CHASER and insert our Map IDs after it
 
   
2) db/<pre-re|re>/exp.txt: Insert your IDs in one of the entries (or if you want to specify your own exp per level you can add that).
   Since our jobs are meant to be amongst First Class, we will simply add it into existing ones.
   
  i) Base:
  ii) Job:
3) db/<pre-re|re>/job_db.conf: Add entry for your Job. We will copy the entry from Ninja with slight changes for now.
 
 
4) db/job_db2.txt: Add entry for your Job. Again we will reuse the data from Ninja.
 
 
5) conf/help.txt: Insert your class entries to the @go message
 
 
6) conf/messages.conf: Add the Msg IDs after Shadow Chaser T
 
   
7) db/<pre-re|re>/skill_tree.conf: Add entry for your Job similar to the others.
 
   -pic to be added-
 
 
Client Lua Files
Now to make the client support Custom Jobs it should be patched with "Enable Custom Jobs" patch in NEMO
Also you should copy the lua files inside Support folder to different area so we can Add entries of our jobs. 
(LuaFiles514/Lua Files/Admin folder inside is what we need essentially)
 
1) PCIDs.lub :
 
  i) First we add all our Job IDs (look for JT_2004_JOB_LAST entry).
 
  ii) Next we connect the Cash Mount Job IDs to Main Job IDs (Look for JT_REBELLION mapping).
 
  iii) Lastly we need to add our Baby Class & its mount to the Baby_List (Look for JT_LION_CRUSADER_B).
 
   
2) PCNames.lub: To illustrate that different names can be assigned based on gender, I am calling them as Shinobi M & Shinobi F for Male & Female respectively.
 
  i) First we add the Job Name for Male Characters (Look for Rebellion)
 
  ii) Next we make the Cash Mounts inherit Names from their respective Main Jobs - since Mounting don't change the name (Look for JT_PECO_REBELLION).
 
   
  iii) Last but not least we add the Job Name for Female characters - Only necessary if it differs from Male name (Look for JT_SORCERER_B).
 
   
3) PCPaths.lub: Here we specify the job specific prefix used by the client to get the job sprite.
  i) First we add the Path prefix for Jobs that is not shared with any existing ones.
  ii) Next we make the Jobs that has shared path inherit from existing (for e.g. Baby Jobs inherit from Adult versions).
 
4)PCHands.lub: Here we specify the job specific prefix used by the client to get the weapon and shield sprite locations
 
  i) Like before, First we add the Hand prefix for Jobs that is not shared with any existing ones.
 
  ii) Next we make the Jobs with shared prefix inherit from existing (e.g. Baby Jobs, Mounts, Baby Mounts etc. all can inherit from Adult versions).
 
5)PCPals.lub: Here we specify the job specific prefix used by the client to get the Palette file location.
 
  i) Like before, First we add the Pal prefix for Jobs that is not shared with any existing ones.
 
  ii) Next we make the Jobs with shared prefix inherit from existing (e.g. Baby Jobs, Mounts, Baby Mounts etc. all can inherit from Adult versions).
 
 
Note: You can also optionally add entries in PCImfs.lub file in case you have an Imf file, but I haven't seen any issues even without it. 
Hence I am not pursuing it.
 
Once the edits are done pack it into your grf or put it in your data folder and use it.
With this much your job will be visible and able to do everything provided you have the sprite files in the right location.
 
spriteÀΰ£Á·¸öÅë³²<pathprefix>_³².spr and act for Male Job 
spriteÀΰ£Á·¸öÅë¿©<pathprefix>_¿©.spr and act for Female Job
 
Snapshot: (to be added)

i use this Guide but  When i  use @changejob or @job i can't Change to my custom job always say  

yOU are unable to cHANGE YOUr job @job 4230>? @job Failed @changejob Failed!

Share this post


Link to post
Share on other sites

you recompiled Hercules after adding the server changes right?

yes and i try 2 to rathena and its same i cant change job  

 

	JOB_Goku = 4230,	case JOB_Goku:		return msg_txt(NULL,739);        MAPID_Goku = 0x11,	[PCJobTable.JT_Goku] 			=	"Goku",       and the other files

 

14_zpsol0z8dzl.jpg

 

I solve the problem of @job for 4230 but i give Rouge Class not my Custom Job ? What is wrong ?

 

Help PLSS wont show the Sprite Of the Custom job!! 

Share this post


Link to post
Share on other sites

 

 

1<<31 (i.e 2147483648, which is limit of int, in which we store the jobmask)

1<<32 and 1<<33 are greater than 2.147 bil, thus it gets too big to be used,

For allowing more id, change the variable datatype: as Neo Said

 

About Case 17:

maybe MAPID_AKATSUKI and MAPID_ANBU have values 17, that's why, change to 18/19

Same problem, different reason :

 

 

QP0Wavn.png

 

Share this post


Link to post
Share on other sites

 

 

 

1<<31 (i.e 2147483648, which is limit of int, in which we store the jobmask)1<<32 and 1<<33 are greater than 2.147 bil, thus it gets too big to be used,For allowing more id, change the variable datatype: as Neo Said About Case 17:maybe MAPID_AKATSUKI and MAPID_ANBU have values 17, that's why, change to 18/19
Same problem, different reason :

 

QP0Wavn.png

You might have some big value for MAPID_SHINOBI

Share this post


Link to post
Share on other sites

 

You might have some big value for MAPID_SHINOBI

I just realize now that I end in Hercules. This problem is in my Rathena emulator. I don't want a complete class, I just need the job to use as costumes with sc_start ou changebase. There are something that I can do? Since it's just for costume I can skip that step?

Where I can find the luafiles? PCID.lua??.

@edit again : forget, I found.. 

http://herc.ws/board/topic/1974-release-custom-job-custom-shield-patches/

@edit again : forget, didn't work.

hexed info : Hexed 2014-10-22b

 

nZ87cs4.png

Edited by SyncMaster

Share this post


Link to post
Share on other sites

@@Neo

My client crashes when i trying to login... I tried with default lubs of nemo, and only happens with the option "Enable custom Jobs."
And i have the lubs in the correct folder, all is fine with my previous client ( 2013-08-07aRagexe )

Now i'm using 2013-12-23cRagexe.

 

Why...?

Thanks!
 

I tested 2014-10-22b also and still happens, the client crashes.

Edited by Wingel

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...