new problem NPC nobles

    Share

    lordeze

    Posts : 97
    Join date : 2013-05-07

    new problem NPC nobles

    Post  lordeze on 11th May 2013, 09:19

    I have this new problem is that the code is a mistake I corrected some of the code and the codes let the original and modified to saver is wrong.



    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 = "6666_NoblessTrader"

    NPC=[66666]
    NOBLESS_TIARA=7694
    GOLD_BAR=57
    QuestId    = 6666
    QuestName  = "NoblessTrade"
    QuestDesc  = "custom"
    InitialHtml = "31739-1.htm"

    print "Nobless Trader (66666) 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>"
                  cond = st.getInt("cond")
                  count=st.getQuestItemsCount(GOLD_BAR)
                  if event == "31739-3.htm" :
                      if cond == 0 and st.getPlayer().isSubClassActive() :
                          if st.getPlayer().getLevel() >= 70 and count > 1:
                                htmltext=event
                                st.set("cond","0")
                                st.getPlayer().setNoble(True)
                                st.giveItems(NOBLESS_TIARA,1)
                                st.playSound("ItemSound.quest_finish")
                                st.setState(COMPLETED)
                                st.takeItems(GOLD_BAR,10)
                          else :
                                htmltext="31739-2.htm"
                                st.exitQuest(1)
                      else :
                          htmltext="31739-2.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)------(((I think the error is here I bring this)))
              if not st : return htmltext
              npcId = npc.getNpcId()
              id = st.getState()------(((not as correct if this is not bad but I do not complete the code to load out and neither)))
              if id == CREATED :
                  st.set("cond","0")
                  htmltext="31739-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(6666,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)

    CORRECTED HERE THE CODE

    Code:
    import sys
    from net.sf.l2j   import L2DatabaseFactory
    from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance
    from java.util import Iterator
    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 = "7100_NoblessTrader"

    NPC=[7100]
    NOBLESS_TIARA=7694
    Adena=57
    QuestId    = 7100
    QuestName  = "NoblessTrade"
    QuestDesc  = "custom"
    InitialHtml = "31739-1.htm"

    print "Nobless Trader (7100) 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>"
                  cond = st.getInt("cond")
                  count=st.getQuestItemsCount(Adena)
                  if event == "31739-3.htm" :
                      if cond == 0 and st.getPlayer().isSubClassActive() :
                          if st.getPlayer().getLevel() >= 70 and count > 1:
                                htmltext=event
                                st.set("cond","0")
                                st.getPlayer().setNoble(True)
                                st.giveItems(NOBLESS_TIARA,1)
                                st.playSound("ItemSound.quest_finish")
                                st.setState(COMPLETED)
                                st.takeItems(Adena,10)
                          else :
                                htmltext="31739-2.htm"
                                st.exitQuest(1)
                      else :
                          htmltext="31739-2.htm"
                          st.exitQuest(1)
                  return htmltext

       def onTalk (self,npc,st):
         htmltext = "<html><head><body>I have nothing to say you</body></html>"
              if not st : return htmltext
              npcId = npc.getNpcId()
              id = st.getState()
              if id == CREATED :
                  st.set("cond","0")
                  htmltext="31739-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(7100,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(7100)
     QUEST.addTalkId(7100)

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: new problem NPC nobles

    Post  DnR on 11th May 2013, 11:49

    If npc id 31739 is from retail npc, then you should change all 31739 ids to 8739.

    lordeze

    Posts : 97
    Join date : 2013-05-07

    Re: new problem NPC nobles

    Post  lordeze on 11th May 2013, 20:58

    well I have an error in the error console line 49 modicicando try line but it still the same error and if I take the line goes but I'm not the

    [img] [/img]

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: new problem NPC nobles

    Post  DnR on 12th May 2013, 11:03

    Try replacing the old script of the datapack with a new one. It might be loading issue.

    lordeze

    Posts : 97
    Join date : 2013-05-07

    Re: new problem NPC nobles

    Post  lordeze on 13th May 2013, 07:41

    and replace it when I have this error -


    [img] [/img]


    Last edited by lordeze on 14th May 2013, 06:55; edited 1 time in total

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: new problem NPC nobles

    Post  DnR on 13th May 2013, 11:20

    Something doesn' t make sense in your script.
    What is the npc id of Noblesse Manager?

    lordeze

    Posts : 97
    Join date : 2013-05-07

    Re: new problem NPC nobles

    Post  lordeze on 14th May 2013, 07:01

    either modify the code to a simpler one here unconditionally leave the code and error.
    ID = 7100 is what gave me the code and the npc

    Code:
    import sys
    from net.sf.l2j  import L2DatabaseFactory
    from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance
    from java.util import Iterator
    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 = "7100_NoblessTrader"

    NPC=[7100]
    Adena= 57
    NOBLESS_TIARA = 7694
    QuestId    = 7100
    QuestName  = "NoblessTrader"
    QuestDesc  = "custom"
    InitialHtml = "1.htm"

    print "Nobless Trader (7100) Enabled..."

    class Quest (JQuest) :

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


       def onEvent(self,event,st):
          htmltext = event
          count=st.getQuestItemsCount(Adena)
          if count < 2  and st.getPlayer().getLevel() < 76 :
             htmltext = "Error2.htm"

          elif st.getPlayer().isNoble() == 1 :
             htmltext = "Error1.htm"

          elif st.getQuestItemsCount(Adena) < 100 :
                            htmltext = "Error2.htm"

          elif st.getPlayer().getLevel() < 74 :
             htmltext = "Error2.htm"

          else:
             st.getPlayer().setTarget(st.getPlayer())

             if event == "2":
                st.takeItems(Adena,2)
                                    st.getPlayer().setNoble(True)
                                    st.giveItems(NOBLESS_TIARA,1)
                                    st.playSound("ItemSound.quest_finish")
                st.setState(COMPLETED)
                return "End.htm"
                                    st.exitQuest(1)


             if htmltext != event:
                st.setState(COMPLETED)
                st.exitQuest(1)
          return htmltext


       def onTalk (self,npc,player):
         st = player.getQuestState(qn)
         htmltext = "<html><head><body>I have nothing to say to you</body></html>"
         st.setState(STARTED)
         return InitialHtml

    QUEST      = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)

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


    [img] [/img]

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: new problem NPC nobles

    Post  DnR on 14th May 2013, 12:27

    Make sure npc id in game is 7100. Core is checking for Npc start points before a state is created. This could be your problem.

    lordeze

    Posts : 97
    Join date : 2013-05-07

    Re: new problem NPC nobles

    Post  lordeze on 15th May 2013, 03:06

    well change the line 61 and haora gives me error in line 62 modifies the

    def onTalk (self,npc,player):
    st = player.getQuestState(qn)

    X



    def onTalk (self,npc,st):






    [img] [/img]

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: new problem NPC nobles

    Post  DnR on 15th May 2013, 11:39

    You are missing these lines.
    In your older script, these lines did actually exist.

    CREATED = State('Start', QUEST)
    STARTED = State('Started', QUEST)
    COMPLETED = State('Completed', QUEST)

    QUEST.setInitialState(CREATED)

    Sponsored content

    Re: new problem NPC nobles

    Post  Sponsored content


      Current date/time is 28th July 2017, 18:02