[Guide] How to add Custom Jobs

Neo-Mind

Community Contributors
Messages
713
Points
0
Location
The Mysterious Subcontinent
Discord
_Neo_ #7539
Github
Neo-Mind
Emulator
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
default_smile.png


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.
 
    CJob_mmo_h.PNG

2) src/map/map.h: look for MAPID_BABY_CHASER and insert our Map IDs after it.
 
    CJob_map_h.PNG
 
3) src/map/pc.c:
 
  i) find case JOB_BABY_CHASER: and insert our cases after it
 
  CJob_pc_c-1.PNG

  ii) find case MAPID_BABY_CHASER: and insert our cases after it
 
  CJob_pc_c-2.PNG
 
  iii) find case JOB_REBELLION: followed by return msg_txt(655); and insert our cases after it. (returns the Msg ID)
 
  CJob_pc_c-3.PNG

  iv) find { "Rebellion", JOB_REBELLION }, and insert our Job Names after it
 
  CJob_pc_c-4.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.
 
    CJob_itemdb_c.PNG
 
5) src/char/inter.c: Find case JOB_REBELLION: and insert our case after it.(returns the Msg ID)
 
    CJob_inter_c.PNG
 
Server Config
1) db/const.txt:
   
  i) Find Job_Rebellion and insert our Job IDs after it
 
CJob_const_txt-1.PNG
 

  ii) Find EAJ_BABY_CHASER and insert our Map IDs after it
 
  CJob_const_txt-2.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:
  CJob_exp_txt-1.PNG

  ii) Job:
  CJob_exp_txt-2.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.
 
   CJob_job_db_conf.PNG
 
4) db/job_db2.txt: Add entry for your Job. Again we will reuse the data from Ninja.
 
   CJob_job_db2_txt.PNG
 
5) conf/help.txt: Insert your class entries to the @go message
 
   CJob_help_txt.PNG
 
6) conf/messages.conf: Add the Msg IDs after Shadow Chaser T
 
  CJob_messages_conf.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).
 
  CJob_PCIDs_lub-1.PNG

  ii) Next we connect the Cash Mount Job IDs to Main Job IDs (Look for JT_REBELLION mapping).
 
  CJob_PCIDs_lub-2.PNG  

  iii) Lastly we need to add our Baby Class & its mount to the Baby_List (Look for JT_LION_CRUSADER_B).
 
CJob_PCIDs_lub-3.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)

CJob_PCNames_lub-1.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).
 
CJob_PCNames_lub-2.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).
 
CJob_PCNames_lub-3.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.

   CJob_PCPaths_lub-1.PNG

  ii) Next we make the Jobs that has shared path inherit from existing (for e.g. Baby Jobs inherit from Adult versions).
 
CJob_PCPaths_lub-2.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.
 
CJob_PCHands_lub-1.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).
 
CJob_PCHands_lub-2.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.
 
CJob_PCPals_lub-1.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).
 
CJob_PCPals_lub-2.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)
 
 
 
COOL GOOD WORD!
default_biggrin.png


ty!
default_smile.png


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

 
I'm having these errors while compiling. Any idea why?
 
itemdb.c
Code:
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:
Code:
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
Code:
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:
Code:
srcmappc.c(6060): error C2196: case value '17' already usedsrcmappc.c(6061): error C2196: case value '17' already used 
 
Last edited by a moderator:
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

 
Last edited by a moderator:
@@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?

default_thx.gif
 
default_thx.gif


 
@@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?

default_thx.gif
 
default_thx.gif
src/map/map.h:MAPID_AKATSUKI = 0x11

Other 2 should be

0x12 and 0x13

 
@@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?

default_thx.gif
 
default_thx.gif
src/map/map.h:MAPID_AKATSUKI = 0x11

Other 2 should be

0x12 and 0x13
Thank you! 
default_biggrin.png
 
default_biggrin.png


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

 
@@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?

default_thx.gif
 
default_thx.gif
src/map/map.h:MAPID_AKATSUKI = 0x11

Other 2 should be

0x12 and 0x13
Thank you! 
default_biggrin.png
  :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.

 
Lol. Alright. Guess i'll have to wait
default_smile.png
anyways, thanks @@Dastgir

EDIT:

@@Neo, I'm having this client error now. I didn't even touch the PCImfs.lub file..

99jfuo.jpg


 
Last edited by a moderator:
OMG finally thanks! i finally implemented my custom jobs !! <3 love u! D:

 
Last edited by a moderator:
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
default_smile.png


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.gif
CJob_mmo_h.PNG

2) src/map/map.h: look for MAPID_BABY_CHASER and insert our Map IDs after it.
 
   
attachicon.gif
CJob_map_h.PNG
 
3) src/map/pc.c:
 
  i) find case JOB_BABY_CHASER: and insert our cases after it
 
 
attachicon.gif
CJob_pc_c-1.PNG

  ii) find case MAPID_BABY_CHASER: and insert our cases after it
 
 
attachicon.gif
CJob_pc_c-2.PNG
 
  iii) find case JOB_REBELLION: followed by return msg_txt(655); and insert our cases after it. (returns the Msg ID)
 
 
attachicon.gif
CJob_pc_c-3.PNG

  iv) find { "Rebellion", JOB_REBELLION }, and insert our Job Names after it
 
 
attachicon.gif
CJob_pc_c-4.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.
 
   
attachicon.gif
CJob_itemdb_c.PNG
 
5) src/char/inter.c: Find case JOB_REBELLION: and insert our case after it.(returns the Msg ID)
 
   
attachicon.gif
CJob_inter_c.PNG
 
Server Config
1) db/const.txt:
   
  i) Find Job_Rebellion and insert our Job IDs after it
 
attachicon.gif
CJob_const_txt-1.PNG
 

  ii) Find EAJ_BABY_CHASER and insert our Map IDs after it
 
 
attachicon.gif
CJob_const_txt-2.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:
 
attachicon.gif
CJob_exp_txt-1.PNG

  ii) Job:
 
attachicon.gif
CJob_exp_txt-2.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.
 
   
attachicon.gif
CJob_job_db_conf.PNG
 
4) db/job_db2.txt: Add entry for your Job. Again we will reuse the data from Ninja.
 
   
attachicon.gif
CJob_job_db2_txt.PNG
 
5) conf/help.txt: Insert your class entries to the @go message
 
   
attachicon.gif
CJob_help_txt.PNG
 
6) conf/messages.conf: Add the Msg IDs after Shadow Chaser T
 
 
attachicon.gif
CJob_messages_conf.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).
 
 
attachicon.gif
CJob_PCIDs_lub-1.PNG

  ii) Next we connect the Cash Mount Job IDs to Main Job IDs (Look for JT_REBELLION mapping).
 
 
attachicon.gif
CJob_PCIDs_lub-2.PNG

  iii) Lastly we need to add our Baby Class & its mount to the Baby_List (Look for JT_LION_CRUSADER_B).
 
attachicon.gif
CJob_PCIDs_lub-3.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)

attachicon.gif
CJob_PCNames_lub-1.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).
 
attachicon.gif
CJob_PCNames_lub-2.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).
 
attachicon.gif
CJob_PCNames_lub-3.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.

   
attachicon.gif
CJob_PCPaths_lub-1.PNG

  ii) Next we make the Jobs that has shared path inherit from existing (for e.g. Baby Jobs inherit from Adult versions).
 
attachicon.gif
CJob_PCPaths_lub-2.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.
 
attachicon.gif
CJob_PCHands_lub-1.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).
 
attachicon.gif
CJob_PCHands_lub-2.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.
 
attachicon.gif
CJob_PCPals_lub-1.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).
 
attachicon.gif
CJob_PCPals_lub-2.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)
i use this Guide but  When i  use @changejob or @job i can't Change to my custom job always say  

Code:
yOU are unable to cHANGE YOUr job @job 4230>? @job Failed @changejob Failed!
 
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!! 

 
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
 
Back
Top