vato Posted April 19, 2011 Posted April 19, 2011 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. Quote
0 vampir Posted April 19, 2011 Posted April 19, 2011 you will need to make java code which will check if those npcs are in siege zone, they are code with java? Quote
0 vato Posted April 19, 2011 Author Posted April 19, 2011 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. Quote
0 vampir Posted April 19, 2011 Posted April 19, 2011 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 Quote
0 Trance Posted April 19, 2011 Posted April 19, 2011 Or easy can you make a gk (and only who have the castle can use it) teleport into an area with these "special npcs". Quote
0 vampir Posted April 20, 2011 Posted April 20, 2011 ye but anyway he would need to add that code so nobody else can use gk, 2ndly it wouldnt be cool Quote
0 Trance Posted April 21, 2011 Posted April 21, 2011 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. Quote
Question
vato
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
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.