Перейти к содержанию
Авторизация  
goodoker

Проблема С Установкой Квеста

Рекомендуемые сообщения

Сборка l2rt

Установил квест, но при взятии квеста появляется окошко с надписью script error и всё.

 

import sys
from net.sf.l2j import Config
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 = "q905_GoddnessArmor"

## нпц
NPC = 80028

## Мобы
MOBS = [21376,21377,21378,21394,21652,21379,21653,21380,21383,21654,21382]
#босс
BOSS = 25450

## Дроп
#id Сплава
ADAMANIT = 10596
#сколько нужно?
ADAMANIT_NEED = 1000
#шанс дропа, %
ADAMANIT_CHANCE = 100
#id итема с босса
BOSS_ITEM = 10598

##Награда
#id Коина
COIN = 10599

class Quest (JQuest) :

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

def onEvent (self,event,st) :
  htmltext = event
  if event == "accept.htm":
 st.setState(State.STARTED)
 st.playSound("ItemSound.quest_accept")
 st.set("cond","1")
  elif event == "finish.htm":
 if st.getQuestItemsCount(ADAMANIT) >= ADAMANIT_NEED and st.getQuestItemsCount(BOSS_ITEM) >= 1:
   st.takeItems(ADAMANIT, -1)
   st.takeItems(BOSS_ITEM, -1)
   st.giveItems(COIN, 1)
   st.set("cond","0")
   st.playSound("ItemSound.quest_finish")
   st.setState(State.CREATED)
 else:
   htmltext = "mobs.htm"
  return htmltext

def onTalk (self,npc,player):
  st = player.getQuestState(qn)
  if not st: 
 return "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
  npcId = npc.getNpcId()
  idd = st.getState()
  cond = st.getInt("cond")
  if npcId == NPC:
 if idd == State.COMPLETED :
   htmltext = "completed.htm"
 if idd == State.CREATED :
   htmltext = "hello1.htm"
 elif cond == 1:
   if st.getQuestItemsCount(ADAMANIT) >= ADAMANIT_NEED and st.getQuestItemsCount(BOSS_ITEM) >= 1:
	 htmltext = "mobs2.htm"
   else:
	 htmltext = "mobs.htm"
  return htmltext

def onKill(self,npc,player,isPet):
  st = player.getQuestState(qn)
  if not st or st.getInt("cond") != 1:
 return
  npcId = npc.getNpcId()
  reward = 0
  limit = 1
  chance = 100
  if npcId in MOBS:
 reward = ADAMANIT
 limit = ADAMANIT_NEED
 chance = ADAMANIT_CHANCE
  if npcId == BOSS:
 reward = BOSS_ITEM
 limit = 1
  if reward > 0:
 party = player.getParty()
 if party:
   for member in party.getPartyMembers():
	 if not member.isAlikeDead():
	   st = member.getQuestState("q905_GoddnessArmor")
	   if st and st.getQuestItemsCount(reward) < limit and st.getRandom(100) <= chance:
		 st.giveItems(reward, 1)
		 st.playSound("ItemSound.quest_itemget")
		 if st.getQuestItemsCount(reward) >= limit:
		   st.playSound("ItemSound.quest_middle")
 else:
   if st.getQuestItemsCount(reward) < limit and st.getRandom(100) <= chance:
	 st.giveItems(reward, 1)
	 st.playSound("ItemSound.quest_itemget")
  return  

QUEST = Quest(905, qn, "Goddness Armor")

QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
QUEST.addKillId(BOSS)

for m in MOBS:
 QUEST.addKillId(m)

 

Проблема в самом квесте или несовместимость со сборкой?

 

Вот такая ошибка выскакивает в game Server Console.

 

could not insert char quest:
java.lang.NullPointerException
	at net.sf.l2j.gameserver.model.quest.Quest.playerEnter(Quest.java:517)
	at net.sf.l2j.gameserver.clientpackets.EnterWorld.runImpl(EnterWorld.jav
a:272)
	at net.sf.l2j.gameserver.clientpackets.L2GameClientPacket.run(L2GameClie
ntPacket.java:70)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Failed getting state for quest q905_GoddnessArmor (id:905) = NPE:null
java.lang.NullPointerException
	at net.sf.l2j.gameserver.model.quest.QuestState.getStateId(QuestState.ja
va:180)
	at net.sf.l2j.gameserver.model.quest.Quest.createQuestInDb(Quest.java:72
2)
	at net.sf.l2j.gameserver.model.quest.Quest.newQuestState(Quest.java:190)

	at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.showQuestWin
dow(L2NpcInstance.java:1670)
	at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.onBypassFeed
back(L2NpcInstance.java:1152)
	at net.sf.l2j.gameserver.clientpackets.RequestBypassToServer.runImpl(Req
uestBypassToServer.java:126)
	at net.sf.l2j.gameserver.clientpackets.L2GameClientPacket.run(L2GameClie
ntPacket.java:70)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Traceback (innermost last):
 File "C:\server2\gameserver\data\jscript\quests\q905_GoddnessArmor\__init__.py
", line 61, in onTalk
AttributeError: class 'net.sf.l2j.gameserver.model.quest.State' has no attribute
'COMPLETED'

	at org.python.core.Py.AttributeError(Unknown Source)
	at org.python.core.PyObject.noAttributeError(Unknown Source)
	at org.python.core.PyObject.__getattr__(Unknown Source)
	at data.jscript.quests.q905_GoddnessArmor$py.onTalk$4(C:\server2\gameser
ver\data\jscript\quests\q905_GoddnessArmor\__init__.py:61)
	at data.jscript.quests.q905_GoddnessArmor$py.call_function(C:\server2\ga
meserver\data\jscript\quests\q905_GoddnessArmor\__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.quests.q905_GoddnessArmor$Quest$341.o
nTalk(Unknown Source)
	at net.sf.l2j.gameserver.model.quest.Quest.notifyTalk(Quest.java:353)
	at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.showQuestWin
dow(L2NpcInstance.java:1674)
	at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.onBypassFeed
back(L2NpcInstance.java:1152)
	at net.sf.l2j.gameserver.clientpackets.RequestBypassToServer.runImpl(Req
uestBypassToServer.java:126)
	at net.sf.l2j.gameserver.clientpackets.L2GameClientPacket.run(L2GameClie
ntPacket.java:70)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Первая ошибка значит то, что в чарквесты не записалась стадия квеста. Лечится так:

 

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 import QuestStateManager
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

qn = "q905_GoddnessArmor"

## нпц
NPC = 80028

## Мобы
MOBS = [21376,21377,21378,21394,21652,21379,21653,21380,21383,21654,21382]
#босс
BOSS = 25450

## Дроп
#id Сплава
ADAMANIT = 10596
#сколько нужно?
ADAMANIT_NEED = 1000
#шанс дропа, %
ADAMANIT_CHANCE = 100
#id итема с босса
BOSS_ITEM = 10598

##Награда
#id Коина
COIN = 10599

class Quest (JQuest) :

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

def onEvent (self,event,st) :
  htmltext = event
  if event == "accept.htm":
 st.setState(State.STARTED)
 st.playSound("ItemSound.quest_accept")
 st.set("cond","1")
  elif event == "finish.htm":
 if st.getQuestItemsCount(ADAMANIT) >= ADAMANIT_NEED and st.getQuestItemsCount(BOSS_ITEM) >= 1:
   st.takeItems(ADAMANIT, -1)
   st.takeItems(BOSS_ITEM, -1)
   st.giveItems(COIN, 1)
   st.set("cond","0")
   st.playSound("ItemSound.quest_finish")
   st.setState(State.CREATED)
 else:
   htmltext = "mobs.htm"
  return htmltext

def onTalk (self,npc,player):
  st = player.getQuestState(qn)
  if not st: 
 return "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
  npcId = npc.getNpcId()
  idd = st.getState()
  cond = st.getInt("cond")
  if npcId == NPC:
 if idd == State.COMPLETED :
   htmltext = "completed.htm"
 if idd == State.CREATED :
   htmltext = "hello1.htm"
 elif cond == 1:
   if st.getQuestItemsCount(ADAMANIT) >= ADAMANIT_NEED and st.getQuestItemsCount(BOSS_ITEM) >= 1:
	 htmltext = "mobs2.htm"
   else:
	 htmltext = "mobs.htm"
  return htmltext

def onKill(self,npc,player,isPet):
  st = player.getQuestState(qn)
  if not st or st.getInt("cond") != 1:
 return
  npcId = npc.getNpcId()
  reward = 0
  limit = 1
  chance = 100
  if npcId in MOBS:
 reward = ADAMANIT
 limit = ADAMANIT_NEED
 chance = ADAMANIT_CHANCE
  if npcId == BOSS:
 reward = BOSS_ITEM
 limit = 1
  if reward > 0:
 party = player.getParty()
 if party:
   for member in party.getPartyMembers():
	 if not member.isAlikeDead():
	   st = member.getQuestState("q905_GoddnessArmor")
	   if st and st.getQuestItemsCount(reward) < limit and st.getRandom(100) <= chance:
		 st.giveItems(reward, 1)
		 st.playSound("ItemSound.quest_itemget")
		 if st.getQuestItemsCount(reward) >= limit:
		   st.playSound("ItemSound.quest_middle")
 else:
   if st.getQuestItemsCount(reward) < limit and st.getRandom(100) <= chance:
	 st.giveItems(reward, 1)
	 st.playSound("ItemSound.quest_itemget")
  return  

QUEST = Quest(905, qn, "Goddness Armor")
CREATED	 = State('Start', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
QUEST.addKillId(BOSS)

for m in MOBS:
 QUEST.addKillId(m)

 

Вторая ошибка значит, что в /quest.State нет метода КОМПЛИТ

Сейчас подумаю как решить и отпишусь

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

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 import QuestStateManager
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
from java.util import Iterator

qn = "q905_GoddnessArmor"

## нпц
NPC = 80001

## Мобы
MOBS = [21376,21377,21378,21394,21652,21379,21653,21380,21383,21654,21382]
#босс
BOSS = 25450

## Дроп
#id Сплава
ADAMANIT = 10596
#сколько нужно?
ADAMANIT_NEED = 1000
#шанс дропа, %
ADAMANIT_CHANCE = 100
#id итема с босса
BOSS_ITEM = 10598

##Награда
#id Коина
COIN = 10599

class Quest (JQuest) :

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

def onEvent (self,event,st) :
  htmltext = event
  if event == "accept.htm":
 st.setState(State.STARTED)
 st.playSound("ItemSound.quest_accept")
 st.set("cond","1")
  elif event == "finish.htm":
 if st.getQuestItemsCount(ADAMANIT) >= ADAMANIT_NEED and st.getQuestItemsCount(BOSS_ITEM) >= 1:
   st.takeItems(ADAMANIT, -1)
   st.takeItems(BOSS_ITEM, -1)
   st.giveItems(COIN, 1)
   st.set("cond","0")
   st.playSound("ItemSound.quest_finish")
   st.setState(State.CREATED)
 else:
   htmltext = "mobs.htm"
  return htmltext

def onTalk (self,npc,player):
  st = player.getQuestState(qn)
  if not st: 
 return "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>"
  npcId = npc.getNpcId()
  idd = st.getState()
  cond = st.getInt("cond")
  if npcId == NPC:
 if idd == State.Completed :
   htmltext = "completed.htm"
 if idd == State.CREATED :
   htmltext = "hello1.htm"
 elif cond == 1:
   if st.getQuestItemsCount(ADAMANIT) >= ADAMANIT_NEED and st.getQuestItemsCount(BOSS_ITEM) >= 1:
	 htmltext = "mobs2.htm"
   else:
	 htmltext = "mobs.htm"
  return htmltext

def onKill(self,npc,player,isPet):
  st = player.getQuestState(qn)
  if not st or st.getInt("cond") != 1:
 return
  npcId = npc.getNpcId()
  reward = 0
  limit = 1
  chance = 100
  if npcId in MOBS:
 reward = ADAMANIT
 limit = ADAMANIT_NEED
 chance = ADAMANIT_CHANCE
  if npcId == BOSS:
 reward = BOSS_ITEM
 limit = 1
  if reward > 0:
 party = player.getParty()
 if party:
   for member in party.getPartyMembers():
	 if not member.isAlikeDead():
	   st = member.getQuestState("q905_GoddnessArmor")
	   if st and st.getQuestItemsCount(reward) < limit and st.getRandom(100) <= chance:
		 st.giveItems(reward, 1)
		 st.playSound("ItemSound.quest_itemget")
		 if st.getQuestItemsCount(reward) >= limit:
		   st.playSound("ItemSound.quest_middle")
 else:
   if st.getQuestItemsCount(reward) < limit and st.getRandom(100) <= chance:
	 st.giveItems(reward, 1)
	 st.playSound("ItemSound.quest_itemget")
  return  

QUEST = Quest(905, qn, "Goddness Armor")
CREATED	 = State('Start', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
QUEST.addKillId(BOSS)

for m in MOBS:
 QUEST.addKillId(m)

 

Попробуйте вот так вот)

Изменено пользователем Purple

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Спасибо. Ошибки пропали, но теперь при взятии квеста ничего не происходит. :search:

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

и ставте пожалуйста в спойлер, пздц... :О

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
Авторизация  

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

×
×
  • Создать...