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

    • ## SuperPoint Editor   SuperPoint Editor is a practical visual editor for Lineage II PTS 'SuperPoint.bin' files. It is built for people who need to inspect, fix, rebuild, and draw server routes without digging through binary data by hand.   ### What You Can Do   - Open and edit 'SuperPoint.bin' files. - Export BIN data into a readable TXT format. - Save edited data back into a valid BIN file. - Validate routes before saving. - Work with SuperPoint routes, points, directed connections, and path records in tables. - Add, duplicate, delete, and reorder points. - Create direct and reverse connections between route points. - Automatically generate connections between neighboring points. - Edit raw point coordinates: 'X', 'Y', 'Z', 'Index', and 'Delay'. - Keep route names and internal route data organized. - Use either English or Ukrainian interface language.   ### C4 Server Support   Some C4 servers have 'SuperPoint.bin', but do not have 'superpointinfo.txt' in scripts. The editor supports this case directly. When 'superpointinfo.txt' is not found near the BIN file, the editor can open the BIN in C4 mode. In this mode, 'Fstring ID' is disabled because that value belongs to 'superpointinfo.txt', not to the BIN itself. The editor will not generate or modify 'superpointinfo.txt' while working in this mode. This keeps C4 data clean and avoids creating script files that the server does not actually use.   ### superpointinfo.txt Support   For chronicles that do use 'superpointinfo.txt', the editor can load and synchronize it together with the BIN data. When saving, the editor updates route nodes and coordinates while preserving existing metadata such as: - 'npc_name' - 'move_type' - 'fstring_index' - 'social_number' - 'delay' New nodes are generated with safe default values, so existing script metadata is not accidentally wiped.   ### Geodata Tools   The editor can also open converted geodata '.dat' files and display them as a map. This makes route editing much more visual. You can: - Load geodata and inspect the terrain by layer. - Zoom and pan around the map. - Create a new SuperPoint directly from a map cell. - Draw a route by clicking on the geodata. - Drag existing points to new positions. - Automatically snap 'X/Y' to the selected geo cell. - Use the selected geodata layer to fill the point 'Z'. - See all routes on the map or focus only on the selected one. This is especially useful when building new NPC movement paths or correcting bad route coordinates.   ### Connections and Paths   SuperPoint connections are directional. A connection from point '3' to point '2' is not the same as a connection from point '2' to point '3'. The editor makes this explicit by separating: - route points, - directed connections, - and the actual path records used by each connection. For simple cases, it can create direct path records automatically. For more complex movement, you can edit the path points manually. ### Built for Safe Editing The editor includes validation before saving, so common structural problems can be caught before a broken BIN is produced. It also verifies rebuilt BIN files through the converter engine. The goal is simple: edit quickly, but do not silently damage server data.   ### Unknown Field   This small 'Unknown' field is part of the original BIN structure. Most official-looking files keep it as '0', and for regular route editing there is usually no reason to change it. The editor exposes it so nothing from the BIN is hidden or lost. If you do not know exactly what your server uses it for, keep it at '0'. Download
    • NpcGrp não salva no interlúdio e da crítico quando coloca ele no cliente, já testei ele antes.
  • 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..