Jump to content

Question

Posted (edited)

Hi everybody,

 

i try at the moment to add some items for newbies.

But it doesnt work and i think i do something wroung.

It tried this:

ItemTable.getInstance();
        L2Item[] items = template.getItems();
        for (L2Item item2 : items)
        {
            L2ItemInstance item = newChar.getInventory().addItem("Init", item2.getItemId(), 1, newChar, null);
            L2ItemInstance item1 = newChar.getInventory().addItem("Init", item2.getItemId(), 1, newChar, null);
            L2ItemInstance item11 = newChar.getInventory().addItem("Init", item2.getItemId(), 1, newChar, null);
            if (item.getItemId() == 5588)
            {
                if (item1.getItemId() == 3470)
                {
                    if (item11.getItemId() == 5134)
                    {
                    }
                    
                }

But it dont know what i need to do exactly.

Thanks in advance.

sir

Edited by sirreaven

6 answers to this question

Recommended Posts

  • 0
Posted

go to CharacterCreate.java and add this

			}
		}
		
+		/** Custom Starting Items */
+		if (Config.ENABLE_NEWCHAR_ITEMS)
+		 {
+			 newChar.getInventory().addItem("New Item", Config.STARTING_ITEM_ID , Config.STARTING_ITEM_COUNT, newChar, null);
+		 }
		
		for (L2SkillLearn skill : SkillTreeTable.getInstance().getAvailableSkills(newChar, newChar.getClassId()))
		{

and the configs

    /** New Char Items */
    public static boolean ENABLE_NEWCHAR_ITEMS;
    public static int STARTING_ITEM_ID;
    public static int STARTING_ITEM_COUNT;
/** New Char Items */
ENABLE_NEWCHAR_ITEMS = Boolean.parseBoolean(customstarting.getProperty("EnableNewcharItems", "False"));
STARTING_ITEM_ID = Integer.parseInt(customstarting.getProperty("StartingItemId", "50000"));
STARTING_ITEM_COUNT = Integer.parseInt(customstarting.getProperty("StartingItemCount", "1"));
# ----------------------------------
# Custom Starting Item
# ----------------------------------
# Enable Custom Starting Item?
# Default: False
EnableNewcharItems = True
StartingItemId = 50005
StartingItemCount = 1
  • 0
Posted (edited)

Hi everybody,

 

i try at the moment to add some items for newbies.

But it doesnt work and i think i do something wroung.

It tried this:

ItemTable.getInstance();
        L2Item[] items = template.getItems();
        for (L2Item item2 : items)
        {
            L2ItemInstance item = newChar.getInventory().addItem("Init", item2.getItemId(), 1, newChar, null);
            L2ItemInstance item1 = newChar.getInventory().addItem("Init", item2.getItemId(), 1, newChar, null);
            L2ItemInstance item11 = newChar.getInventory().addItem("Init", item2.getItemId(), 1, newChar, null);
            if (item.getItemId() == 5588)
            {
                if (item1.getItemId() == 3470)
                {
                    if (item11.getItemId() == 5134)
                    {
                    }
                    
                }

But it dont know what i need to do exactly.

Thanks in advance.

sir

bist du deutcher oder?? and you can add items with xml's

Edited by Reborn12
  • 0
Posted (edited)

First line is useless, then you decide to iterate over template items, and for each item you decide to add 3 items on player inventory.

            if (item.getItemId() == 5588)
            {
                if (item1.getItemId() == 3470)
                {
                    if (item11.getItemId() == 5134)
                    {
                    }

is a logcial nonsense, because if your item got 5588, it can't be 3470, and if it's 3470, it can't be 5134. You also have to refer to item2, as it's the current name you give on the for loop to iterate over the template items. So you probably meant :

if (item2.getItemId() == X)
doSomething();
else if (item2.getItemId() == Y)
doAnotherThing();
else if (item2.getItemId() == Z)
doCrappyThing();

I also guess you misunderstand the use of for loop. Maybe it's time to read about it...?

Edited by Tryskell
  • 0
Posted

bist du deutcher oder?? and you can add items with xml's

 

Guten Abend,

genau das bin ich :)

Wie kann ich Newbie Items mit ner simplen xml hinzufügen?

 

 

 

Thank you all for the help :)

Im happy no flame or trash :)

Just some helpful comments :)

  • 0
Posted

 

go to CharacterCreate.java and add this

			}
		}
		
+		/** Custom Starting Items */
+		if (Config.ENABLE_NEWCHAR_ITEMS)
+		 {
+			 newChar.getInventory().addItem("New Item", Config.STARTING_ITEM_ID , Config.STARTING_ITEM_COUNT, newChar, null);
+		 }
		
		for (L2SkillLearn skill : SkillTreeTable.getInstance().getAvailableSkills(newChar, newChar.getClassId()))
		{

and the configs

    /** New Char Items */
    public static boolean ENABLE_NEWCHAR_ITEMS;
    public static int STARTING_ITEM_ID;
    public static int STARTING_ITEM_COUNT;
/** New Char Items */
ENABLE_NEWCHAR_ITEMS = Boolean.parseBoolean(customstarting.getProperty("EnableNewcharItems", "False"));
STARTING_ITEM_ID = Integer.parseInt(customstarting.getProperty("StartingItemId", "50000"));
STARTING_ITEM_COUNT = Integer.parseInt(customstarting.getProperty("StartingItemCount", "1"));
# ----------------------------------
# Custom Starting Item
# ----------------------------------
# Enable Custom Starting Item?
# Default: False
EnableNewcharItems = True
StartingItemId = 50005
StartingItemCount = 1

 

this will add item not items

  • 0
Posted
           L2ItemInstance item = newChar.getInventory().addItem("Init", item2.getItemId(), 1, newChar, null);
            L2ItemInstance item1 = newChar.getInventory().addItem("Init", item2.getItemId(), 1, newChar, null);
            L2ItemInstance item11 = newChar.getInventory().addItem("Init", item2.getItemId(), 1, newChar, null);
            if (item.getItemId() == 5588)
            {
                if (item1.getItemId() == 3470)
                {
                    if (item11.getItemId() == 5134)
                    {
                    }
                    
                }

It's dead code because item == item1 == item11.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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