Jump to content
  • 0

[help] Quest Python


Question

Posted

I have create this Quest based on python:

import sys
from com.l2jserver.gameserver.model.actor.instance import L2PcInstance
from java.util import Iterator
from com.l2jserver.gameserver.datatables import SkillTable
from com.l2jserver		       import L2DatabaseFactory
from com.l2jserver.gameserver.model.actor.appearance import PcAppearance
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.actor.appearance import PcAppearance
from com.l2jserver.gameserver.model.quest import QuestState
from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest

qn = "55502_NpcHb"

NPC=[55503]
Adena       = 57
QuestId     = 55502
QuestName   = "NpcHb"
QuestDesc   = "custom"
InitialHtml = "1.htm"

print "Loaded Quest: 55503 npcHB~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

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 < 900  and st.getPlayer().getLevel() < 80 :
		htmltext = "Error2.htm"

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

	elif st.player.getQuestState("55502_NpcHb") == 1 :
		htmltext = "Error1.htm"

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

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

		if event == "2":
			st.takeItems(Adena,1000)
                                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)

 

And i have one problem npc can't recognize if player have this quest to send him Error1.htm

in results to send always end.htm end give quest again from the begging.

Anyone now the correct code to add?

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...