Jump to content
  • 0

Egg Shop


yudi91

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   0
  • Joined:  06/14/13
  • Last Seen:  

i make egg shop, but when i try to buy and hatch it with pet incubator, map server having error

wrong egg item inventory

 

this is my script

prt_in.gat,38,103,7    shop    Egg Shop    703,643:-1,9001:-1,9002:-1,9003:-1,9004:-1,9005:-1,9006:-1,9007:-1,9008:-1,9009:-1,9010:-1,9011:-1,9012:-1,9013:-1,9014:-1,9015:-1,9016:-1,9017:-1,9018:-1,9019:-1,9020:-1,9021:-1,9022:-1,9023:-1,9024:-1,9025:-1,9026:-1,9027:-1,9028:-1,9029:-1,9030:-1,9031:-1,9032:-1,9033:-1,9034:-1,9035:-1,9036:-1,9037:-1,9038:-1,9040:-1,9041:-1,9042:-1,9043:-1,9044:-1,9045:-1,9046:-1,9047:-1,9048:-1,9049:-1,9050:-1,9051:-1,9052:-1,9053:-1,9054:-1,9055:-1,9056:-1
 

i try to get item with @item, it's work fine..

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

this error appear on eathena, not in the latest rathena revision

 

You can make a normal shop by script command. Here a sample

// dummy shop
-	shop	Egg Shop	703,501:-1

prontera,160,172,7	script	special egg	56,{
	callshop "Egg Shop",1;
	end;
OnBuyItem:
	set .@size, getarraysize( @bought_nameid );
	while ( .@i < .@size ) {
		for ( set .@j, 0; .@j < .size_id; set .@j, .@j +1 )
			if ( @bought_nameid[.@i] == .item_id[.@j] ) break;
		set .@total, .@total + .price[.@j] * @bought_quantity[.@i];
		set .@i, .@i +1;
	}
	if ( Zeny < .@total ) {
		dispbottom "you don't have enough zeny";
		end;
	}
	set Zeny, Zeny - .@total;
	for ( set .@j, 0; .@j < .@size; set .@j, .@j +1 )
		makepet @bought_nameid[.@j];
	end;
OnInit:
	setarray .item_id, 9001, 9002;// yours pet egg
	setarray .price, 20, 20;// yours pet egg price
	set .size_id, getarraysize( .item_id);
	npcshopdelitem "Egg Shop",501;
	for ( ; .@i < .size_id; set .@i, .@i +1)
		npcshopadditem "Egg Shop",.item_id[.@i],.price[.@i];
	npcshopattach "Egg Shop";
	end;
}

your setting

OnInit:
	setarray .item_id, 9001, 9002;// yours pet egg
	setarray .price, 20, 20;// yours pet egg price
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  254
  • Reputation:   72
  • Joined:  07/10/13
  • Last Seen:  

The script itself which you have posted here (the "Egg Shop") is working fine. I can buy several eggs for 20z each (because the default value in `item_db`.`price_buy` is used when using -1 as a price).

You should provide more information. Hatching which egg will make the error message occur? What is the complete error message?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   0
  • Joined:  06/14/13
  • Last Seen:  

yes the shop i think it's good, but when i buy for example pet incubator and poring egg, and i try to hatch the egg with pet incubator, the egg is gone, but the poring is not coming..

and in the map server show error like in my attachment

post-18002-0-72424000-1374115953.png

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Custom_Pets

Q. Why does the egg name become red when I try to hatch it and the pet not show up?
A. This is caused by the egg being spawned via an @item command (or
equivalent). To create the egg you need to use the @makeegg command.

Your problem may be related to that.

 

I suggest to make a menu to give yours pets with a npc using makepet

*makepet <pet id>;

This command will create a pet egg and put it in the invoking character's
inventory. The kind of pet is specified by pet ID numbers listed in
'db/pet_db.txt'. The egg is created exactly as if the character just successfully
caught a pet in the normal way.

    // This will make you a poring:
    makepet 1002;

Notice that you absolutely have to create pet eggs with this command. If you try
to give a pet egg with 'getitem', pet data will not be created by the char
server and the egg will disappear when anyone tries to hatch it.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   0
  • Joined:  06/14/13
  • Last Seen:  

so i can't make egg shop like others normal shop?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

Custom_Pets

Q. Why does the egg name become red when I try to hatch it and the pet not show up?

A. This is caused by the egg being spawned via an @item command (or

equivalent). To create the egg you need to use the @makeegg command.

Your problem may be related to that.

 

I suggest to make a menu to give yours pets with a npc using makepet

>

*makepet <pet id>;

This command will create a pet egg and put it in the invoking character's

inventory. The kind of pet is specified by pet ID numbers listed in

'db/pet_db.txt'. The egg is created exactly as if the character just successfully

caught a pet in the normal way.

    // This will make you a poring:

    makepet 1002;

Notice that you absolutely have to create pet eggs with this command. If you try

to give a pet egg with 'getitem', pet data will not be created by the char

server and the egg will disappear when anyone tries to hatch it.

 

 

Extremely useful information had no idea.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   0
  • Joined:  06/14/13
  • Last Seen:  

i must set the price too?

can i use the price from item_db?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

Link to comment
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
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...