Page 1 of 1

Need help with script

Posted: Tue Jul 06, 2010 12:48 pm
by babyjason
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:
L2JDP Revision Number:

Hello, i m using this pet buffer, but it gives me errors, when a user doesent have a pet and uses the buffer...

is there any way to give a message or smt if user doesent have a pet and uses it?

 


this is the error

Code: Select all

 com.l2jserver.gameserver.model.quest.Quest showErrorWARNING:  \gameserver\data\scripts\custom\9997_PetBuffer\__init__.pyTraceback (innermost last):  File "__init__.py", line 904, in onEventAttributeError: 'NoneType' object has no attribute 'getMaxHp' 	at org.python.core.Py.AttributeError(Unknown Source)	at org.python.core.PyObject.noAttributeError(Unknown Source)	at org.python.core.PyObject.__getattr__(Unknown Source)	at org.python.core.PyObject.invoke(Unknown Source)	at org.python.pycode.serializable._pyx1278386062828.onEvent$3(__init__.py:904)	at org.python.pycode.serializable._pyx1278386062828.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$425.onEvent(Unknown Source)	at com.l2jserver.gameserver.model.quest.Quest.onAdvEvent(Quest.java:674)	at com.l2jserver.gameserver.model.quest.Quest.notifyEvent(Quest.java:405)	at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.processQuestEvent(L2PcInstance.java:1788)	at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:229)	at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:93)	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)

Re: Need help with script

Posted: Tue Jul 06, 2010 12:57 pm
by janiii
just check other scripts that do something with pets or if you dont know which one, check for "getPet()" in the .py scripts.

Code: Select all

if not st.getPlayer().getPet():	return "<html><body>You dont have your pet summoned!</body></html>"

Re: Need help with script

Posted: Sat Jul 10, 2010 10:26 am
by muutorpe
Thx janiii xDD.

Re: Need help with script

Posted: Tue Jul 13, 2010 9:36 am
by babyjason
ok, i m embarassed to ask this, but where does it go? at the end?

Code: Select all

import sysfrom com.l2jserver.gameserver.model.actor.instance	import L2PcInstancefrom java.util import Iteratorfrom com.l2jserver.gameserver.datatables	import SkillTablefrom com.l2jserver		import L2DatabaseFactoryfrom com.l2jserver.gameserver.model.quest        import Statefrom com.l2jserver.gameserver.model.quest        import QuestStatefrom com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest qn = "9997_PetBuffer" NPC=[40001]QuestId     = 9997QuestName   = "PetBuffer"QuestDesc   = "custom"InitialHtml = "1.htm" class Quest (JQuest) : 	def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)  	def onEvent(self,event,st):		htmltext = event  	def onTalk (self,npc,player):	   st = player.getQuestState(qn)	   htmltext = "<html><head><body><center>ERROR<br1>Please, contact the administrator.</center></body></html>"	   st.setState(State.STARTED)	   return InitialHtml QUEST       = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc) for npcId in NPC: QUEST.addStartNpc(npcId) QUEST.addTalkId(npcId) print "DONE: 9997_PetBuffer"