Jump to content
  • 0

[Help] Need dev help to develope 2 things (inside)


Question

Posted

hello i would like to know if some1 can help me with some scripts in l2j interlude :

1) make buff shop like any other private store what thats means? - when i press on buffer shop list of buffs appear show me player mana and buff cost - also player buffer can choose which buffs to put

 

2)make an enchant zone - put an npc in center of giran and players can only use enchant if they are stand near this npc

this npc is nothing the area is what important

 

thanks alot

Recommended Posts

  • 0
Posted

easy to do, create new zone, in type write NoEnchant

now in zone>types create new class, name it L2NoEnchantZone, in method on enter write:

character.setInsideZone(L2Character.ZONE_NOENCHANT, true);

in method onExit, write: character.setInsideZone(L2Character.ZONE_NOENCHANT, false);

now go to L2Character, add new type: public static final byte ZONE_NOENCHANT = 22;

now go to RequestEnchantItem class, add there check:

if(activeChar.isInsideZone(L2Character.ZONE_NOENCHANT)){

activeChar.sendMessage("You can not enchant here");

return;

}

 

Its for h5, no idea how will it be in interlude, hf :)

  • 0
Posted

easy to do, create new zone, in type write NoEnchant

now in zone>types create new class, name it L2NoEnchantZone, in method on enter write:

character.setInsideZone(L2Character.ZONE_NOENCHANT, true);

in method onExit, write: character.setInsideZone(L2Character.ZONE_NOENCHANT, false);

now go to L2Character, add new type: public static final byte ZONE_NOENCHANT = 22;

now go to RequestEnchantItem class, add there check:

if(activeChar.isInsideZone(L2Character.ZONE_NOENCHANT)){

activeChar.sendMessage("You can not enchant here");

return;

}

 

Its for h5, no idea how will it be in interlude, hf :)

 

oh its good this, i think i can work at first phase with this code and evolve it into something that will be work in interlude!!! thanks for your help :)

  • 0
Posted

2nd request is really easy, creating new zone types is pointless tho.

 

Request enchant item, there is such java class, and in request enchant add check

 

get player known list and check if in certain radious this known list contains npc with xxx ID

  • 0
Posted

thanks for the replies

Matin can u tell me please how to do that radius check because i couldn't find it?

 

Also i got another thing i need help with

i want to add to the "player killed player" announcements the location of the pvp, how can i do that?

So it'll be like: Colisum - Player1 killed Player2

 

Thanks for the help.

  • 0
Posted
Collection<L2Character> knownNPC = activeChar.getKnownList().getKnownCharacters();

 

With this collection you will receive list of known characters in player knownlist.

 

Then by using checkIfInRange method, from Util class, you can check if character x is in radious to the character y

 

 

  • 0
Posted

i tried it like that and it doesn't work, what did i do wrong ? (i can still enchant anywhere)

		for(L2Object obj : activeChar.getKnownList().getKnownCharacters())
	{
		if(obj.getName().equals("Holy Braizer"))
		{
	    	if (!Util.checkIfInRange(100, activeChar, obj, false))
	    	{
				activeChar.setActiveEnchantItem(null);
				activeChar.sendMessage("You can only enchant items near the Braizer of enchantments!");
				return;
	    	}
		}
	}

 

thanks for the help

  • 0
Posted

Like Matim said, it's pointless to use a zone for such thing, just checking the range is enough. I have to say such method already exists and is normaly include to any L2Npc.canInteract( will check many conditions (depends of your chronicle), interaction range is one of them.

 

You don't have to use knownlist and such stuff aswell :P.

 

My current method is as following :

 

    /**
     * This method checks if the player given as argument can interact with the L2Npc.
     * @param player The player to test
     * @return true if the player can interact with the L2Npc
     */
    public boolean canInteract(L2PcInstance player)
    {
	if (player.isCastingNow() || player.isCastingSimultaneouslyNow())
		return false;
	if (player.isDead() || player.isFakeDeath())
		return false;
	if (player.isSitting())
		return false;
	if (player.getPrivateStoreType() != 0)
		return false;
	if (!isInsideRadius(player, INTERACTION_DISTANCE, true, false))
		return false;

        return true;
    }

 


 

Your first ask isn't possible. You have to use voicedcommands if you want that works. Basically people won't help you on that except if they're payed. And I don't think you can have a good result, that will look "homemade".

  • 0
Posted

but how do i use it to acheive what i need ?:\

 

		for(L2Object obj : activeChar.getKnownList().getKnownCharacters())
	{
		if(!obj.getName().equals("Holy Brazier") && !Util.checkIfInRange(5, activeChar, obj, false))
		{
			activeChar.setActiveEnchantItem(null);
			activeChar.sendMessage("You can only enchant items near the Braizer of enchantments!");
			return;
		}
	}

 

didn't work out aswell

  • 0
Posted

1) Question

 

class ShopBuffer extends Quest
{
private static final String qn = "ShopBuffer";
private static final int COST_ID = 0;
private static final int COST_AMOUNT = 0;

private FastList<L2Skill> _npcBuffs = new FastList<L2Skill>();

public ShopBuffer(int questId, String name, String descr)
{	
	super(questId, name, descr);
	// Buff loading, manual put, from db, whatever...
}

@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
	String content = getBuyHtml(npc.getObjectId());
	NpcHtmlMessage msg = new NpcHtmlMesage(npc.getObjectId());
	msg.setText(content);
	player.sendPakcet(content);
	updateMPStatus(player);
	return null;
}


private String getBuyHtml(final int objectId)
{
	StringBuilder sb = new StringBuilder();
	sb.append("<html><title>Shop Buffer</title><body><br> +
		"Welcome to the Shop buffer. Click on the buffs you wanna get!<br><br>");

	for(L2Skill sk : _npcBuffs)
	{
		final int id = sk.getId();
		String iconSkill = id > 1000? "icon.skill"+id : "icon.skill0"+id;
		sb.append("<a action=\"bypass -h Quest ShopBuffer addBuffToQueue_"+id+"\"><img src=\""+iconSkill+"\"> width=32 height=32></a>
	}

	sb.append("<br><br>");
	sb.append("Your selected buffs:<br>");

	List<L2Skill> playerBuffQueue = player.getBuffQueue(); 	// This should be created in pcisntance or another store class and will containt the
								// buffs that player has choosen, cleared once he has buff himself

	if(playerBuffQueue.size() > 0)
	{
		for(L2Skill sk : playerBuffQueue)	
		{
			final int id = sk.getId();
			String iconSkill = id > 1000? "icon.skill"+id : "icon.skill0"+id;
			sb.append("<img src=\""+iconSkill+"\" width=32 height=32>
		}
	}

	sb.append("</body></html>
	return sb.toString();
}

public double getConsumedMp(FastList<L2Skill> queue)
{
	double result = 0;
	for(L2Skill sk : queue)
	{
		result += sk.getMpConsume();
	}
	return result;

private void updateMPStatus(L2PcInstance player)
{
	double consume = getConsumeMp(player);
	ExDuelUpdateUserInfo eduui = new ExDuelUpdateUserInfo(player, consume);
	player.sendPacket(eduui); 
}

public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	if(event.startsWith("addBuffToQueue"))
	{
		String[] split = event.split("_");
		if(split < 2)
			return null;

		int skillId = 0;
		try { skillId = Integer.parseInt(split[1]); } catch(Exception e) { e.printStackTrace(); }
		if(skillId > 0)
		{
			L2Skill choosen = null;
			for(L2Skill sk : _npcBuffs)
				if(sk.getId() == skillId)
				{
					choosen = sk;
					break;
				}
			if(choosen != null)
			{
				if(getConsumeMp(player.getBuffQueue) + choosen.getConsumeMp() > player.getMp())
					player.sendMessage("You dont have enough mana to use this skills!");
				else
				{
					player.addSkillToQueue(choosen);
					updateMpStatus(player);
				}
			}
	}
	else if(event.equals("buffMe"))
	{
		if(player.getBuffQueue().size() > 0)
		{
			if(getConsumeMp(player.getBuffQueue) > player.getMp())
				player.sendMessage("You dont have enough mana to buff yourself!");
			else if(player.destroyItem("Shop Buffer", COST_ID, COST_AMOUNT, npc, true))
			{
				for(L2Skil sk : player.getBuffQueue())
					sk.getEffects(player, player);
				player.clearBuffQueue();
				updateMPStatus(player);
			}
		}
	}
}
}

 

You will need to modify a little ExDuelUpdateUserInfo to build a constructor to pass a custom mp var.

Also, the script it self wont be working, is written using notepad, so it miss imports and im prolly will have any syntax error

  • 0
Posted

I don't know if I or BigBoss misunderstood your first 1, but what is the goal ?

 

You want player sell their buffs as if they were on private shop ? So others players can buy from them ? Like a dwarven manufacture, where you see recipes and can craft from AFK guys ?

  • 0
Posted
I don't know if I or BigBoss misunderstood your first 1, but what is the goal ?

 

You want player sell their buffs as if they were on private shop ? So others players can buy from them ? Like a dwarven manufacture, where you see recipes and can craft from AFK guys ?

 

Excactly, example below:

292uskn.jpg

  • 0
Posted

Well it can wait, i want to finish thing by thing first

 

I've still didnt find any solution to the enchant zone problem, any1 got any idea about it?

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

    • Mate your server used to play with full of bots, from where you find that revenue? 
    • IAM one of customers of this project. Have anti cheat, have user panel everything is working. Blocking adrenaline trashy plans without any problems.  So just GL for all lin2 project. I get support every time I need it. 
    • Convert package formats from Old to New in one click Create new packages of any format Lineage2Ver121 encryption (included in the package) Safe editing: work in a copy, full undo history (Ctrl+Z / Ctrl+Shift+Z), single "Save" button System integration Open .utx / .ugx files with a single click in Explorer (associations are registered during installation) One example: open a file and add its tab to an existing window Multilingual interface (EN, RU, UK, ES, PT, EL, KO, VI, ZH) — the language is picked up from the system Supported formats Packages: UTX, UGX Textures: RGBA8, DXT1, DXT3, DXT5, G16, P8 Resources: GFX (Scaleform) Requirements Windows. Java is not required—it's included in the build. Installation Run La2Tools-3.0.2.exe—the installer will create shortcuts and register related files. Alternatively, use the portable version. https://la2.tools/files/La2Tools_3.0.3_setup.exe   https://la2.tools/files/La2Tools_3.0.3_portable.zip  - Portable version  
    • WHEN SAYING “YES” IS A MISTAKE Not every project is worth taking on, even if the client is ready to pay. Sometimes refusing isn’t about losing money — it’s about protecting your reputation and time. Over the years, we’ve learned to quickly spot the cases that are almost guaranteed to turn into problems. Here are the most common situations where we turn down work: ▪ The client wants it “like everyone else’s,” but with lots of custom changes and on a minimal budget ▪ There are no proper source materials, yet the deadlines are already burning and everything is needed “yesterday” ▪ Constant changes to requirements after the work has already started ▪ A task with a very low chance of success, but very high expectations ▪ The client isn’t willing to discuss the process and sees us as just an executor - A good result almost always starts when both sides have an honest understanding of the risks and real possibilities of the project. If you’re currently discussing a project and unsure whether to move forward — write to us. We’ll honestly and directly tell you whether it’s worth taking on or if it’s better to look for another solution. › TG: @mustang_service_ms ( https:// t.me/ mustang_service_ms ) › Channel: Mustang Service ( https:// t.me/ +JPpJCETg-xM1NjNl ) #documents #drawing #photoshop #refuse #cases
  • 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..