Jump to content
  • 0

[HELP]Noblesse NPC


Question

Posted

i add this "custom/9998_Noble/__init__.py" in server/gameserver/data/scripts.cfg file

 

In game gameserver.bat i have error like this:

14o5fkm.jpgp

 

end gameserver create error files in folder 9998_Noble like this:

"__init__.py.error"

 

Error on: C:\Users\Ruter\Desktop\l2j\L2J Free Gracia Part 2\Gameserver\data\scripts\custom\9998_Noble\__init__.py.error.log
Line: -1 - Column: -1

Traceback (innermost last):
  File "__init__.py", line 66, in ?
TypeError: com.l2jfree.gameserver.model.quest.State(): expected 0 args; got 2

 

This is my file __init__.py:

 

import sys
from com.l2jfree.gameserver.model.actor.instance import L2PcInstance
from java.util import Iterator
from com.l2jfree.gameserver.datatables import SkillTable
from com.l2jfree			       import L2DatabaseFactory
from com.l2jfree.gameserver.model.quest import State
from com.l2jfree.gameserver.model.quest import QuestState
from com.l2jfree.gameserver.model.quest.jython import QuestJython as JQuest

qn = "9998_Noble"

NPC=[10003]
NOBLESS_TIARA = 7694
ADENA_ID=57
InitialHtml = "1.htm"

print "importing custom: 9998_Noble"

class Quest (JQuest) :

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

def onEvent(self,event,st):
	htmltext = event
	count=st.getQuestItemsCount(ADENA_ID)
	if count < 1 :
		htmltext = "<html><head><body>You dont have enough adena.</body></html>"
	else:
		if event == "1":
			if st.getPlayer().isNoble() :
				return "noble.htm"	
				st.setState(COMPLETED)
			if not st.getPlayer().isSubClassActive() :	
				return "noSub.htm"
				st.setState(COMPLETED)	
			if st.getPlayer().getLevel() < 75 : 
				return "toLow.htm"
				st.setState(COMPLETED)
			if not st.getPlayer().isNoble() :			
				if st.getPlayer().isSubClassActive() :			
					if st.getPlayer().getLevel() >= 75 :
						st.getPlayer().setNoble(True)
						st.giveItems(NOBLESS_TIARA,1)	
						return "grat.htm"
						st.setState(COMPLETED)

		if event == "2":
			return "no.htm"	
			st.setState(COMPLETED)

		if htmltext != event:
			st.setState(COMPLETED)
			st.exitQuest(1)
	return htmltext


        def onTalk (self,npc,st):
		htmltext = "<html><head><body>I have nothing to say to you</body></html>"
		st = st.getQuestState(qn)  
		st.setState(STARTED)			 
		return InitialHtml



QUEST       = Quest(9998,qn,"Noble")
CREATED=State('Start',QUEST)
STARTED=State('Started',QUEST)
COMPLETED=State('Completed',QUEST)


QUEST.setInitialState(CREATED)

 

Any Idea?

1 answer to this question

Recommended Posts

  • 0
Posted

This part in your code is wrong..... (cant use more than 1 if ... for next events use elif... [1 wrong])

			if event == "1":
			if st.getPlayer().isNoble() :
				return "noble.htm"	
				st.setState(COMPLETED)
			if not st.getPlayer().isSubClassActive() :	
				return "noSub.htm"
				st.setState(COMPLETED)	
			if st.getPlayer().getLevel() < 75 : 
				return "toLow.htm"
				st.setState(COMPLETED)
			if not st.getPlayer().isNoble() :			
				if st.getPlayer().isSubClassActive() :			
					if st.getPlayer().getLevel() >= 75 :
						st.getPlayer().setNoble(True)
						st.giveItems(NOBLESS_TIARA,1)	
						return "grat.htm"
						st.setState(COMPLETED)

 

 

import sys
from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance
from java.util import Iterator
from net.sf.l2j.gameserver.datatables import SkillTable
from net.sf.l2j			       import L2DatabaseFactory
from net.sf.l2j.gameserver.model.actor.appearance import PcAppearance
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.actor.appearance import PcAppearance
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

qn = "8204_NpcNoblesse"

NPC=[7202]
GOLDBAR= 3470
NOBLESS_TIARA = 7694
QuestId     = 8204
QuestName   = "NpcNoblesse"
QuestDesc   = "custom"
InitialHtml = "1.htm"

print "INFO Loaded: Noblesse Manager"

class Quest (JQuest) :

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


def onEvent(self,event,st):
	htmltext = event
	count=st.getQuestItemsCount(GOLDBAR)

	if count < 10  and st.getPlayer().getLevel() < 80 :
		htmltext = "<html><head><body>Sorry, but you dont have enought gb or u low lvl</body></html>"

	elif st.getPlayer().isNoble() == 1 :
		htmltext = "<html><head><body>Sorry, But you are alrdy nobles</body></html>"


	else:
		st.getPlayer().setTarget(st.getPlayer())

		if event == "2":
	            st.takeItems(GOLDBAR,10)
                                st.getPlayer().setNoble(True)
                                st.giveItems(NOBLESS_TIARA,1)
                                st.playSound("ItemSound.quest_finish")
			st.setState(State.COMPLETED)
			return "End.htm"
                                st.exitQuest(1)	


		if htmltext != event:
			st.setState(State.COMPLETED)
			st.exitQuest(1)
	return htmltext


def onTalk (self,npc,player):
   st = player.getQuestState(qn)
   htmltext = "<html><head><body>I have nothing to say to you</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)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...