Jump to content
  • 0

[help] custom castle npc


Question

Posted

Hello there.

I have a little problem with some npcs in my server. I am running L2jServer freya pack.

As i can remember in my previous servers, when i spawned some npcs

into a castle's throne room then only castle owners could use them. Even the same

global gk i had in every town, when i spawned her in castle she was only speaking to the owners.

But now when i spawn the npc to castle everyone can speak to it.

It's a very big problem for me because i have some npcs inside that suppose to give to

the castle owners some special items and teleport them to places made exclusively for them,

but now everytime the siege starts i have to delete those npcs because every attacker who manages to get inside

can easily use them. Then i have to respawn them again.

Is there any solution so i can make those npcs speak only to castle owners?

Thanx!

PS: sorry for my english. I hope you understood what i was talking about.

6 answers to this question

Recommended Posts

  • 0
Posted

you will need to make java code which will check if those npcs are in siege zone, they are code with java?

  • 0
Posted

Hmm... i can't really understand the question. If you ask if the have scripts, no the dont. They are just some custom npcs with an existing template and l2merchant type.

  • 0
Posted

ok, go to model/actor/L2Npc.java, line about 1310

from:

		default:
			if (npcId >= 31865 && npcId <= 31918)
			{
				if (val == 0 )
					filename += "rift/GuardianOfBorder.htm";
				else
					filename += "rift/GuardianOfBorder-" + val + ".htm";
				break;
			}
			if ((npcId >= 31093 && npcId <= 31094) || (npcId >= 31172 && npcId <= 31201) || (npcId >= 31239 && npcId <= 31254))
				return;

			// Get the text of the selected HTML file in function of the npcId and of the page number
			filename = (getHtmlPath(npcId, val));
			break;

change to:

		default:
			if (npcId >= 31865 && npcId <= 31918)
			{
				if (val == 0 )
					filename += "rift/GuardianOfBorder.htm";
				else
					filename += "rift/GuardianOfBorder-" + val + ".htm";
				break;
			}
			if ((npcId >= 31093 && npcId <= 31094) || (npcId >= 31172 && npcId <= 31201) || (npcId >= 31239 && npcId <= 31254))
				return;

			if(checkCastle(player) == 2){
				filename = "data/html/npcbusy.htm"; // siege
				break;
			}else if(checkCastle(player) == 1){
				filename = "data/html/npcbusy.htm"; //no clan or clan dont have this castle
				break;
			}
			// Get the text of the selected HTML file in function of the npcId and of the page number
			filename = (getHtmlPath(npcId, val));
			break;

and add somewhere in l2Npc.java this method:

public int checkCastle(L2PcInstance player)
{
	if (getCastle() != null && getCastle().getCastleId() > 0)
	{
		if (player.getClan() != null)
		{
			if (getCastle().getSiege().getIsInProgress())
				return 2;
			else if (getCastle().getOwnerId() == player.getClanId()) // Clan owns castle
				return 0;
		}
		return 1;
	}
	return 0;
}

 

just change "data/html/npcbusy.htm" - this to path with your custom file or u will have to write couple more lines, you will see anyway.

 

Its tested with npcs with default html chats so test it by yourself and give me feedback

 

  • 0
Posted

ye but anyway he would need to add that code so nobody else can use gk, 2ndly it wouldnt be cool

  • 0
Posted

ye but anyway he would need to add that code so nobody else can use gk, 2ndly it wouldnt be cool

 

Yes I understand but as I know almost packs/projects already have this gk restriction for castles.

 

Anyway let's see next author reply, in generaly after they fixed their problem stop to answer the topic.

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

    • Very good at his job and highly communicative. He handles everything on time and consistently shows strong effort.
    • WoW Midnight — AFK Fishing Bot v2.0     Fully rewritten. No more pixel detection. V2 is audio-only and paired with a companion addon that handles everything inside the game — one keybind does it all.     Showcase:                  What's new in v2.0 Audio-only detection. Listens for the splash. No screen scanning, no calibration, no zone tuning. It just works anywhere. One key for everything. Same keybind casts the line and loots the catch. Bound via the included BobberAssist addon. Auto-buff system. Drop your lures, teas, potions (Haranir Phial, Sanguithorn Tea, Ominous Octopus Lure, etc.) into the addon. Set a timer. The bot refreshes them automatically before each cast. Sit-and-fish mode. Optional — bot types /sit when you start. Fewer interrupts from Root Crabs and roaming mobs. Smart anti-AFK. Fires only between catches, never mid-cast. AutoDestroy addon included. Junk items deleted automatically after every catch. VB-CABLE support. Play music, Discord, YouTube with zero interference. Randomized timing — natural 50–120 ms reactions.                       Features One-key start (F6) — press and walk away Audio isolation via VB-CABLE — play music, YouTube, Discord with zero interference Configurable consumable auto-use (lures / baits / potions / teas) with per-item timers Sit-and-fish mode to avoid ambient mob aggro Anti-AFK built in — jumps every 5 minutes in stand mode, jump + re-sit in sit mode (between catches only, never mid-cast) AutoDestroy addon included — automatically deletes junk items to keep bags clean after every catch Randomized splash→loot and loot→recast delays (natural timing, 50–120 ms reaction) Works in any zone, any fishing spot No pixel detection means no zone-specific tuning — it just works        Why v2 > v1 V1 scanned your screen for the bobber. It broke when the UI changed, the camera moved, or a new zone had different visuals. V2 only listens for the splash — nothing visual to break. Plus the new addon lets a single keybind cast, loot, and use your buffs. Way less setup, way more reliable.            Safety Runs completely external. No injection, no memory reads, no file edits. Watches nothing, listens to audio, presses one key. Use at your own risk. Automation is against Blizzard's ToS.          V1 owners Free upgrade. DM me for the new build.   One-time payment, lifetime access. DM on Discord: Nythrand
  • 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..