Jump to content
  • 0

Help With Item


Question

Posted (edited)

Hello guys i made a item

l3zPblQ.png



i want  to make it when some one double click on it to give 500 reputation points to his clan

how can i do that ? i have no idea really! help me out please ! thanks!


and something else, im searching for A Sub class master npc in which you can choose any subclass available. but i cant find any

you know all these npcs in one

8cUDsNe.png


can i make one? how?  i use l2jfrozen


thanks for your time

Edited by Stev0

15 answers to this question

Recommended Posts

  • 0
Posted (edited)

So, just make 2 new configs like

REQUIRED_ITEM = your id
REQUIRED_AMOUNT = 5000

and replace them in the code here

if st.getPlayer().isClanLeader() and st.getPlayer().getClan().getLevel() >= 5 and st.getPlayer().getClan().getReputationScore() < NEW_REP_SCORE :
if st.getPlayer().isNoble() and count > REQUESTED_AMOUNT:
htmltext=event
st.getPlayer().getClan().setReputationScore(NEW_REP_SCORE, 5000);
st.playSound("ItemSound.quest_finish")
st.takeItems(REQUESTED_ITEM,REQUESTED_AMOUNT)

REQUESTED_TEM / REQUESTED_AMOUNT => REQUIRED_ITEM / REQUIRED_AMOUNT

 

 

Should work :P

Edited by SweeTs
  • 0
Posted (edited)

Depend what pack he use. There may be not such config. Anyway.

 

About clan rep item. You have to create new item handler

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver.handler.itemhandlers;

import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.actor.L2Playable;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;

public class ClanItem implements IItemHandler
{
    @Override
    public void useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
    {
        if (!(playable instanceof L2PcInstance))
            return;
        
        final L2PcInstance activeChar = (L2PcInstance) playable;
        
        if (activeChar.getClan() == null)
            return;
        
        if (!activeChar.isClanLeader())
        {
            activeChar.sendMessage("Only clan leader can use it.");
            return;
        }
        
        activeChar.getClan().addReputationScore(500);
        activeChar.getClan().broadcastClanStatus();
        activeChar.sendMessage("Your clans reputation score has been increased.");
        MagicSkillUse MSU = new MagicSkillUse(activeChar, activeChar, 2024, 1, 1, 0);
        activeChar.broadcastPacket(MSU);
        activeChar.destroyItem("Consume", item.getObjectId(), 1, null, true);
    }
}

Then register it inside Itemhandler.java

 

Go to xml folder, to the item that you want and change its handler to ClanItem.

Edited by SweeTs
  • 0
Posted

i use l2jfrozen


and sweets how do i make a new item handler? im a newbie so i dont really understand the items i show on the pic its called "lord of the manor's certificate"(id 5708) something like that i just changed its name and description (about eclipse i dont know anything)

  • 0
Posted

So, use frozen forum. There is a patch @ frozen forum for sure. Also, Im award it's not implemented in sources, or maybe it is, dunno rly.

 

You must add new file at eclipse, gameserver.handler.itemhandlers; in here, you have create it.

  • 0
Posted

oh dude im not good with java ...

is it possible to make a npc which will give clan reputation points in exchange for some items like gold bars or something?

i have a clan manager in my pack but it only lvls up the clan to lvl 8
 

you know without using eclipse


any ideas?

  • 0
Posted (edited)

so im using a clan manager from a different pack and this npc can lvl up the clan and give clan reputations :-beep- yeah:

but i want to change this> when i want to lvl up the clan the requirements are 5k fire mantra
and when i want to get reputation the requirements are again 5k fire mantra     

so i want to change the requirements for clan reputation to be 2k water mantra if possible
it uses the same item ID for both things..

heres the code:
 

import sys
from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
from com.l2jfrozen.gameserver.model.actor.instance import L2NpcInstance
from java.util import Iterator
from com.l2jfrozen.util.database import L2DatabaseFactory
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest

qn = "6667_ClanManager"

NPC=[66667]
REQUESTED_ITEM=5574
REQUESTED_AMOUNT=5000
NEW_REP_SCORE=5000
QuestId     = 6667
QuestName   = "ClanManager"
QuestDesc   = "custom"
InitialHtml = "66667-1.htm"

print "Clan Manager (66667) Enabled..."

class Quest (JQuest) :

	def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

	def onEvent(self,event,st):
               htmltext = "<html><head><body>I have nothing to say you</body></html>"
               count=st.getQuestItemsCount(REQUESTED_ITEM)
               if event == "66667-clanOk.htm" :
                   if st.getPlayer().isClanLeader() and st.getPlayer().getClan().getLevel()<8:
                       if st.getPlayer().isNoble() and count >= REQUESTED_AMOUNT:
                            htmltext=event
                            st.getPlayer().getClan().changeLevel(8)
                            st.playSound("ItemSound.quest_finish")
                            st.takeItems(REQUESTED_ITEM,REQUESTED_AMOUNT)
                       else :
                            htmltext="66667-no_clan.htm"
                            st.exitQuest(1)
                   else :
                       htmltext="66667-no_clan.htm"
                       st.exitQuest(1)
               elif event == "66667-repOk.htm" :
                   if st.getPlayer().isClanLeader() and st.getPlayer().getClan().getLevel() >= 5 and st.getPlayer().getClan().getReputationScore() < NEW_REP_SCORE :
                       if st.getPlayer().isNoble() and count > REQUESTED_AMOUNT:
                            htmltext=event
                            st.getPlayer().getClan().setReputationScore(NEW_REP_SCORE, 5000);
                            st.playSound("ItemSound.quest_finish")
                            st.takeItems(REQUESTED_ITEM,REQUESTED_AMOUNT)
                       else :
                            htmltext="66667-no_points.htm"
                            st.exitQuest(1)
                   else :
                       htmltext="66667-no_points.htm"
                       st.exitQuest(1)
               return htmltext

	def onTalk (self,npc,player):
	   htmltext = "<html><head><body>I have nothing to say you</body></html>"
           st = player.getQuestState(qn)
           if not st : return htmltext
           npcId = npc.getNpcId()
           id = st.getState()
           if id == CREATED :
               htmltext="66667-1.htm"
           elif id == COMPLETED :
               htmltext = "<html><head><body>This quest have already been completed.</body></html>"
           else :
               st.exitQuest(1)
           return htmltext


QUEST = Quest(6667,qn,"custom")
CREATED     = State('Start', QUEST)
STARTING    = State('Starting', QUEST)
STARTED     = State('Started', QUEST)
COMPLETED   = State('Completed', QUEST)
QUEST.setInitialState(CREATED)

for npcId in NPC:
 QUEST.addStartNpc(npcId)
 QUEST.addTalkId(npcId)

please some1 help i need to fix this Thanks! :alone:

Edited by Stev0
  • 0
Posted (edited)

You already changed it

REQUESTED_ITEM=5574
REQUESTED_AMOUNT=5000

I don't get your problem :o

 

Btw, when you restart the server your clan lvl stay or get back to previous level or to 0 ?

 

Since..

st.getPlayer().getClan().changeLevel(8)

Should be setLevel and not change.. Anyway, that's broken pack, so everything is possible :happyforever:

 

 

Also, haha this code is funny :happyforever: :happyforever:

Edited by SweeTs
  • 0
Posted (edited)

nope the clan stays at lvl 8.
 

what i mean is that ,  this> "REQUESTED_ITEM=5574" its used for lvl up and rep points.  i want to change the clan rep to another id, or the lvl up to another item id so it doesnt take the same amount of the same item

when i want to lvl up the clan to take gold bars and when i want to get rep point to take ancient adena (i dont knwo how else to describe it)

first button lvl up clan = gold bars
second button rep points = ancient adena

sorry for my english (im still learning) :forever alone like a boss:

Edited by Stev0
  • 0
Posted

You say that you are not good with java.. but he already provided you with the code.. so what's the problem here? Just import it in your source and you'll be fine, it's really just 1 min job.

  • 0
Posted

clan manager fixed

now about the other thing the Sub class master npc in which you can choose any subclass available

how to make one ? or is there any a can download? (no luck with this npc cant be found)

Guest
This topic is now closed to further replies.


×
×
  • Create New...