Loto
Вот сам скриптик.
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 = "7900_loto"
NPC = 90000 # ID NPC loto
STAW = 9143 #ID itema stawki
STAW_KOL = 10 #kol-vo stawki
WIN = 9143 # ID viigrisha
WIN_KOL = 50 # kol-wo viigrisha
CHANCE = 5 # chans
STAW2 = 4037 #Item №2
STAW2_KOL = 10 # kol-wo 2 itema
WIN2 = 4037 # 2 viigrish
WIN2_KOL = 50 # Kol-vo
CHANCE2 = 5 #2 CHANS
print "Loaded Custom: 7900 LOTO"
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st):
htmltext = event
cond = st.getInt("cond")
if event == "1":
if st.getQuestItemsCount(STAW) >= STAW_KOL :
st.takeItems(STAW, STAW_KOL)
st.set("cond", "1")
return "ok.htm"
else :
return "no.htm"
return
if event == "2":
if st.getQuestItemsCount(STAW2) >= STAW2_KOL :
st.takeItems(STAW2, STAW2_KOL)
st.set("cond", "2")
return "ok.htm"
else :
return "no.htm"
return
if event == "3":
if cond == 1 :
if st.getRandom(100) < CHANCE :
st.giveItems(WIN,WIN_KOL)
st.set("cond", "0")
return "win.htm"
else :
st.set("cond", "0")
return "lose.htm"
elif cond == 2 :
if st.getRandom(100) < CHANCE2 :
st.giveItems(WIN2,WIN2_KOL)
st.set("cond", "0")
return "win.htm"
else :
st.set("cond", "0")
return "lose.htm"
if event == "4":
return "1.htm"
return
def onTalk (self,npc,player):
htmltext = "4iter.htm"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
cond = st.getInt("cond")
if npcId == NPC :
if cond == 0 :
htmltext = "1.htm"
elif cond == 1 or cond == 2 :
htmltext = "ok2.htm"
return htmltext
QUEST = Quest(7900,qn,"custom")
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
При нажатии у НПЦ на кнопку участвовать
Появляется надпись что я не удовлетворяю условия...
Сборка сервера какая?
Скрипт подключил?
Ошибка при загрузке есть? Да - так давай её сюда
P.s. Давай полную информацию по своей проблеме, если есть желание получить ответ быстрей. Экстрасенсов здесь нет.
л2джей гф.
скрипт подклчил, ошибок нету. но у НПЦ скрипт как будто не подключен...
up ! спавню цнп, у него нажимаю кнопку "Сыграть" и ничего не происходит!! диалоговое окно закрывается и дальше ничего не происходит!! прошу помощи...
посмотри в базе есть ли какие то намеки на этот квест, если нет значит квест даже не стартует, если есть то хотелось бы знать что там написанно
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 = "6666_loto"
### CONFIG ###
NPC = 90000 # ID NPC loto
STAW = 57 #ID itema stawki
STAW_KOL = 1000000 #kol-vo stawki
WIN = 57 # ID viigrisha
WIN_KOL = 5000000 # kol-wo viigrisha
CHANCE = 50 # chans
STAW2 = 4037 #Item №2
STAW2_KOL = 1 # kol-wo 2 itema
WIN2 = 4037 # 2 viigrish
WIN2_KOL = 2 # Kol-vo
CHANCE2 = 50 #2 CHANS
### /CONFIG ###
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st):
htmltext = event
cond = st.getInt("cond")
if event == "1":
if st.getQuestItemsCount(STAW) >= STAW_KOL :
st.takeItems(STAW, STAW_KOL)
st.set("cond", "1")
return "ok.htm"
else :
return "no.htm"
return
if event == "2":
if st.getQuestItemsCount(STAW2) >= STAW2_KOL :
st.takeItems(STAW2, STAW2_KOL)
st.set("cond", "2")
return "ok.htm"
else :
return "no.htm"
return
if event == "3":
if cond == 1 :
if st.getRandom(100) < CHANCE :
st.giveItems(WIN,WIN_KOL)
st.set("cond", "0")
return "win.htm"
else :
st.set("cond", "0")
return "lose.htm"
elif cond == 2 :
if st.getRandom(100) < CHANCE2 :
st.giveItems(WIN2,WIN2_KOL)
st.set("cond", "0")
return "win.htm"
else :
st.set("cond", "0")
return "lose.htm"
if event == "4":
return "1.htm"
return
def onTalk (self,npc,player):
npcId = npc.getNpcId()
id = st.getState()
cond = st.getInt("cond")
if npcId == NPC :
if cond == 0 :
htmltext = "1.htm"
elif cond == 1 or cond == 2 :
htmltext = "ok2.htm"
return htmltext
QUEST = Quest(6666,qn,"custom")
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
в таблице character_quest
нету ничего про квест
отправил, жду ответа
Так какая у тебя сейчас проблема?
Я на ц6 сборке запускаю и при нажатии на кнопку "сыграть" ошибку выдаёт. ругается на строку
ошибка:
at org.python.core.Py.NameError(Unknown Source)
at org.python.core.PyFrame.getglobal(Unknown Source)
at org.python.pycode.serializable._pyx1264527835062.onTalk$4(__init__.py
:74)
at org.python.pycode.serializable._pyx1264527835062.call_function(__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.main$Quest$362.onTalk(Unknown Source)
at net.sf.l2j.gameserver.model.quest.Quest.notifyTalk(Quest.java:327)
at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.showQuestWin
dow(L2NpcInstance.java:1293)
at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.onBypassFeed
back(L2NpcInstance.java:887)
at net.sf.l2j.gameserver.clientpackets.RequestBypassToServer.runImpl(Req
uestBypassToServer.java:146)
at net.sf.l2j.gameserver.clientpackets.L2GameClientPacket.run(L2GameClie
ntPacket.java:76)
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)
Будем разбиратся)
л2джей грация финал
Uphill: Вот сам скриптик.Раскрывающийся текст
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 = "7900_loto"
NPC = 90000 # ID NPC loto
STAW = 9143 #ID itema stawki
STAW_KOL = 10 #kol-vo stawki
WIN = 9143 # ID viigrisha
WIN_KOL = 50 # kol-wo viigrisha
CHANCE = 5 # chans
STAW2 = 4037 #Item №2
STAW2_KOL = 10 # kol-wo 2 itema
WIN2 = 4037 # 2 viigrish
WIN2_KOL = 50 # Kol-vo
CHANCE2 = 5 #2 CHANS
print "Loaded Custom: 7900 LOTO"
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st):
htmltext = event
cond = st.getInt("cond")
if event == "1":
if st.getQuestItemsCount(STAW) >= STAW_KOL :
st.takeItems(STAW, STAW_KOL)
st.set("cond", "1")
return "ok.htm"
else :
return "no.htm"
return
if event == "2":
if st.getQuestItemsCount(STAW2) >= STAW2_KOL :
st.takeItems(STAW2, STAW2_KOL)
st.set("cond", "2")
return "ok.htm"
else :
return "no.htm"
return
if event == "3":
if cond == 1 :
if st.getRandom(100) < CHANCE :
st.giveItems(WIN,WIN_KOL)
st.set("cond", "0")
return "win.htm"
else :
st.set("cond", "0")
return "lose.htm"
elif cond == 2 :
if st.getRandom(100) < CHANCE2 :
st.giveItems(WIN2,WIN2_KOL)
st.set("cond", "0")
return "win.htm"
else :
st.set("cond", "0")
return "lose.htm"
if event == "4":
return "1.htm"
return
def onTalk (self,npc,player):
htmltext = "4iter.htm"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
cond = st.getInt("cond")
if npcId == NPC :
if cond == 0 :
htmltext = "1.htm"
elif cond == 1 or cond == 2 :
htmltext = "ok2.htm"
return htmltext
QUEST = Quest(7900,qn,"custom")
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
При нажатии у НПЦ на кнопку участвоватьРаскрывающийся текст<a action="bypass -h npc_%objectId%_Quest 7900_Loto">Участвовать</a>
Появляется надпись что я не удовлетворяю условия...
выложи хтмли, я попробую сделать этот квест
п.с. в следующий раз код выкладывай не только под спойлером но и в тегах код
в общем, на, держи готовый :) оттестил на archid interlude, у тебя тоже должно работать, только импорты поменяй
qwerty111: Так какая у тебя сейчас проблема?
Я на ц6 сборке запускаю и при нажатии на кнопку "сыграть" ошибку выдаёт. ругается на строкуКодid = st.getState()
ошибка:
Будем разбиратся)
у тебя ругалось на эту функцию потому что в онталке нету st, онталк использует player, и по сути эта функция там не нужна... т.к. это присвоение не используется ни в одной проверке
Заменил id = st.getState() на id = palyer.getState(), теперь ругается вот на это
File "__init__.py", line 74, in onTalk
AttributeError: getState
at org.python.core.Py.AttributeError(Unknown Source)
at org.python.core.PyInstance.invoke(Unknown Source)
at org.python.pycode.serializable._pyx1265209217390.onTalk$4(__init__.py
:74)
at org.python.pycode.serializable._pyx1265209217390.call_function(__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.main$Quest$362.onTalk(Unknown Source)
at net.sf.l2j.gameserver.model.quest.Quest.notifyTalk(Quest.java:327)
at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.showQuestWin
dow(L2NpcInstance.java:1293)
at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.onBypassFeed
back(L2NpcInstance.java:887)
at net.sf.l2j.gameserver.clientpackets.RequestBypassToServer.runImpl(Req
uestBypassToServer.java:146)
at net.sf.l2j.gameserver.clientpackets.L2GameClientPacket.run(L2GameClie
ntPacket.java:76)
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)
Что не так с getstate? :(
Так с предыдущим разобрался (getQuestState(qn))
Теперь новая проблема. Есть такая строка
Так вот гс ругается
File "__init__.py", line 75, in onTalk
AttributeError: getInt
at org.python.core.Py.AttributeError(Unknown Source)
at org.python.core.PyInstance.invoke(Unknown Source)
at org.python.pycode.serializable._pyx1265210366984.onTalk$4(__init__.py
:75)
at org.python.pycode.serializable._pyx1265210366984.call_function(__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.main$Quest$362.onTalk(Unknown Source)
at net.sf.l2j.gameserver.model.quest.Quest.notifyTalk(Quest.java:327)
at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.showQuestWin
dow(L2NpcInstance.java:1293)
at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.onBypassFeed
back(L2NpcInstance.java:887)
at net.sf.l2j.gameserver.clientpackets.RequestBypassToServer.runImpl(Req
uestBypassToServer.java:146)
at net.sf.l2j.gameserver.clientpackets.L2GameClientPacket.run(L2GameClie
ntPacket.java:76)
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)
Весь скрипт
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 = "6666_loto"
### CONFIG ###
NPC = 90000 # ID NPC loto
STAW = 57 #ID itema stawki
STAW_KOL = 1000000 #kol-vo stawki
WIN = 57 # ID viigrisha
WIN_KOL = 5000000 # kol-wo viigrisha
CHANCE = 50 # chans
STAW2 = 4037 #Item №2
STAW2_KOL = 1 # kol-wo 2 itema
WIN2 = 4037 # 2 viigrish
WIN2_KOL = 2 # Kol-vo
CHANCE2 = 50 #2 CHANS
### /CONFIG ###
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onEvent(self,event,st):
htmltext = event
cond = st.getInt("cond")
if event == "1":
if st.getQuestItemsCount(STAW) >= STAW_KOL :
st.takeItems(STAW, STAW_KOL)
st.set("cond", "1")
return "ok.htm"
else :
return "no.htm"
return
if event == "2":
if st.getQuestItemsCount(STAW2) >= STAW2_KOL :
st.takeItems(STAW2, STAW2_KOL)
st.set("cond", "2")
return "ok.htm"
else :
return "no.htm"
return
if event == "3":
if cond == 1 :
if st.getRandom(100) < CHANCE :
st.giveItems(WIN,WIN_KOL)
st.set("cond", "0")
return "win.htm"
else :
st.set("cond", "0")
return "lose.htm"
elif cond == 2 :
if st.getRandom(100) < CHANCE2 :
st.giveItems(WIN2,WIN2_KOL)
st.set("cond", "0")
return "win.htm"
else :
st.set("cond", "0")
return "lose.htm"
if event == "4":
return "1.htm"
return
def onTalk (self,npc,player):
npcId = npc.getNpcId()
id = player.getQuestState(qn)
cond = player.getInt("cond")
if npcId == NPC :
if cond == 0 :
htmltext = "1.htm"
elif cond == 1 or cond == 2 :
htmltext = "ok2.htm"
return htmltext
QUEST = Quest(6666,qn,"custom")
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)

