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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • For the first time in thousands of posts I've read on this forum, I’ve actually found a message that is enriching on both a personal and professional level. I’ll take your advice to heart: I’m going to start creating more and stop overthinking things that get me nowhere. I totally agree about the toxic community; it's a shame. Time to keep working. Thanks a lot for your input.   Exactly, that’s why the Scryde method and their merge system work so well. People don't lose their progress and can still keep rushing new servers. Obviously, gameplay has mutated into something much faster-paced, but obviously, this happens in real life too, everyone is more accelerated and on edge. Thanks to social media and mental conditioning. But, well, it’s something we have to accept. Don't even get me started on gambling and online casinos; that’s a whole other topic regarding all the P2W servers.   Really, amen bro.
    • Hello, the server lifespan isn't something that only affects Argentina; just look at the South American and European communities. Those distant days you mentioned, when we were younger, which I completely agree with, are long gone. Today, the community plays RUSH for 30 or 60 days and seeks the adrenaline rush of starting over. As for free or paid packs, there are many options, but in all of them, you'll have to create your own unique style.  
    • Introducing: NimeraCP V2! What's New: Realtime Tickets (Receive + Send messages without refreshing page, instant delivery to player) Powered by WebSockets Realtime Rankings/Stats (Receive instant updates without refreshing page) Powered by WebSockets - PvP/Boss Rankings/Clan Rankings etc... oAuth Login + Register (VK, Discord, Google) Two Factor Authentication (Authenticator App) Passkey coming soon! Theme Editor New Arcade Game: Rock Paper Scissors Let players gamble wagering their topped up wallet balance! Discord Webhooks: Receive messages to discord via Bot or Webhook for certain events New Player registration New Payment received New Ticket Opened and more Complete UI Overhaul NimeracCP V2 is now fully multilangual supporting the following languages: English Ελληνικά Português / Brasileiro Español Русский Українська 한국어 Onboarding: Easy installation wizard via /onboarding on first use of the panel for easy installation. Feature Flags: You have full control over the UI. Disable/Enable pages + features via Admin CP CloudFlare R2 Bucket integration: The panel comes with Bucket storage integration for all kinds of assets uploaded to the panel.   A new website shop at https://nimeracp.com/ is also coming soon, including full installation docs.  You can join the discord for further updates/questions: https://discord.nimeracp.com/
    • thanks for choosing me ! 
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock