Jump to content

Question

Posted

i have problem i line tiara can help me? pls

 

else if (command.startsWith("become_noble"))

{

NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());

if (!player.isNoble())

{

//then you check for the level 78

if(player.getLevel()>=78){

 

//then you ask for items

if(

player.getInventory().getItemByItemId(12345/**1 item id **/).getCount()>=12345/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(12345/**2 item id **/).getCount()>=12345/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(12345/**3 item id **/).getCount()>=12345/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(12345/**4 item id **/).getCount()>=12345/** Is bigger or equals required item count **/

){

L2ItemInstance tiara = player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara

player.getInventory().equipItemAndRecord(tiara);//equip the tiara if you want

player.setNoble(true, true);

player.sendPacket(new UserInfo(player));

html.setFile("data/html/classmaster/nobleok.htm");

}else

player.sendMessage("You don't have enough items.");

}

else

player.sendMessage("Your level must be 78 or higher.");

}

else

html.setFile("data/html/classmaster/alreadynoble.htm");

 

player.sendPacket(html);

//and don't forget the imports for l2iteminstance etc..

}

 

 

Recommended Posts

  • 0
Posted

Ok, so its noblesse npc?

....

 

                  //then you ask for items                  
                  if(
                  player.getInventory().getItemByItemId(12345/**1 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**2 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**3 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  && player.getInventory().getItemByItemId(12345/**4 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  ){

 

Dude read this part...

  • 0
Posted

yes is npc noble i have problem in line tiara anyone can repair pls! and send me

 

Show me the error... becouse as i  read i can't find anything wrong but the one i already show.

 

Edit try:

                  L2ItemInstance tiara = player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara

				 	player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara

  • 0
Posted

first of all using getItemById(222).getCount sucks since player may have not item with 222 ID in his inventory so .getCount is undifined. So use like:

 

if getItemById(222) != null

  if getItemById(222) >= 12345

        .

        .

        .

 

 

  • 0
Posted

first of all using getItemById(222).getCount sucks since player may have not item with 222 ID in his inventory so .getCount is undifined. So use like:

 

if getItemById(222) != null

  if getItemById(222) >= 12345

        .

        .

        .

 

                  }else
                     player.sendMessage("You don't have enough items.");

  • 0
Posted

                  }else
                     player.sendMessage("You don't have enough items.");

 

else if (command.startsWith("become_noble"))

{

NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());

if (!player.isNoble())

{

//then you check for the level 78

if(player.getLevel()>=78){

 

//then you ask for items

if(

player.getInventory().getItemByItemId(9210/**1 item id **/).getCount()>=9210/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(9211/**2 item id **/).getCount()>=9211/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(9212/**3 item id **/).getCount()>=9212/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(9213/**4 item id **/).getCount()>=9213/** Is bigger or equals required item count **/

){

player.setNoble(true, true);

player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara

player.sendPacket(new UserInfo(player));

html.setFile("data/html/classmaster/nobleok.htm");

}else

player.sendMessage("You don't have enough items.");

}

else

player.sendMessage("Your level must be 78 or higher.");

}

else

html.setFile("data/html/classmaster/alreadynoble.htm");

 

player.sendPacket(html);

//and don't forget the imports for l2iteminstance etc..

}

 

and me go speak with npc and say me: You don't have enough items ... who is?

  • 0
Posted

               player.getInventory().getItemByItemId(9210/**1 item id **/).getCount()>=9210/** Is bigger or equals required item count **/
               && player.getInventory().getItemByItemId(9211/**2 item id **/).getCount()>=9211/** Is bigger or equals required item count **/
               && player.getInventory().getItemByItemId(9212/**3 item id **/).getCount()>=9212/** Is bigger or equals required item count **/   
               && player.getInventory().getItemByItemId(9213/**4 item id **/).getCount()>=9213/** Is bigger or equals required item count **/   

 

You request  9213 count from item 9213. And so on with all else...

 

 

  • 0
Posted

why don't you try to make this?

first of all using getItemById(222).getCount sucks since player may have not item with 222 ID in his inventory so .getCount is undifined. So use like:

 

if getItemById(222) != null

  if getItemById(222) >= 12345

        .

        .

        .

        .

        .

        .

  • 0
Posted

dont work

 

Man consider learning some more english becouse I am not able to understand what are your error in this case?

As i see the only problem could be in this lines:

   //then you ask for items                  
                  if(
                  player.getInventory().getItemByItemId(12345/**1 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**2 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**3 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  && player.getInventory().getItemByItemId(12345/**4 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  ){
                  L2ItemInstance tiara = player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara
                  player.getInventory().equipItemAndRecord(tiara);//equip the tiara if you want
                  player.setNoble(true, true);
                  player.sendPacket(new UserInfo(player));
                  html.setFile("data/html/classmaster/nobleok.htm");
                  }else
                     player.sendMessage("You don't have enough items.");

 

But without error, or good description what exacly happend when you click/talk with the NPC...

 

 

  • 0
Posted

Man consider learning some more english becouse I am not able to understand what are your error in this case?

As i see the only problem could be in this lines:

   //then you ask for items                  
                  if(
                  player.getInventory().getItemByItemId(12345/**1 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**2 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**3 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  && player.getInventory().getItemByItemId(12345/**4 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  ){
                  L2ItemInstance tiara = player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara
                  player.getInventory().equipItemAndRecord(tiara);//equip the tiara if you want
                  player.setNoble(true, true);
                  player.sendPacket(new UserInfo(player));
                  html.setFile("data/html/classmaster/nobleok.htm");
                  }else
                     player.sendMessage("You don't have enough items.");

 

But without error, or good description what exacly happend when you click/talk with the NPC...

i talk with the NPC i click in become nobles and he say You don't have enough items and me have items.. understand?

  • 0
Posted

i talk with the NPC i click in become nobles and he say You don't have enough items and me have items.. understand?

 

Tell me what chronicle is your L2J?

  • 0
Posted

Well, he asked for the code in this topic  http://maxcheaters.com/forum/index.php?topic=271490.0 but i haven't tested it when i wrote.... so, i think he might have not changed the '12345' to item ids he wanted to ask for ?

 

 

Guest
This topic is now closed to further replies.


×
×
  • Create New...