Нужна Помощь В Создании Квеста
6 ответов201 просмотровСейчас просматривают: 1
· 06.08.2008, 18:20
В общем пишу свой квест на Ы80... такая проблема.
После убийства 100 мобов надо поговорить с НПС и при подходящих условиях (cond,items) он должен открыть дверь, забрать 100 итемов и изменить параметр "cond" на i=i+1.
У меня 6 нпс и с каждым нужно проделать такую фигню.. в связи с этим возник ряд вопросов.
1) Куда нужно вставить следующий код (onEvent / onTalk)?
2) Правильный ли он?
3) Как зарегестрировать что произошло событие при нажатии в диалоге нужной строки (к примеру Open)?
вот пример моего кода:
Код
def onEvent (self,event,st) :
cond = st.getInt("cond")
htmltext = event
if event == "55855-1.htm" :
if st.getPlayer().getLevel() >= 80 :
st.set("cond","1")
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
#elif cond == 1 and st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100 and npcId == 58600 :
elif event == "58600-no.htm" and cond == 1 and st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100 :
st.set("cond","2")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(24220022).openMe()
htmltext = "58600-no.htm"
#elif cond == 2 and st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100 and npcId == 58601
elif event == "58601-no.htm" and cond == 1 and st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100 :
st.set("cond","3")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(24220020).openMe()
htmltext = "58601-no.htm"
cond = st.getInt("cond")
htmltext = event
if event == "55855-1.htm" :
if st.getPlayer().getLevel() >= 80 :
st.set("cond","1")
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
#elif cond == 1 and st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100 and npcId == 58600 :
elif event == "58600-no.htm" and cond == 1 and st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100 :
st.set("cond","2")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(24220022).openMe()
htmltext = "58600-no.htm"
#elif cond == 2 and st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100 and npcId == 58601
elif event == "58601-no.htm" and cond == 1 and st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100 :
st.set("cond","3")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(24220020).openMe()
htmltext = "58601-no.htm"
...
в коде закоментированы фрагменты, которые были, когда функция находилась в onTalk.
Само собой, "спасибо" обеспечено
0
· 06.08.2008, 21:59
Ап. Помогите плиз :)
когда закончу, выложу квест на обозрение...
0
· 07.08.2008, 00:00
вот пример как можно сделать
CODE
def onEvent (self,event,st) :
cond = st.getInt("cond")
if event == "open1":
st.set("cond","2")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь1).openMe()
elif event == "open2":
st.set("cond","3")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь2).openMe()
elif event == "open3":
st.set("cond","4")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь3).openMe()
elif event == "open4":
st.set("cond","5")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь4).openMe()
elif event == "open5":
st.set("cond","6")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь5).openMe()
elif event == "open6":
st.set("cond","7")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь6).openMe()
def onTalk (self,npc,player):
htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
cond = st.getInt("cond")
if npcId == STARTNPC:
if id == CREATED or id == COMPLETED :
if st.getPlayer().getLevel() >= 80
st.set("cond","1")
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
htmltext = "<html><body>Yes Bla Bla Bla</body></html>"
else :
st.exitQuest(1)
htmltext = "<html><body>No Bla Bla Bla</body></html>"
else :
if st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100:
if npcId == NPC1 and cond == 1:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open1">Open</a></body></html>"
if npcId == NPC2 and cond == 2:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open2">Open</a></body></html>"
if npcId == NPC3 and cond == 3:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open3">Open</a></body></html>"
if npcId == NPC4 and cond == 4:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open4">Open</a></body></html>"
if npcId == NPC5 and cond == 5:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open5">Open</a></body></html>"
if npcId == NPC6 and cond == 6:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open6">Open</a></body></html>"
else :
htmltext = "<html><body>No Bla Bla Bla</body></html>"
return htmltext
cond = st.getInt("cond")
if event == "open1":
st.set("cond","2")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь1).openMe()
elif event == "open2":
st.set("cond","3")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь2).openMe()
elif event == "open3":
st.set("cond","4")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь3).openMe()
elif event == "open4":
st.set("cond","5")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь4).openMe()
elif event == "open5":
st.set("cond","6")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь5).openMe()
elif event == "open6":
st.set("cond","7")
st.takeItems(BOTTLE_OF_SOULS,100)
st.playSound("ItemSound.quest_middle")
DoorTable.getInstance().getDoor(дверь6).openMe()
def onTalk (self,npc,player):
htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
cond = st.getInt("cond")
if npcId == STARTNPC:
if id == CREATED or id == COMPLETED :
if st.getPlayer().getLevel() >= 80
st.set("cond","1")
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
htmltext = "<html><body>Yes Bla Bla Bla</body></html>"
else :
st.exitQuest(1)
htmltext = "<html><body>No Bla Bla Bla</body></html>"
else :
if st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100:
if npcId == NPC1 and cond == 1:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open1">Open</a></body></html>"
if npcId == NPC2 and cond == 2:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open2">Open</a></body></html>"
if npcId == NPC3 and cond == 3:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open3">Open</a></body></html>"
if npcId == NPC4 and cond == 4:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open4">Open</a></body></html>"
if npcId == NPC5 and cond == 5:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open5">Open</a></body></html>"
if npcId == NPC6 and cond == 6:
htmltext = "<html><body><a action="bypass -h Quest Quest_S80 open6">Open</a></body></html>"
else :
htmltext = "<html><body>No Bla Bla Bla</body></html>"
return htmltext
id == CREATED or id == COMPLETED это проверяем взят ли квест(чтобы при повторном обращении к страт нпц квест не сбрасывался на cond 1), квест получаеца бесконечный если убрать условие комплид то будет разовый, возможно эта проверка у тебя записываеться как то по другому поэтому будет ошибку выдавать.
Также можно обойтись и без действия onEvent заменив htmltext на конечное действие уже.
Если в разных cond используються разные итемы добавь к проверкам нпц и конд проверку нужного итема удалив это if st.getQuestItemsCount(BOTTLE_OF_SOULS) >= 100: else : htmltext = "<html><body>No Bla Bla Bla</body></html>"
Да и на мой взгляд открытие дверей лучше не делать потомучто если в движке не работают какие нибуть таймеры на их закрытие то первый прошедший откроет их , и будут они открыты до рестарта , думаю проще телепортировать за дверь.
0
· 07.08.2008, 00:58
Парень, ты гений! :) Большое спасибо!!!
з.ы. напиши плиз аську ели есть в пм :)
0
Войдите или зарегистрируйтесь чтобы ответить



