Jump to content
  • 0

[Guide] How to make a custom pet


Tero

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.01
  • Content Count:  58
  • Reputation:   112
  • Joined:  10/01/22
  • Last Seen:  

I saw a lot of posts about this over the years, but none seemed updated for the most recent version.  I recently spent a lot of time on pets, so here's a quick guide.  I did everything for pre-renewal, but I would imagine most of this would work for renewal too, you might just need to add some stuff about evolution.

 

What you'll need:

GRF Editor

SDE (Server Database Editor)

Both of these can be found elsewhere on this forum and are used for most things involving editing your server.

 

Understanding GRF files:

When the client needs a file, it searches through the GRF files in a certain order to find it.  The order it uses is specified in data.ini in the client's root folder.  Mine looks like this.

[Data]
0=rathena_resources.grf
1=pre20190427.grf
2=renewal20190427.grf
3=palettes.grf
4=data.grf
5=rdata.grf

It looks in files that are higher in the list first.  This means rathena_resources.grf is checked first, and rdata.grf is checked last.

This means that if I need to override a file which is normally in data,grf, I can simply add it to any grf file that is higher in the list, and it will be used instead of the one in data.grf, without having to modify that file.

Since rathena_resources.grf is first in the list, it's easiest to add your files to that.

 

Getting started with your custom pet:

The first two things your pet needs are an egg and a taming item.

For eggs, I simply chose to replace an existing pet egg that was unused.  In Pre-Re, there aren't any unused eggs, but we can fix that.  In a text editor, open up the item_db.txt file for renewal, which is under your db/re folder.  Search for 9001, which will get you to the beginning of the pet eggs.  Renewal has tons of them!  Copy and paste all the eggs that renewal's item_db has into pre-re's item db, and now they'll be available for pre-re to use.

Now open up SDE.  To add an egg for your new pet, all we have to do is rename it.  Use the item search and find an egg you don't care about.  Change its Aegis Name and Name to be the one of the pet you want.  For example, I made Garm Baby, so the Aegis name is Garm_Baby_Egg and the Name is Garm Baby Egg.  This part is done.

Now we need a taming item.  It's easiest to make a taming item by using a miscellaneous item.  For Garm Baby, I used Nursing Bottle.  To turn this item into a taming item, first we have to change it from a Misc Item to a Usable item, which is done using the dropdown in the upper right.  We then need to set the Applicable Job to FFFFFFFF, upper to 7, and Gender to Both.

Now we need to set the script.  The script must look like this:

pet 1515;

Except that the number must match the id number of the enemy you want to be able to capture.  Look this up in the mob database.  You might want to modify the drop rates on your item through the mob database too, particularly if it's an item that no one in the game drops.  Most pet items also have a sell price of 2500 and a weight of 50, if you want to be consistent.  Use "save database (quick)" to save your changes.  We're done with SDE for now.

 

Adding your pet to the game:

The next thing to do is to add your pet to pet_db.yml so it can spawn into the game.

The installation I have actually breaks pet_db.yml into two parts.  There's one file inside pre-re that contains the pet's basic information, and one inside import that contains its skill information.  You could merge these files if you wanted, but if not you'll need to update both.

There are already a bunch of entries in this file, so you can probably just copy one.  Note that when it comes to yaml files, the spacing of the file is important, so make sure you copy it exactly including the spacing.  Here's the one I used for Garm Baby.

  - Mob: GARM_BABY
    TameItem: Milk_Bottle
    EggItem: Garm_Baby_Egg
    FoodItem: Ice_Piece
    Fullness: 4
    IntimacyFed: 10
    CaptureRate: 500
    Script: >
      .@i = getpetinfo(PETINFO_INTIMATE);
      
      if( .@i >= PET_INTIMATE_LOYAL ){
        bonus2 bResEff,Eff_Freeze,5000;
      }

The entries for MOB, TameItem, EggItem, and FoodItem are all Aegis_Names, you can look these up through SDE.  For example, the Nursing Bottle's Aegis Name is actually Milk_Bottle.

The script is something you'll have to come up with on your own.  There's a bunch of examples in the file already you can draw on.  My script makes the pet give you 50% resistance to the freeze status.

If you want the pet to use skills, you'll need to update the other yml file inside import.  Garm Baby has this inside that file:

  - Mob: GARM_BABY
    AttackRate: 8000
    RetaliateRate: 8000
    ChangeTargetRate: 800
    SupportScript: >
      petskillattack "MG_FROSTDIVER",5,10,30;

The main thing we care about is the SupportScript.  This is what attack your pet will use.  Here, this pet uses Frost Driver level 5, between 10-30% of the time depending on how happy it is.

For a support skill, you use petskillsupport instead, with values like this one:

petskillsupport "HP_ASSUMPTIO",1,80,100,100;

This pet would cast Assumptio level 1 with an 80 second delay, when your hp and sp are 100% or less.

There's also stat bonuses available:

petskillbonus bLuk,5,20,40;

This pet gives a bonus of 5 luck for 20 seconds, with a 40 second delay between uses.  For more detail, look in script_commands.txt within Rathena's doc folder.

With this, you can now restart your server and your pet will exist in the game!  There will still be a bit of jank, for example its egg won't show the right name on the client, it won't have a picture, and it won't talk, we'll discuss how to fix that next.

 

Fixing your pet's egg entry:

This one is fairly easy.  Navigate to your client folder and open up System/iteminfo.lua  This is where the game stores all the item translations.

Find the egg that you used by searching for its item id inside square brackets, like this [9001].  The description will be listed here.  If you added a completely new egg, it won't be in this file and you'll need to add an entry for it.

Update the name so it shows the right name.  You can also add a description if you want.  Mine looks like this, but it doesn't need to be this fancy.

[9108] = {
		unidentifiedDisplayName = "Garm Baby Egg",
		unidentifiedResourceName = "¾ðµ¥µå¾Ë",
		unidentifiedDescriptionName = { "..." },
		identifiedDisplayName = "Garm Baby Egg",
		identifiedResourceName = "¾ðµ¥µå¾Ë",
		identifiedDescriptionName = {
			"An egg in which a Garm Baby Cute Pet rests.",
			"Can be hatched by using a ^33CC33Pet Incubator^000000.",
			"^33CC33Special Power ^000000:",
			"Casts level 5 Frost Driver against the enemy",
			"^33CC33Loyal Bonus^000000",
			"Increases resistance to the Freeze status by 50%",
			"Class:^6666CC Monster Egg^000000"
		},
		slotCount = 0,
		ClassNum = 0
	},

 

Adding a picture for your pet:

Every pet has a little picture that is displayed in their pet window.  If you don't do this step, it'll just display NO IMAGE.  This is not cool, so let's add an image.  This requires GRF editor.

To start with, you should probably open up data.grf, just to know how it's structured.  Images for pets are stored in data/texture/userinterface/illust .  If you search this folder for "pet", you'll see the existing images.  They are all 90x134 pixels, your image will need to be this size too.  Name it something like pet_garm_baby.bmp.

You could just upload your file into data.grf, but data.grf is huge and thus it's slow to send update to this file to your players.  Instead, it's easier to put it into rathena_resources.grf.  It does not have this folder, but you can create it using GRF editor.  Remember, any files you put inside something higher in the list of GRF files will override the earlier files.

After adding your file, you'll notice that it won't actually display in game.  This is because there is also a table of pets in the application that maintains the paths to the images that you need to update.  This file is called petinfo.lub, and it is stored inside data.grf in the folder data/luafiles514/lua files/datainfo.  We'll need to make a copy of this file, so extract it using right click extract with GRF editor.  This file needs specific encoding to read the Korean characters, so make sure to save the file with ANSI encoding when you're done.

 

There are many tables in this file that you'll need to add your pet to.  Generally, you can follow the format they use.  You'll notice that most of the entries use an identifier that looks like this:

[jobtbl.JT_GARM_BABY] = "GARM_BABY",

This is an entry into the file jobidentity.lub, which is in the same folder.  You should not need to modify that file, pretty much every enemy in the game is already in there, just enter your pet's Aegis name here, in all caps.  When you come to this table:

PetEggItemID_PetJobID

You'll need to give your pet a new JobID, you can just assign a new one at the end.

When you're finished updating this file, add it into your rathena_resources.grf, making the same folder path for it as above, so it will overwrite the one in the base game.  Make sure to save your GRF afterwards.

If you find that the pet accessories on your server no longer work after doing this, you saved the file with the wrong encoding.  I fixed this by switching all the pet accessory files to the english names and adding them all to my GRF files, but the smart way is probably just to use a text editor that handles encoding properly, like notepad++.

 

Making your pet talk:

To make your pet talk, it needs entries in pettalktable.xml.  For me, this file was in my renewal.grf file, in the data folder.

This is fairly straightforward, you can just copy and then modify Poring's entry.  You just need to know what to put for the enclosing tags.  The name must match the entry you made in the PetNameTable inside petinfo.lub.  I put the name "GARM_BABY" for my pet, so the tag must say <GARM_BABY>.

For some reason, my pets only talked when I put their entries near the beginning of the file.  I suspect one of the entries inside the default file has an error in it, but I haven't found it.  Either way, adding them to the top of the file is safe.  With all of this stuff done, just save your GRF edits and restart the game (it's not necessary to restart the server for GRF changes) and hopefully your pet should talk and have a picture!

Once you confirm everything works, you'll need to distribute the changed grf files and iteminfo.lua to your players.  It's probably worth adding all your custom pets to the server first before you open in to the public!

 

I'm sorry that this was long, no one said custom pets were going to be easy.  Hopefully it all works for you.

Edited by Tero
Small correction
  • Upvote 4
  • MVP 1
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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

Guest
Answer this question...

×   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.

×
×
  • Create New...