Jump to content
  • 0

Quest Understanding


Question

Posted

i addapt a quest but i cant understand what i must edit so it works properly:

# -*- coding: cp1251 -*-
import sys
from com.l2jfrozen import Config
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest

qn = "50000_NewbieZone"
#NPC ID
Starter = 30549


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

    def onKill (self,npc,player,isPet):
        npcId = npc.getNpcId()
        st = player.getQuestState(qn)
        if npc.getNpcId() in [Monsters] :
            if st.getEnchantLevel(int(st.getItemEquipped(4))) >= 7575:
                return
            else:
                if st.getRandom(100) == 100:
                    st.giveItems(136,1)
                elif st.getRandom(100) == 98 or st.getRandom(100) == 95 :
                    
                    st.giveItems(6577,2)
                elif st.getRandom(100) == 95 or st.getRandom(100) == 90 or st.getRandom(100) == 85 :
                    st.giveItems(6578,3)
                elif st.getRandom(1) == 1 :
                    st.giveItems(57,100000)                    
        else :

            return
            

    def onTalk (self,npc,player):
        if st:
           npcId = npc.getNpcId()
           id = st.getState()
           cond = st.getInt("cond")
           #item id can not be used
           if st.getEnchantLevel(int(st.getItemEquipped(10))) >= 10 :
               htmltext = "2.htm"
           else :
               if st.getRandom(2) == 0 :
                   st.getPlayer().teleToLocation(15516,251107,-1967)
                   
               if st.getRandom(2) == 1 :
                   st.getPlayer().teleToLocation(20912,253588,-2018)
                   
               if st.getRandom(2) == 2 :
                   st.getPlayer().teleToLocation(20334,250761,-2017)
                   
               
        return htmltext
    def onAttack (self,npc,player,damage,isPet):
        st = player.getQuestState(qn)
        npcId = npc.getNpcId()
        if not st : return
        #Monsters will participate in event
        if npcId == 27191:
            if st.getEnchantLevel(int(st.getItemEquipped(9))) >= 7575 :
                st.getPlayer().teleToLocation(154336,121232,-3809)
                #How much karm will be added when you dont have requirements
                st.getPlayer().setKarma(st.getPlayer().getKarma() +444)
                htmltext = "4.htm"
            return
               
QUEST       = Quest(50000, qn, "NewbieZone")

QUEST.addStartNpc(Starter)
QUEST.addTalkId(Starter)
#Монстры которые участвует в квесте, указать ИД.
#Таблица монстров, пример вноса ИД в таблицу:
#[1234, 33345, 3435]
for Monsters in [27191]:
    QUEST.addKillId(Monsters)
QUEST.addAttackId(27191)    

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..