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

    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt
    • Why adena in this sever so expensive 🙂
  • Topics

×
×
  • Create New...