Ошибка при эвенте
Сборка: L2Open 3.5 Gracia FInal
Краткое изложение сути: При начале эвента и во время его вылазит ощибка.
Вопрс: В чом причина как справитЬ?
Вот код ошибки:
File "mutation.py", line 47, in onAttack
NameError: NpcSay
at org.python.core.Py.NameError(Unknown Source)
at org.python.core.PyFrame.getglobal(Unknown Source)
at org.python.pycode.serializable._pyx1255678999515.onAttack$3(mutation.
py:47)
at org.python.pycode.serializable._pyx1255678999515.call_function(mutati
on.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$26.onAttack(Unknown Source)
at net.sf.l2j.gameserver.model.quest.Quest.notifyAttack(Unknown Source)
at net.sf.l2j.gameserver.model.actor.L2Attackable.addDamage(Unknown Sour
ce)
at net.sf.l2j.gameserver.model.actor.L2Attackable.reduceCurrentHp(Unknow
n Source)
at net.sf.l2j.gameserver.model.actor.L2Character.onHitTimer(Unknown Sour
ce)
at net.sf.l2j.gameserver.model.actor.L2Character$HitTask.run(Unknown Sou
rce)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(Unknown Source)
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.util import Rnd
from net.sf.l2j import Config
from net.sf.l2j.gameserver.ai import CtrlIntention
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
#from net.sf.l2j.gameserver.serverpackets import NpcSay
MutationId ={ # Npc:[NewNpc,% for chance by shot,Type Message,nb message]
# if Quest_Drop = 5 => 5% by shot to change mob
21261:[21262,1,"Type1",5], # 1st mutation Ol Mahum Transcender
21262:[21263,1,"Type1",5], # 2st mutation Ol Mahum Transcender
21263:[21264,1,"Type1",5], # 3rd mutation Ol Mahum Transcender
21258:[21259,100,"Type1",5], # always mutation on atk Fallen Orc Shaman
20835:[21608,1,"Type1",5], # zaken's seer to zaken's watchman
21608:[21609,1,"Type1",5], # zaken's watchman
20832:[21602,1,"Type1",5], # Zaken's pikeman
21602:[21603,1,"Type1",5], # Zaken's pikeman
20833:[21605,1,"Type1",5], # Zaken's archet
21605:[21606,1,"Type1",5], # Zaken's archet
21625:[21623,1,"Type1",5], # zaken's Elite Guard to zaken's Guard
21623:[21624,1,"Type1",5], # zaken's Guard
20842:[21620,1,"Type1",5], # Musveren
21620:[21621,1,"Type1",5] # Musveren
}
# message by Name on MutationId
NpcMessage={ "Type1":["I cannot despise the fellow! I see his sincerity in the duel.",
"Nows we truly begin!",
"Fool! Right now is only practice!",
"Have a look at my true strength.",
"This time at the last! The end!"],
"Type2":[" "] # posibility to add other message on type 2 and change on MutationId
}
# Main Quest Code
class Quest(JQuest):
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onAttack(self,npc,player,damage,isPet,skill):
npcId = npc.getNpcId()
NewMob,chance,NameNpc,NbMessage = MutationId[npcId]
if Rnd.get(100) <= chance*Config.RATE_DROP_QUEST :
if MutationId.has_key(npcId) :
Msg=NpcMessage[NameNpc]
npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),Msg[Rnd.get(NbMess
age-1)]))
npc.deleteMe()
newNpc = self.addSpawn(NewMob,npc,)
newNpc.addDamageHate(player,0,99999)
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
return
QUEST = Quest(-1,"mutation","ai")
for i in MutationId.keys() :
QUEST.addAttackId(i)
И это, еще вопросик квк в этой же сборки сделать так чтобы можно было РБ убивать, а то его бьеш или умираеш или в город портирует, я имеюю ввиду, Special RB
вот тебе код.import sys
from net.sf.l2j.util import Rnd
from net.sf.l2j import Config
from net.sf.l2j.gameserver.ai import CtrlIntention
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
#from net.sf.l2j.gameserver.serverpackets import NpcSay
MutationId ={ # Npc:[NewNpc,% for chance by shot,Type Message,nb message]
# if Quest_Drop = 5 => 5% by shot to change mob
21261:[21262,1,"Type1",5], # 1st mutation Ol Mahum Transcender
21262:[21263,1,"Type1",5], # 2st mutation Ol Mahum Transcender
21263:[21264,1,"Type1",5], # 3rd mutation Ol Mahum Transcender
21258:[21259,100,"Type1",5], # always mutation on atk Fallen Orc Shaman
20835:[21608,1,"Type1",5], # zaken's seer to zaken's watchman
21608:[21609,1,"Type1",5], # zaken's watchman
20832:[21602,1,"Type1",5], # Zaken's pikeman
21602:[21603,1,"Type1",5], # Zaken's pikeman
20833:[21605,1,"Type1",5], # Zaken's archet
21605:[21606,1,"Type1",5], # Zaken's archet
21625:[21623,1,"Type1",5], # zaken's Elite Guard to zaken's Guard
21623:[21624,1,"Type1",5], # zaken's Guard
20842:[21620,1,"Type1",5], # Musveren
21620:[21621,1,"Type1",5] # Musveren
}
# message by Name on MutationId
NpcMessage={ "Type1":["I cannot despise the fellow! I see his sincerity in the duel.",
"Nows we truly begin!",
"Fool! Right now is only practice!",
"Have a look at my true strength.",
"This time at the last! The end!"],
"Type2":[" "] # posibility to add other message on type 2 and change on MutationId
}
# Main Quest Code
class Quest(JQuest):
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onAttack(self,npc,player,damage,isPet,skill):
npcId = npc.getNpcId()
NewMob,chance,NameNpc,NbMessage = MutationId[npcId]
if Rnd.get(100) <= chance*Config.RATE_DROP_QUEST :
if MutationId.has_key(npcId) :
Msg=NpcMessage[NameNpc]
npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),Msg[Rnd.get(NbMess
age-1)]))
npc.deleteMe()
newNpc = self.addSpawn(NewMob,npc,)
newNpc.addDamageHate(player,0,99999)
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
return
QUEST = Quest(-1,"mutation","ai")
for i in MutationId.keys() :
QUEST.addAttackId(i)
должно заработать

