Jump to content

Question

Posted (edited)

-Hello once again . I have an issue:

-I have found a code for Newbie zone depends by level but i want to depends by echant of amor/weapon/jewel (no more than +6)

also getflag on enter and setflag(0) on exit.

\

 

Code:

Spoiler

    protected void onEnter (final L2Character character)
    {
        if (character instanceof L2PcInstance)
        {
            if ((((L2PcInstance) character) .isNewbie ()))
            {
                ((L2PcInstance) character) .sendMessage ("You entered the Newbie Zone.");
                ((L2PcInstance) character) .sendMessage ("This area is protected up to level" + Config.MAX_LEVEL_NEWBIE_STATUS + ", from level" + (Config.MAX_LEVEL_NEWBIE_STATUS + 1) + "the player who attempts to enter will be removed from the area . ");
            }
        }
            else

 

Spoiler

    protected void onExit (final L2Character character)
    {
        ((L2PcInstance) character) .sendMessage ("You left the Newbie Zone.");
    }

 

Edited by scraw

Recommended Posts

  • 1
Posted (edited)

You can do it by FuncEnchant , keep player items , and calculate their status for a specific enchant level(like max olympiad enchant) 

Edit the isInsideZone(ZONE_PVP) to your needs

int maxZoneEnchant = 6;	
		if (env.player != null && env.player instanceof L2PcInstance)
		{
			final L2PcInstance player = (L2PcInstance) env.player;
			if (player.isInsideZone(ZONE_PVP) && maxZoneEnchant >= 0 && (enchant + overenchant) > maxZoneEnchant)
			{
				if (maxZoneEnchant > 3)
				{
					overenchant = maxZoneEnchant - 3;
				}
				else
				{
					overenchant = 0;
					enchant = maxZoneEnchant;
				}
			}
		}

 

Edited by @IcathiaLord
  • Thanks 1
  • Upvote 1
  • 0
Posted
if (character instanceof Player)
{
	final Player player = (Player) character;
	final ItemInstance item = player.getInventory().getItems().stream().filter(item -> item.getEnchantLevel() > 6 && item.isEquipped()).findFirst().orElse(null);
	if (item != null)
	{
		player.sendMessage(String.format("Maximum enchant in this zone +6. You can't use the item %s", item.getName()));
		// Handle telportation here
	}
}

This code is written in acis. adapt it with the proper method names to fit on frozen

Note: You MUST handle the equip case when the player is already in the zone. onEnter is not enough for this kind of feature

  • 0
Posted (edited)

you have to edit atleast 2 places to prevent ppl from entering or equipping items in zones

 

you can add this in l2pcinstance/playerinstance and use it anywhere

 


    public boolean hasEnchantedItems()
    {
        return getInventory().getItems().stream().filter(item -> item.getEnchantLevel() > 6 && item.isEquipped()).findFirst().orElse(null) != null;
    }

 

like

 

if(player.hasEnchantedItems())
{
 // preventation
 return;
}

Edited by BruT
  • 0
Posted (edited)
53 minutes ago, melron said:

if (character instanceof Player)
{
	final Player player = (Player) character;
	final ItemInstance item = player.getInventory().getItems().stream().filter(item -> item.getEnchantLevel() > 6 && item.isEquipped()).findFirst().orElse(null);
	if (item != null)
	{
		player.sendMessage(String.format("Maximum enchant in this zone +6. You can't use the item %s", item.getName()));
		// Handle telportation here
	}
}

This code is written in acis. adapt it with the proper method names to fit on frozen

Note: You MUST handle the equip case when the player is already in the zone. onEnter is not enough for this kind of feature

i'll try

 

53 minutes ago, BruT said:

you have to edit atleast 2 places to prevent ppl from entering or equipping items in zones

how do so ?

Edited by scraw
  • 0
Posted (edited)

edited above.

 

the one must be in enterZone the other in UseItem.java somewhere

 

preventation is up to your imagination

Edited by BruT
  • 0
Posted
53 minutes ago, melron said:

if (character instanceof Player)
{
	final Player player = (Player) character;
	final ItemInstance item = player.getInventory().getItems().stream().filter(item -> item.getEnchantLevel() > 6 && item.isEquipped()).findFirst().orElse(null);
	if (item != null)
	{
		player.sendMessage(String.format("Maximum enchant in this zone +6. You can't use the item %s", item.getName()));
		// Handle telportation here
	}
}

This code is written in acis. adapt it with the proper method names to fit on frozen

Note: You MUST handle the equip case when the player is already in the zone. onEnter is not enough for this kind of feature

java 1.7 please

 

52 minutes ago, BruT said:

you have to edit atleast 2 places to prevent ppl from entering or equipping items in zones

 

you can add this in l2pcinstance/playerinstance and use it anywhere

 


    public boolean hasEnchantedItems()
    {
        return getInventory().getItems().stream().filter(item -> item.getEnchantLevel() > 6 && item.isEquipped()).findFirst().orElse(null) != null;
    }

 

like

 

 


if(player.hasEnchantedItems())
{
 // preventation
}

 

so , im sorry but where exactly i add those lines?

  • 0
Posted (edited)
2 minutes ago, zemaitis said:

What's the point in checking if player has enchanted over +6 items during teleport? What if they teleport to zone and enchant items there?

i want to activate this to a teleport for newbies and prevent unfair pvp's (there will be no shops or towns nearby )

Edited by scraw
  • 0
Posted
1 minute ago, scraw said:

i want to activate this to a teleport for newbies and prevent unfair pvp's (there will be no shops or towns nearby )

But they can bring enchant scrolls and weapons there and enchant

  • 0
Posted (edited)
21 minutes ago, zemaitis said:

But they can bring enchant scrolls and weapons there and enchant

thats why melron says checkinvetory ..

 

45 minutes ago, BruT said:

edited above.

 

the one must be in enterZone the other in UseItem.java somewhere

 

preventation is up to your imagination

i have already these lines in l2pcinstance

Spoiler

    public int getItemCount(final int itemId, final int enchantLevel)
    {
        return _inventory.getInventoryItemCount(itemId, enchantLevel);
    }

is that u meant?

 

52 minutes ago, BruT said:

you have to edit atleast 2 places to prevent ppl from entering or equipping items in zones

 

you can add this in l2pcinstance/playerinstance and use it anywhere

 


    public boolean hasEnchantedItems()
    {
        return getInventory().getItems().stream().filter(item -> item.getEnchantLevel() > 6 && item.isEquipped()).findFirst().orElse(null) != null;
    }

 

like

 


if(player.hasEnchantedItems())
{
 // preventation
 return;
}

ok i understand what u mean..but this code is writen with 1.8 and i have 1.7 so many erros come out

Edited by scraw
  • 0
Posted (edited)

Hello, It's me ! (kidding)

 

@scraw Double or triple posts/replies are not allowed . Please read the forum rules. You can use your edit button.

 

Thanks.

Edited by Justice
  • 0
Posted
2 minutes ago, Justice said:

Hello, It's me ! (kidding)

 

@scraw Double or triple posts/replies are not allowed . Please read the forum rules. You can use your edit button.

 

Thanks.

oh ok .apologies u can delete the first replies .

  • 0
Posted (edited)

to be honest your idea is abit crappy and old, the best version of this mod is to set players enchantent to max +6 when they enter a specific zone, its abit more complicated but its way better. i thin there are such shares somewhere in the forum.

Edited by BruT
  • 0
Posted (edited)
On 4/29/2020 at 4:23 PM, @IcathiaLord said:

You can do it by FuncEnchant , keep player items , and calculate their status for a specific enchant level(like max olympiad enchant) 

Edit the isInsideZone(ZONE_PVP) to your needs


int maxZoneEnchant = 6;	
		if (env.player != null && env.player instanceof L2PcInstance)
		{
			final L2PcInstance player = (L2PcInstance) env.player;
			if (player.isInsideZone(ZONE_PVP) && maxZoneEnchant >= 0 && (enchant + overenchant) > maxZoneEnchant)
			{
				if (maxZoneEnchant > 3)
				{
					overenchant = maxZoneEnchant - 3;
				}
				else
				{
					overenchant = 0;
					enchant = maxZoneEnchant;
				}
			}
		}

 

thanks i think this will save me ..i go test! .but  because isn't pvp zone ( its completely new zone only for newbies) i need and auto-flag on enter and noflag on exit :/ i try to copy paste the autoflag from pvpzone but didnt work properly and have some errors :/.

 

 

* I Tried that but i have multiple errors idk why i delete onEnter via level and i paste above ifinsidezone and your code ,i try to adapt for l2jfrozen but everything i change become one more error :/

Edited by scraw
  • 0
Posted (edited)

The code i provided must be placed at skills.funcs.FucnEnchant.java , i took same code as OlyMaxEnchant from l2jfrozen 1132 , and just changed to your needs .

Change player.isInsideZone(ZONE_PVP) to (ZONE_NEWBIE) or whatever you named , and the enchant will take effect if you are inside this zone .

For onEnter flag you just edit the zone.type.NewbieZone.java method and done.

Edited by @IcathiaLord
Guest
This topic is now closed to further replies.


  • Posts

    • @Darafamboos let him know that this is already shared
    • Selling for 35 us umodel that opens any ukx , utx and static meshes from samurai updat 542 protocol . Leave me a pm if needed. 
    • TG Support: https://t.me/buyingproxysup | Channel: https://t.me/buyingproxycom Discord support: #buyingproxy | Server: Join the BuyingProxy Discord Server!  Create your free account here
    • NEW HIDDENSTASH KEY SYSTEM INTRODUCED TO THE SITE   **Earn While You Spend - Introducing HS Cashback!**   Every purchase on our site now rewards you with **HS Keys cashback**   EVERY ONE WHO REGISTERS IN SITE UNTILL 15TH OF MAY GETS 2000 HS KEYS IN HES BALANE   Here's how it works:       **1 USD = 1000 HS Keys**   **Get 3% cashback** on every purchase   **Use your HS Keys to **save on your next order**   ---   ### ⚡ Why this is awesome   * Every order gives you value back   * Stack it with promos & HS usage   * Turn your spending into future discounts   ---   ### Example   Spend **$10** → Get **300 HS Keys** back   Spend **$50** → Get **1500 HS Keys** back   ---   ### Smart system (built for fairness)   * Cashback is rounded to keep things balanced   * Prevents abuse from tiny orders   * Rewards real buyers   ---   ### Start earning now   Every purchase = progress toward your next discount   Shop now and build your HS balance!   #cashback #gamingdeals #d2r #rewards #loyalty   Stay safe out there, heroes - and happy hunting! www.d2rhiddenstash.com     We just launched our new Affiliate Program — and it’s the easiest way to earn HS Keys.   Invite your friends using your personal link.   Example: If your friend spends $10 → you get 300 HS Keys No limits. No effort. Just share your link.   Get your referral link here: www.d2rhiddenstash.com/profile     Start earning today
    • It’s time for something new to rise. In a world filled with short-lived projects and empty promises, Emerge was created with a different vision — a vision built on experience, precision, and long-term commitment. This is not just another server launch. This is the beginning of something that is meant to last. 🌑 Eclipse x10 – A New Beginning Eclipse x10 is designed for players who seek more than just fast progression. It is built for those who value competition, balance, and a real Lineage II experience. From the very first day, every system has been carefully adjusted to provide a smooth and fair journey — where both solo players and clans can thrive. No shortcuts. No chaos. Only a structured and competitive world. ⚔️ What Awaits You • A balanced mid-rate environment (x10 core progression) • Stable and optimized gameplay • Fair systems with focus on long-term play • Competitive PvP and rewarding PvE • Active and dedicated administration • A project built with vision, not temporary hype 📊 Server Rates Basic: EXP/SP: x10 Adena: x5 Drop: x5 Spoil: x5 Secondary: Quests: x1 Seal Stones: x5 Life Stone Drop: x1 Enchant Scroll Drop: x1 Bosses: Raid Boss EXP/SP: x1 Raid Boss Drop: x1 Epic Boss EXP/SP: x1 Epic Boss Drop: x1 Enchant: Safe: +3 Max: +16 📅 Launch Information Grand Opening: 5 June 2026 The countdown has already begun. Clans are forming. Strategies are being prepared. The question is — will you be ready? 🔗 Join the Community Every strong server begins with a strong community. Be part of it from the very start. 💬 Discord: https://discord.gg/l2emerge 🌐 Website: https://www.l2emerge.com  
  • 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..