Jump to content
  • 0

[Help]Duble Quest Problem


Question

Posted

hello

 

For example i have custom buffer Script with ID X

i make copy/paste and change inside everything what need with ID Y for example

 

i add in config to load and ID Y

when server load i see there write

buffer ID X imported

Buffer ID Y imported

 

so in game buffer X work without problem

but Buffer Y cant make buffs , but and dont send any errors

 

just not logic buffer ID Y to not work .. any ideas why ?

i try and with other script for npc enchant and problem is same ID X work ID Y dont work

 

 

for example

 

enchant npc ID X - working

 

import sys
from com.l2jarchid import Config
from com.l2jarchid.gameserver.model.quest import State
from com.l2jarchid.gameserver.model.quest import QuestState
from com.l2jarchid.gameserver.model.quest.jython import QuestJython as JQuest

qn = "999999_NPCEnchant"

ENCHANT_NPC = 90020
weapons = ['Sword','Blunt','Dagger','Bow','Pole','Etc','Fist','Dual Sword','Dual Fist','Big Sword','Big Blunt','Ancient','Rapier']
armors = ['Light','Heavy','Magic','Shield']
jewels = ['None']
acceptableItemTypes = weapons

class Quest (JQuest) :

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

  def onEvent (self,event,st) :
    if event == "choose_item" :
      htmltext = ""
      for Item in st.getPlayer().getInventory().getItems():
        # given an item instance, get the item template to check what type it is
        itemType = Item.getItem().getItemType().toString()
        itemGrade = Item.getItem().getCrystalType()
        if itemType in acceptableItemTypes and itemGrade > 0 :
          htmltext += "<a action=\"bypass -h Quest 999999_NPCEnchant enchantItem_" + str(Item.getObjectId()) +"\">" + Item.getItem().getName() + "+" + str(Item.getEnchantLevel()) + "</a><br>"
      if htmltext == "":
        htmltext = "You have no enchantable items in your inventory"
      htmltext = "<html><body>Enchanter:<br>Please choose which item you wish me to enchant, from the below list:<br>" + htmltext + "</body></html>"
    elif event.startswith("enchantItem_"):
      # get the object id out of the event string
      objId = int(event.replace("enchantItem_", ""))
      # to avoid exploitation, check if the stored objectId still corresponds to an existing item
      # and if that item is still not equipped
      Item = st.getPlayer().getInventory().getItemByObjectId(objId )
      if Item and not Item.isEquipped() :
        itemType = Item.getItem().getItemType().toString()
        itemEnchant = Item.getEnchantLevel()
        if st.getQuestItemsCount(12004) >= 100 :
           if (itemType in weapons and itemEnchant >= Config.ENCHANT_MAX_WEAPON) or (itemType in armors and itemEnchant >= Config.ENCHANT_MAX_ARMOR) or (itemType in jewels and itemEnchant >= Config.ENCHANT_MAX_JEWELRY) :
              htmltext = "reachedMaxEnchant.htm"
           else :
             Item.setEnchantLevel(itemEnchant+30)
             st.takeItems(12004, 100)
             htmltext = "congratulations.htm"
        else :
          htmltext = "notEnoughItems.htm"
      else :
        htmltext = "cheater.htm"
    return htmltext

  def onTalk (self,npc,player):
    htmltext = "<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>"
    st = player.getQuestState(qn)
    if not st : return htmltext
    if npc.getNpcId() == ENCHANT_NPC :
       htmltext = "1.htm"
    return htmltext

QUEST    = Quest(999999,qn,"NPCEnchant")

CREATED     = State('Start', QUEST)

QUEST.setInitialState(CREATED)

QUEST.addStartNpc(ENCHANT_NPC)
QUEST.addTalkId(ENCHANT_NPC)

 

enchant npc ID Y - not work

 

import sys
from com.l2jarchid import Config
from com.l2jarchid.gameserver.model.quest import State
from com.l2jarchid.gameserver.model.quest import QuestState
from com.l2jarchid.gameserver.model.quest.jython import QuestJython as JQuest

qn = "9999_NPCEnchant"

ENCHANT_NPC = 90021
weapons = ['Sword','Blunt','Dagger','Bow','Pole','Etc','Fist','Dual Sword','Dual Fist','Big Sword','Big Blunt','Ancient','Rapier']
armors = ['Light','Heavy','Magic','Shield']
jewels = ['None']
acceptableItemTypes = weapons

class Quest (JQuest) :

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

  def onEvent (self,event,st) :
    if event == "choose_item" :
      htmltext = ""
      for Item in st.getPlayer().getInventory().getItems():
        # given an item instance, get the item template to check what type it is
        itemType = Item.getItem().getItemType().toString()
        itemGrade = Item.getItem().getCrystalType()
        if itemType in acceptableItemTypes and itemGrade > 0 :
          htmltext += "<a action=\"bypass -h Quest 9999_NPCEnchant enchantItem_" + str(Item.getObjectId()) +"\">" + Item.getItem().getName() + "+" + str(Item.getEnchantLevel()) + "</a><br>"
      if htmltext == "":
        htmltext = "You have no enchantable items in your inventory"
      htmltext = "<html><body>Enchanter:<br>Please choose which item you wish me to enchant, from the below list:<br>" + htmltext + "</body></html>"
    elif event.startswith("enchantItem_"):
      # get the object id out of the event string
      objId = int(event.replace("enchantItem_", ""))
      # to avoid exploitation, check if the stored objectId still corresponds to an existing item
      # and if that item is still not equipped
      Item = st.getPlayer().getInventory().getItemByObjectId(objId )
      if Item and not Item.isEquipped() :
        itemType = Item.getItem().getItemType().toString()
        itemEnchant = Item.getEnchantLevel()
        if st.getQuestItemsCount(12004) >= 100 :
           if (itemType in weapons and itemEnchant >= Config.ENCHANT_MAX_WEAPON) or (itemType in armors and itemEnchant >= Config.ENCHANT_MAX_ARMOR) or (itemType in jewels and itemEnchant >= Config.ENCHANT_MAX_JEWELRY) :
              htmltext = "reachedMaxEnchant.htm"
           else :
             Item.setEnchantLevel(itemEnchant+30)
             st.takeItems(12004, 100)
             htmltext = "congratulations.htm"
        else :
          htmltext = "notEnoughItems.htm"
      else :
        htmltext = "cheater.htm"
    return htmltext

  def onTalk (self,npc,player):
    htmltext = "<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>"
    st = player.getQuestState(qn)
    if not st : return htmltext
    if npc.getNpcId() == ENCHANT_NPC :
       htmltext = "1.htm"
    return htmltext

QUEST    = Quest(9999,qn,"NPCEnchant")

CREATED     = State('Start', QUEST)

QUEST.setInitialState(CREATED)

QUEST.addStartNpc(ENCHANT_NPC)
QUEST.addTalkId(ENCHANT_NPC)

print "importing custom: enchant2     OK"

 

config files

 

'999999_NPCEnchant',
'9999_NPCEnchant',

 

When server load script i see

 

enchant NPC ID X imported

enchant NPC ID Y imported

 

in game npc ID X work without errors

but npc ID Y not work show me next error

 

You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.

2 answers to this question

Recommended Posts

  • 0
Posted

fixed

 

i forget to change in html files where is link to quest

 

<a action="bypass -h npc_%objectId%_Quest 9999_NPCEnchant"><font color="347C17">ENCHANT ITEMS</font></a>

Guest
This topic is now closed to further replies.


×
×
  • Create New...