Jump to content
  • 0

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


leomade

Question

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

Link to comment
Share on other sites

Recommended Posts

  • 0

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 :)

Link to comment
Share on other sites

  • 0

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 :)

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0
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

 

 

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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".

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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 ?

Link to comment
Share on other sites

  • 0
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • Posts

    • Trustworthy person; hope you find what you're looking for!
    • Customs being added to systextures/animation/texture influences the increase in virtual ram by a very small amount, which means you won't have a headache in the future with critical error issues, unless it's a dubious custom, there are 2 custom weapon packs available for H5 that are "compromised", they didn't make a very good adaptation, one of the packages is the weapons from the goddess of destruction for H5, another is the hero weapons from the goddess of destruction for H5, avoid these customs for your H5 server if you see it on any forum.   Now coming back to your question; one thing that the NCSoft developers never did was add files to their system, probably because they were aware of what could happen when doing that, now think about one thing: the game's system retail itself is no more than 70MB, every time there was an update made by NCSoft they always added the equipment/items/cloaks etc. in their folders intended for that, so why do we do this? I still have my client containing a system with almost 1GB, 1-2h online is the time I can stay online before the ram memory limit, but I have already redone my entire client with customs being destined for textures/systexture/animations, almost all the customs that I had on that client containing a 1GB system I have on my current server, with the difference that I removed everything from the system and critical error is now nothing more than legends, my current server has a total of 220MB in the system folder And theoretically speaking, based on what I've seen, especially on many forums, I believe that the heavier the system folder is, the faster we accelerate the consumption of the client's virtual ram memory, causing countless different types of critical error in one short period of time, in many forums that I've seen on topics involving critical, the solution that stands out the most is about downloading a new clean "system"
    • Do you think that everything on the system is loaded regardless if you use it or not ? or even worst, are they loaded even if they exist as textures/meshes but not defined on the DAT files ?
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hoodservices https://campsite.bio/utchihaamkt
    • Yes, it is, it's not hard to do (if you know what you're doing); just time consuming.   To make some things clear: 1. You can not create .ukx files with animated skeletalmeshes inside, by using any of the freeshared L2Editors (basically, no support for .psa files) 2. You need a patched UT2003/UT2004. You can either get your own ut2004 and download Gildor's patch from his web, or use any of these: When you use these, you should be able to import both .psk and .psa animations > link the skeletalmesh to the psa > save as .ukx > use ut2down to convert the file to l2 format > encrypt the .ukx with standard l2 encryption (you can use mxc encdec, you can find it in the folder of the l2editor i shared). Your best bet is to use pawnviewer (aka dev mode) to test that. If you have troubles with that process then leave a reply here, otherwise, if it works correctly, you can move on to adding missing animnotify classes to you unrealed, then proper animnotifies, sounds, effects or w/e is missing from your .ukx files. Keep in mind that this is overall not difficult but a huge amount of work (unless you're good at scripting/macros) since you'd need to manually re-create every single animnotify, by hand. If you have doubts or i wasn't clear enough let me know here. (in case you don't know what an animnotify is: UDN - Two - AnimNotifies (unrealengine.com) )  
  • Topics

×
×
  • Create New...