Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Add custom pets? L2J 

Status
Not open for further replies.
Newbie Spellweaver
Joined
Dec 27, 2004
Messages
16
Reaction score
0
I was looking at l2x, and they have a LOT of custom pets, like frogs, bats, orcs, etc. I was curious as to how we can make our own custom pets..?
 
Newbie Spellweaver
Joined
Dec 16, 2004
Messages
59
Reaction score
0
There are quite afew things hidden in the client that are not used. If you can make them usable by coding them into the server. But normal pets aren't even finished yet on L2J :(
 
Upvote 0
Skilled Illusionist
Joined
May 7, 2005
Messages
308
Reaction score
0
I dident still try but i think u have to change l2npc to l2pet and with eclipse use that an item spawn that mob like with hatchling
 
Upvote 0
Junior Spellweaver
Joined
Jun 5, 2005
Messages
142
Reaction score
0
Adrien said:
I dident still try but i think u have to change l2npc to l2pet and with eclipse use that an item spawn that mob like with hatchling
mmmm
this idea is good... i'll try and post results! :)
 
Upvote 0
Newbie Spellweaver
Joined
Aug 24, 2005
Messages
12
Reaction score
0
what file in the source code are the pets under? that are summoned from items that is

**edit**

I figured out how to do it. and its fairly simple.

just edit petsummon.java in net.sf.l2j.gameserver.handler.itemhandlers in the source code.

Code:
/	// all the items ids that this handler knowns
	private static final int[] _itemIds = { 2375, 3500, 3501, 3502, 4422, 4423, 4424, 69000, 69001, [COLOR="red"]place itemID for item used to summon here[/COLOR] **;

	/* (non-Javadoc)
	 * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.L2PcInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
	 */
	public void useItem(L2PlayableInstance playable, L2ItemInstance item)
	{
		if (!(playable instanceof L2PcInstance))
			return;
		L2PcInstance activeChar = (L2PcInstance)playable;
		int npcId;
		
		if (activeChar.getPet() != null)
		{
			if (Config.DEBUG) _log.fine("player has a pet already. ignore use item");
			return;
		**
        
        if (activeChar.isMounted())
            return;
		
		switch (item.getItemId())
		{
			// wolf pet a
			case 2375:
				npcId = 12077;
				break;
			
			// hatchling of wind
			case 3500:
				npcId = 12311;
				break;
				
			// hatchling of star
			case 3501:
				npcId = 12312;
				break;
				
			// hatchling of twilight
			case 3502:
				npcId = 12313;
				break;
			//  wind strider
			case 4422:
				npcId = 12526;
				break;
			//	Star strider
			case 4423:
				npcId = 12527;
				break;		
			// Twilight strider
			case 4424:
				npcId = 12528;
				break;
                                                //new pet ID goes here
                                                case [COLOR="red"]item used to sumon ID[/COLOR]:
                                                                npcId = [COLOR="red"]new NPC id[/COLOR];



edit l2petinstance.java
under
net.sf.l2j.gameserver.model
Code:
				**
				L2ItemInstance food = null;
				switch (getTemplate().npcId)
				{
					// wolf
					case 12077:
						food = getInventory().findItemByItemId(2515);
						break; 
					//hatchling of wind	
					case 12311:
						food = getInventory().findItemByItemId(4038);
						break;
					// hatchling of star
					case 12312:
						food = getInventory().findItemByItemId(4038);
						break;
					// hatchling of twilight
					case 12313:
						food = getInventory().findItemByItemId(4038);
						break;
					//  wind strider
					case 12526:
						food = getInventory().findItemByItemId(5168);
						break;
					//	Star strider
					case 12527:
						food = getInventory().findItemByItemId(5168);
						break;		
					// Twilight strider
					case 12528:
						food = getInventory().findItemByItemId(5168);
						break;
//new pet
case [COLOR="red"]new pet ID[/COLOR]:
        food = getInventory().findItemByItemId(5168);   //you can place any id for the food, I just use the ID for wolf food to keep it simple

after that, compile the source, and you got everything good server side


now you need to modify the client, place the new NPC in npcgrp.dat, and npcname-e.dat (you'll have to figure that on your own, cause that seems to be frowned apon around here)

and you need to put the new item in that your gonna use to summon the new pet in etcitem.dat and itemname-e.dat (same goes here, gotta figure it out on your own, look around, use search. its not that hard to do)

and last thing you need to put both the NPC pet, and the item into your sql database.

then last but not least, you need to make the xml, that is stored in /l2jfolder/data/script/PetData.zip

I used the wolf.xml that is already in there, and changed the type and ID for testing purposes. just make sure the new xml is in that zip file when your done creating it.

then all set, load it up, create your item, and enjoy your new pet :thumbup: I know I did, and i'm gonna have alot more fun with this now that I know how to do it.
 
Last edited:
Upvote 0
Newbie Spellweaver
Joined
Aug 24, 2005
Messages
12
Reaction score
0
I used a vampire bat, was really cool, the animations worked, and all of the commands worked. now I'm gonna see about making things like human slaves/elven slaves etc etc. and see if I can make regular items equipable by em. so you can have a human slave equiped with duals :thumbup: or in majestic armor. dunno how well it will work, but no hurt in trying.
 
Upvote 0
Newbie Spellweaver
Joined
Aug 24, 2005
Messages
12
Reaction score
0
now the only problem i've found so far, is if you kill something with your pet, and an item drops, L2 crashes, and I get this error



ReadFile beyond EOF 16384+4/16384

History: ULinkerLoad::Serialize <- FGenerationInfo<< <- FUnrealfileSummary<< <- LoadSummary <- ULinkerLoad::Load <- ULinkerLoad::ULinkerLoad <- UObject::GetPackageLinker <- UObject::StaticLoadObject <- (Engine.SkeletalMesh DropItems.coin_m00 NULL) <- UGameEngine::OnDropItem <- UNetworkHandler::Tick <- Function Name=DropItemPacket <- UGameEngine::Tick <- UpdateWorld <- MainLoop

and I can't log back into the server until I restart it. from what i'm reading its something to do with a packet for showing dropped items. but honestly, I dunno what to do, maybe you could figure this one out?

**edit**
on further testing, it seems if anything hits the ground, even if your dropping it from your inventory, the game crashes and I get that critical error. dunno what it could be tho.
 
Last edited:
Upvote 0
Status
Not open for further replies.
Back
Top