Jump to content
  • 0

Error In Deleveler Npc


Question

Posted

I am trying to adapt this NPC to aCis but I faced a problem. 

 

Here is the Script

package custom.DeLevelManager;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.UserInfo;

/**
 * @author `Heroin
 * Made For Maxcheaters.com
 */
public class DeLevelManager extends Quest
{
	private static final int npcid = 36650; // npc id
	private static final int MinLevel = 10; // Minimum Level, (e.g if you set 10, players wont be able to be level 9).
	private static final int ItemConsumeId = 57; // Item Consume id
	private int levels ; // Item Consume id
	private static final int ItemConsumeNumEveryLevel = 100; // Item ItemConsumeNumEveryLevel
	private static String htm = "data/scripts/custom/DeLevelManager/1.htm"; //html location
	private static String ItemName = ItemTable.getInstance().createDummyItem(ItemConsumeId).getItemName();
	
	public DeLevelManager(int questId, String name, String descr)
	{
		super(questId, name, descr);
		addFirstTalkId(npcid);
		addTalkId(npcid);
		addStartNpc(npcid);
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		if (event.startsWith("dlvl"))
		{
			Dlvl(event, npc, player, event);
		}

		return "";
	}
	
	private void Dlvl(String event, L2Npc npc, L2PcInstance player, String command)
	{
		
		try
		{
			String val = command.substring(5);
			int pointer = Integer.parseInt(val);
			int k = player.getLevel();
			levels = k - pointer;
			if (player.getInventory().getItemByItemId(ItemConsumeId) == null)
			{
				player.sendMessage("You don't have enough items!");
				return;
			}
			if (val == null)
			{
				player.sendMessage("Something went wrong!");
				return;
			}
			if (pointer < 10)
			{
				player.sendMessage("Incorrect Level Number!");
				return;
			}
			if (pointer < MinLevel)
			{
				player.sendMessage("Incorrect Level Number!");
				return;
			}
			if (player.getLevel() <= pointer)
			{
				player.sendMessage("Your level is already lower.");
				return;
			}
			if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() < ItemConsumeNumEveryLevel*levels)
			{
				
				player.sendMessage("You don't have enough items!");
				return;
			}
			if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() >= ItemConsumeNumEveryLevel)
			{
				k = player.getLevel();
				final byte lvl = Byte.parseByte(pointer + "");	
				player.getStat().setLevel(lvl);
				player.sendMessage("Congratulations! You are now "+pointer+" level.");
				for(L2Skill sk : player.getAllSkills())
				{
					player.removeSkill(sk);
				}
				player.broadcastStatusUpdate();
				player.broadcastUserInfo();
				player.sendPacket(new UserInfo(player));
				player.sendPacket(new ExBrExtraUserInfo(player));
				player.giveAvailableAutoGetSkills();
				player.giveAvailableSkills(true, true);
				player.sendSkillList();
				levels = k - pointer;
				player.destroyItemByItemId("DlvlManager", ItemConsumeId, ItemConsumeNumEveryLevel*levels, player, true);
			}
		}
		catch (Exception e)
		{
			player.sendMessage("Something went wrong try again.");
		}
	}
	
	
	
	@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		final int npcId = npc.getNpcId();
		if (player.getQuestState(getName()) == null)
		{
			newQuestState(player);
		}
		if (npcId == npcid)
		{
			String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htm);
			html = html.replaceAll("%player%", player.getName());
			html = html.replaceAll("%itemname%", ItemName);
			html = html.replaceAll("%price%", ""+ItemConsumeNumEveryLevel+"");
			
			NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
			npcHtml.setHtml(html);
			player.sendPacket(npcHtml);
		}
		return "";
	}
	
	public static void main(final String[] args)
	{
		new DeLevelManager(-1, DeLevelManager.class.getSimpleName(), "custom");
		System.out.println("De Level Manager by `Heroin has been loaded successfully!");
	}
}

This is the error:

String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htm);

5 answers to this question

Recommended Posts

  • 0
Posted
String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix());
maybe

 

You're wrong.

 

Correct answer:

String html = HtmCache.getInstance().getHtm(htm);

 

  • 0
Posted (edited)

I'm fed up to see those idiots 

if (npcId == npcid)

if you registered only a single NPC it can only affect the one you registered. It would have a use only if you register numerous ids and they got a different behavior.

 

And the return isn't even used... Finally if it's to static the data, better write it directly into the htm to avoid crappy stuff.

	@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		if (player.getQuestState(getName()) == null)
			newQuestState(player);
		
		String html = HtmCache.getInstance().getHtm(htm);
		html = html.replaceAll("%player%", player.getName());
		html = html.replaceAll("%itemname%", ItemName);
		html = html.replaceAll("%price%", ""+ItemConsumeNumEveryLevel+"");
		
		return html;
	}
Edited by Tryskell
  • 0
Posted

What means this error in GS console 

ScriptManager: Error loading "scripts.xml" file, java.lang.InstantiationExceptio
n: net.sf.l2j.gameserver.scripting.scripts.custom.DeLevelManager
  • 0
Posted

That means exactly what does it means

 

 

Error loading "scripts.xml" file

 

You did something wrong there, simple.

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

    • Our sales are ongoing. Bump. 02 July 2025 Telegram: ContactDiscordAccS
    • Our sales are ongoing. Bump. 02 July 2025 Telegram: ContactDiscordAccS
    • just with this extender that I have shared it is not possible to start with c4 client, you have to make some changes to the extender and it works with c4 client perfectly. regarding the updates in this last revision   🔹dll is not packaged with vmprotect   New custom zone types have been added: 🔹 NO_NOBLESS begin MinX=84638 MaxX=92616 MinY=-87170 MaxY=-82018 MinZ=-6000 MaxZ=0 Type=NO_NOBLESS KickOutPos=83007/148057/-3464 end   ▶️ This zone checks if the character is noble. If it does not meet the condition, it will be automatically kicked to the indicated position (KickOutPos). 🔹 CUSTOM_SPAWN_ZONE begin MinX=77275 MaxX=85704 MinY=10122 MaxY=18066 MinZ=-8000 MaxZ=5000 Type=CUSTOM_SPAWN_ZONE OutPos=83007/148057/-3464 Spawns={{82984/18066/-5256}};{{79275/15147/-5248}};{{82922/14263/-5256}};{{83704/10122/-5288}} end ▶️ This zone allows characters, upon death, to respawn with full buff, CP, HP and MP if they press “Fixed”. They will only be able to revive in one of the positions defined in Spawns. 🔧 Both zones are fully configurable from territorydata.txt 🔧 Development Repository (SVN) GX-EXT supports open, collaborative, and professional development. That’s why we provide access to our public SVN repository where you can:   ✅ Compile your own version of the project ✅ Optimize and extend its features ✅ Learn from real production-quality source code   🔒 Delayed access: The repository is always 2 months behind the latest commercial release to prevent unauthorized reselling.   🔗 SVN URL: https://svn.l2servers.com.ar/!/#GX-EXT_INTERLUDE Username: gx Password: gx   You can use tools like TortoiseSVN to download and work with the code.
    • Could you tell me what changed in this update?   more one question: Is it possible to log in through the c4 client instead of interlude? That would be great  
    • ➡ Discount for your purchase: JULY2025 (11% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock