A Project for Chronicle 4 based on L2JServer.


    Adventurers/Travelers weapons for c4

    Share
    avatar
    Karakan

    Posts : 421
    Join date : 2013-10-04

    Adventurers/Travelers weapons for c4

    Post  Karakan on 7th November 2013, 22:27

    I suck at jython, but i managed to get the MissQueen event running.

    Only problem is that everytime a player gets a coupon the server throws a error.

    Site note : i tried to remove the Newbie check , so every player can get the coupon and not just the first one on the account.

    Any help woul be appreciated Smile

    Heres the __init__.py

    Code:
    import sys
    from net.sf.l2j.gameserver.model.quest import State
    from net.sf.l2j.gameserver.model.quest import QuestState
    from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

    qn = "5000_MissQueen"

    COUPON_ONE = 7832
    COUPON_TWO = 7833

    NPCs = range(8760,8766)

    #enable/disable coupon give
    QUEEN_ENABLED=1
    #Newbie/one time rewards section
    #Any quest should rely on a unique bit, but
    #it could be shared among quest that were mutually
    #exclusive or race restricted.
    #Bit #1 isn't used for backwards compatibility.
    #This script uses 2 bits, one for newbie coupons and another for travelers
    NEWBIE_REWARD = 16
    TRAVELER_REWARD = 32

    class Quest (JQuest) :

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

     def onAdvEvent (self,event,npc,player) :
        if not QUEEN_ENABLED : return
        st = player.getQuestState(qn)
        level = player.getLevel()
        occupation_level = player.getClassId().level()
        pkkills = player.getPkKills()
        if event == "newbie_give_coupon" :
          if 6 <= level <= 20 and not pkkills and occupation_level == 0 :
                st.giveItems(COUPON_ONE,1)
                return "8760-2.htm" #here's the coupon you requested
          else :
              return "8760-3.htm" #you're not eligible to get a coupon (level caps, pkkills or already changed class)
        elif event == "traveller_give_coupon" :
          if 19 <= level <= 40 and not pkkills and occupation_level == 1 :
                st.giveItems(COUPON_TWO,1)
                return "8760-5.htm" #here's the coupon you requested
          else :
              return "8760-6.htm" #you're not eligible to get a coupon (level caps, pkkills or already changed class)

     def onFirstTalk (self,npc,player):
        st = player.getQuestState(qn)
        if not st :
            st = self.newQuestState(player)
        return "8760.htm"

    QUEST      = Quest(5000, qn, "custom")

    for i in NPCs:
      QUEST.addStartNpc(i)
      QUEST.addFirstTalkId(i)
      QUEST.addTalkId(i)


    And this what i get in the log


    Code:
    java.lang.NullPointerException
       at net.sf.l2j.gameserver.model.quest.QuestState.getStateId(QuestState.java:270)
       at net.sf.l2j.gameserver.model.quest.Quest.createQuestInDb(Quest.java:1021)
       at net.sf.l2j.gameserver.model.quest.Quest.newQuestState(Quest.java:187)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.python.core.PyReflectedFunction.__call__(Unknown Source)
       at org.python.core.PyMethod.__call__(Unknown Source)
       at org.python.core.PyObject.__call__(Unknown Source)
       at org.python.core.PyInstance.invoke(Unknown Source)
       at data.jscript.custom.5000_MissQueen$py.onFirstTalk$4(/l2j-server-c4/gameserver/data/jscript/custom/5000_MissQueen/__init__.py:50)
       at data.jscript.custom.5000_MissQueen$py.call_function(/l2j-server-c4/gameserver/data/jscript/custom/5000_MissQueen/__init__.py)
       at org.python.core.PyTableCode.call(Unknown Source)
       at org.python.core.PyTableCode.call(Unknown Source)
       at org.python.core.PyTableCode.call(Unknown Source)
       at org.python.core.PyFunction.__call__(Unknown Source)
       at org.python.core.PyMethod.__call__(Unknown Source)
       at org.python.core.PyObject.__call__(Unknown Source)
       at org.python.core.PyObject._jcallexc(Unknown Source)
       at org.python.core.PyObject._jcall(Unknown Source)
       at org.python.proxies.data.jscript.custom.5000_MissQueen$Quest$303.onFirstTalk(Unknown Source)
       at net.sf.l2j.gameserver.model.quest.Quest.notifyFirstTalk(Quest.java:394)
       at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.onAction(L2NpcInstance.java:659)
       at net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.doInteract(L2PcInstance.java:3882)
       at net.sf.l2j.gameserver.model.actor.instance.L2PcInstance$AIAccessor.doInteract(L2PcInstance.java:274)
       at net.sf.l2j.gameserver.ai.L2PlayerAI.thinkInteract(L2PlayerAI.java:304)
       at net.sf.l2j.gameserver.ai.L2PlayerAI.onEvtThink(L2PlayerAI.java:323)
       at net.sf.l2j.gameserver.ai.L2CharacterAI.onEvtArrived(L2CharacterAI.java:732)
       at net.sf.l2j.gameserver.ai.AbstractAI.notifyEvent(AbstractAI.java:393)
       at net.sf.l2j.gameserver.ai.AbstractAI.notifyEvent(AbstractAI.java:323)
       at net.sf.l2j.gameserver.GameTimeController$MovingObjectArrived.run(GameTimeController.java:239)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
       at java.lang.Thread.run(Unknown Source)
    avatar
    DnR
    Admin
    Admin

    Posts : 1023
    Join date : 2012-12-03

    Re: Adventurers/Travelers weapons for c4

    Post  DnR on 7th November 2013, 22:46

    You are missing initial quest state.

    Try adding these 2 lines right under quest class creation "QUEST       = Quest(5000, qn, "custom")" to be like this.
    Code:

    QUEST       = Quest(5000, qn, "custom")
    CREATED     = State('Start', QUEST)

    QUEST.setInitialState(CREATED)
    I hope i helped Smile.
    avatar
    Karakan

    Posts : 421
    Join date : 2013-10-04

    Re: Adventurers/Travelers weapons for c4

    Post  Karakan on 9th November 2013, 21:36

    Great! It works like a charm now.
    Thanks Smile

    Sponsored content

    Re: Adventurers/Travelers weapons for c4

    Post  Sponsored content


      Current date/time is 26th September 2017, 14:06