Jump to content
  • 0

Question

Posted (edited)

Hi guys i saw i post from elfo : http://www.maxcheaters.com/topic/181446-just-another-buffer/?hl=buffer

And i want to make my buffer when it gives buffs to show buff effects like elfo's.
I use python buffer for l2jfrozen. Please give me an example on this code:

 

                	#Wind Walk
			if event == "2":
				st.takeItems(ADENA_ID,0)
				SkillTable.getInstance().getInfo(1204,2).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(COMPLETED)


 

Edited by Rio

Recommended Posts

  • 0
Posted

You better start reading initial post, twice :troll:

 

Back in the days, python 'era', there was buffers that casted animation, but I don't remember that code line :P

  • 0
Posted

 

You could use onAdvEvent() instead of onEvent(). It takes an npc reference as a parameter. ^^

 

Ups, not a good idea... :lol:

You do better obtain a reference through the onTalk() method. Less painful for you... :D

 

Change the constructor to:

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

Then, at the onTalk() method add this line:

def onTalk (self,npc,player):
    self.npc_obj = npc

Now you should be able to use

getEffects(self.npc_obj, st.getPlayer())

gives me error:

 

Error on: C:\l2server\gameserver\data\scripts\custom\95999_NPCBuffer\__init__.py.error.log
Line: -1 - Column: -1

Traceback (innermost last):
  (no code object) at line 0
SyntaxError: ('invalid syntax', ('__init__.py', 24, 9, '        JQuest.__init__(self,id,name,descr)'))

  • 0
Posted

Paste the entire code after the modification.


print "importing custom: 95999: NPCBuffer"

class Quest (JQuest) :

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

	def onEvent(self,event,st):
        def onTalk (self,npc,player):
        self.npc_obj = npc
		htmltext = event
		count=st.getQuestItemsCount(ADENA_ID)
		if count < 1000  or st.getPlayer().getLevel() < 1 :
			htmltext = "<html><head><body>You dont have enough Adena!<br> You have to pay me 1000 adenas for every single buff.</body></html>"
		else:
			st.takeItems(ADENA_ID,0)
			st.getPlayer().setTarget(st.getPlayer())
			
			#Wind Walk
			if event == "2":
				st.takeItems(ADENA_ID,1000)
                                getEffects(self.npc_obj(), st.getPlayer().useMagic(SkillTable.getInstance().getInfo(1204,2),False,False)
				SkillTable.getInstance().getInfo(1204,2).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(COMPLETED)
  • 0
Posted (edited)

First: In Python the proper indention is required, so:

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

Second: You can't define a method in method, so remove the two lines you have added to onEvent().

Third: You already have onTalk() method, the only thing you should do is to add to it:

self.npc_obj = npc
Edited by Tessa
  • 0
Posted

 

First: In Python the proper indention is required, so:

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

Second: You can't define a method in method, so remove the two lines you have added to onEvent().

Third: You already have onTalk() method, the only thing you should do is to add to it:

self.npc_obj = npc

 

can you please edit my code? i'm bit confused and cannot understand how to make it work, everything i try i get errors :/

class Quest (JQuest) :

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


	def onEvent(self,event,st):
		htmltext = event
		count=st.getQuestItemsCount(ADENA_ID)
		if count < 1000  or st.getPlayer().getLevel() < 1 :
			htmltext = "<html><head><body>You dont have enough Adena!<br> You have to pay me 1000 adenas for every single buff.</body></html>"
		else:
			st.takeItems(ADENA_ID,0)
			st.getPlayer().setTarget(st.getPlayer())
			
			#Wind Walk
			if event == "2":
				st.takeItems(ADENA_ID,1000)
                                st.getPlayer().useMagic(SkillTable.getInstance().getInfo(1204,2),False,False)
				SkillTable.getInstance().getInfo(1204,2).getEffects(st.getPlayer(),st.getPlayer())
				return "2.htm"		
				st.setState(COMPLETED)
  • 0
Posted

You better start reading initial post, twice :troll:

 

Back in the days, python 'era', there was buffers that casted animation, but I don't remember that code line :P

 

From backsteen reshare

broadcastPacket(new MagicSkillUser(this, player, buffid, bufflevel, 500, 0));

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...