Someone can help me with this?

    Share

    torsello

    Posts : 50
    Join date : 2015-08-18

    Someone can help me with this?

    Post  torsello on 2nd September 2015, 22:28

    How can i create an .htm for this script?
    Code:
    import sys
    from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance
    from java.util import Iterator
    from net.sf.l2j.gameserver.datatables import SkillTable
    from net.sf.l2j               import L2DatabaseFactory
    from net.sf.l2j.gameserver.model.actor.appearance import PcAppearance
    from net.sf.l2j.gameserver.model.quest import State
    from net.sf.l2j.gameserver.model.actor.appearance import PcAppearance
    from net.sf.l2j.gameserver.model.quest import QuestState
    from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

    qn = "8204_NpcNoblesse"

    NPC=[100009]
    GOLDBAR= 3470
    NOBLESS_TIARA = 7694
    QuestId    = 8204
    QuestName  = "NpcNoblesse"
    QuestDesc  = "custom"
    InitialHtml = "1.htm"

    print "INFO Loaded: Noblesse Manager"

    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(GOLDBAR)
          
          if count < 250  and st.getPlayer().getLevel() < 80 :
             htmltext = "<html><head><body>Sorry, but you dont have enought gb or u low lvl</body></html>"

          elif st.getPlayer().isNoble() == 1 :
             htmltext = "<html><head><body>Sorry, But you are alrdy nobles</body></html>"


          else:
             st.getPlayer().setTarget(st.getPlayer())
             
             if event == "2":
                         st.takeItems(GOLDBAR,250)
                                    st.getPlayer().setNoble(true)
                                    st.giveItems(NOBLESS_TIARA,1)
                                    st.playSound("ItemSound.quest_finish")
                st.setState(State.COMPLETED)
                return "End.htm"
                                    st.exitQuest(1)   
       
                
             if htmltext != event:
                st.setState(State.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(State.STARTED)
         return InitialHtml

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

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

    Thanks a lot!

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: Someone can help me with this?

    Post  DnR on 3rd September 2015, 15:22

    Please explain what you are trying to do.

    torsello

    Posts : 50
    Join date : 2015-08-18

    Re: Someone can help me with this?

    Post  torsello on 3rd September 2015, 15:26

    Hi, im trying to do a nobless npc , that makes you noble paying with goldbar

    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: Someone can help me with this?

    Post  DnR on 4th September 2015, 14:41

    onTalk method is wrong. Also, you haven't declared initial state.
    Check one of the quest scripts and modify your script accordingly.

    torsello

    Posts : 50
    Join date : 2015-08-18

    Re: Someone can help me with this?

    Post  torsello on 4th September 2015, 17:35

    DnR wrote:onTalk method is wrong. Also, you haven't declared initial state.
    Check one of the quest scripts and modify your script accordingly.

    Like this?

    Code:


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

    QUEST       = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)
    CREATED     = State('Start', QUEST)//ADD

    for npcId in NPC:
     QUEST.setInitialState(CREATED) //ADD
     QUEST.addStartNpc(npcId)
     QUEST.addTalkId(npcId)


    DnR
    Admin
    Admin

    Posts : 985
    Join date : 2012-12-03

    Re: Someone can help me with this?

    Post  DnR on 4th September 2015, 20:00

    Code:

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

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

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

    QUEST.setInitialState(CREATED)

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

    Sponsored content

    Re: Someone can help me with this?

    Post  Sponsored content


      Current date/time is 28th July 2017, 21:43