Skip to content

[Help]Npc buffer probblem with script.

Featured Replies

  • Author

Ok what files i have :

 

gameserver\data\scripts\custom\60551_NPCBuffer :

 

1) _init_.py  :

 

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.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

qn = "60551_NPCBuffer"
NPCS=[60551]
ADENA_ID=57
QuestId     = 60551
QuestName   = "NPCBuffer"
QuestDesc   = "custom"

print "Loaded: Buffer"

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 < 0 or st.getPlayer().getLevel() < 1 :
		htmltext = "<html><head><body>Come back later.<br></body></html>"
	else:
		st.takeItems(ADENA_ID,0)
		st.getPlayer().setTarget(st.getPlayer())

		if event == "100":
			st.getPlayer().stopAllEffects()
			st.getPlayer().restoreHPMP()
			return "1.htm"
			st.setState(COMPLETED)

		if event == "101":
			st.getPlayer().restoreHPMP()
			return "1.htm"
			st.setState(COMPLETED)

			if htmltext != event:
			st.setState(State.COMPLETED)
			st.exitQuest(1)
	return htmltext
      
def onTalk (self,npc,player):
	return "1.htm"

QUEST		= Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)

for npcId in NPCS:
QUEST.addStartNpc(npcId)
QUEST.addTalkId(npcId)

 

 

2) 1.htm  :

 

<html><body>
<title>Buffer</title>
<center>
<br>

<font color=3c3c3c>_________</font> <font color=ae9977>NPC Buffer</font> <font color=3c3c3c>_________</font><br>

<table>
<tr>
<td><button action="bypass -h npc_%objectId%_Chat 2" value="Buffs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Chat 1" value="Dances" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td><button action="bypass -h npc_%objectId%_Chat 3" value="Songs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Chat 5" value="Chants" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td><button action="bypass -h npc_%objectId%_Chat 11" value="Gifts" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Buff 1323" value="Nobless" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td><button action="bypass -h npc_%objectId%_Chat 10" value="Resist/Protection" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Chat 6" value="Other buffs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
</table>

<font color=3c3c3c>__________________________</font><br>

<table>
<tr>
<td><button action="bypass -h npc_%objectId%_Buff 1040 1068 1035 1077 1204 1268 1036 1045 1048 1086 1240 1242 1388 1356 271 274 275 310 264 265 267 268 269 304 349 364" value="Fighter Set" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Buff 1040 1035 1059 1078 1085 1204 1036 1045 1048 1240 1303 1389 1460 273 276 264 265 267 268 304 349 363" value="Mage Set" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
</table>

<font color=3c3c3c>__________________________</font><br>

<table>
<tr>
<td><button action="bypass -h Quest 60551_NPCBuffer 1" value="Heal" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h Quest 60551_NPCBuffer 100" value="Cancel Buffs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td></td>
</tr>
</table>

<font color=3c3c3c>__________________________</font><br>

</center>
</body>
</html>

 

 

 

 

Now from    gameserver\data\html\mods :

I have these files :

 

1) Npcbuffer.htm :

 

<html><body>
<title>Buffer</title>
<center>
<br>

<font color=3c3c3c>_________</font> <font color=ae9977>NPC Buffer</font> <font color=3c3c3c>_________</font><br>

<table>
<tr>
<td><button action="bypass -h npc_%objectId%_Chat 2" value="Buffs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Chat 1" value="Dances" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td><button action="bypass -h npc_%objectId%_Chat 3" value="Songs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Chat 5" value="Chants" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td><button action="bypass -h npc_%objectId%_Chat 11" value="Gifts" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Buff 1323" value="Nobless" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
<tr>
<td><button action="bypass -h npc_%objectId%_Chat 10" value="Resist/Protection" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Chat 6" value="Other buffs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
</table>

<font color=3c3c3c>__________________________</font><br>

<table>
<tr>
<td><button action="bypass -h npc_%objectId%_Buff 1040 1068 1035 1077 1204 1268 1036 1045 1048 1086 1240 1242 1388 1356 271 274 275 310 264 265 267 268 269 304 349 364" value="Fighter Set" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h npc_%objectId%_Buff 1040 1035 1059 1078 1085 1204 1036 1045 1048 1240 1303 1389 1460 273 276 264 265 267 268 304 349 363" value="Mage Set" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
</table>

<font color=3c3c3c>__________________________</font><br>

<table>
<tr>
<td><button action="bypass -h Quest 60551_NPCBuffer 101" value="Heal" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button action="bypass -h Quest 60551_NPCBuffer 100" value="Cancel Buffs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td></td>
</tr>
</table>

<font color=3c3c3c>__________________________</font><br>

</center>
</body>
</html>

 

 

And i have and the other files .htm for the buffs,dances ,songs etc which work perfect...

 

 

I want just to fix Heal and cancel Button.

 

***Can't show or better i dont know other way to show you my files.(If you still want Lauq only with remote assist. then).

  • Author

Ok guys,we said that about wrong section and i am sry but lets focus to my problem plz.

Try This


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.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

qn = "60551_NPCBuffer"
NPCS=[60551]
ADENA_ID=57
QuestId     = 60551
QuestName   = "NPCBuffer"
QuestDesc   = "custom"

print "Loaded: Buffer"

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 < 0 or st.getPlayer().getLevel() < 1 :
		htmltext = "<html><head><body>Come back later.<br></body></html>"
	else:
		st.takeItems(ADENA_ID,0)
		st.getPlayer().setTarget(st.getPlayer())

		if event == "100":
			st.getPlayer().stopAllEffects()
			st.getPlayer().restoreHPMP()
			return "1.htm"
			st.setState(COMPLETED)

		if event == "101":
			st.getPlayer().restoreHPMP()
			return "1.htm"
			st.setState(COMPLETED)

			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><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 NPCS:
QUEST.addStartNpc(npcId)
QUEST.addTalkId(npcId)


 

 

  • Author

What you change exactly? :)

What you change exactly? :)

 

did it work ^^ ?

  • Author

No again nothing.....aff i cant believe it....it is annoying this.

 

Can someone use remote assistance with me to see whats wrong.Pm me :/

This must work

 

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.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

qn = "60551_NPCBuffer"

NPC=[60551]
QuestId     = 60551
QuestName   = "NPCBuffer"
QuestDesc   = "custom"
InitialHtml = "Npcbuffer.htm"

print "Loaded: Buffer"

class Quest (JQuest) :

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


def onEvent(self,event,st):
	htmltext = event



	if event == "100":
		st.getPlayer().restoreHPMP()
		return "Npcbuffer.htm"
		st.setState(COMPLETED)


	if event == "101":
		st.getPlayer().stopAllEffects()
		st.getPlayer().restoreHPMP()
		return "Npcbuffer.htm"
		st.setState(COMPLETED)

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


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)

  • Author

OMG Still nothing....

 

Lol dont pass me for idiot :/ ..

I show you my files and what all of you tell me that i did,nothing else. :(

I am desperate

jeeez you guys always can show me something i never seen before...how your stupid script supposed to read the button when you have it in the mods html folder ohh my god how stupid can some guy be...

 

1st you need a htm in the default folder linking to your script

2nd your script call a main htm window with the action buttons

3rd you click on the action and done

 

seriously guys that made my day i going to laugh for weeks on this...

  • Author

1st you need a htm in the default folder linking to your script

2nd your script call a main htm window with the action buttons

3rd you click on the action and done

 

The 1st i understand it,but then what you mean with action buttons?you mean ingame right?

 

The 1st i understand it,but then what you mean with action buttons?you mean ingame right?

 

 

read a how to make a buffer guide and you will understand it

  • Author

Man, i read a guide for making a buffer but i didnt find anywhere about "action buttons".So,you mean for ingame buttons or smth else?

Or at least give me this link you have in your mind.

It's not first time i add buffer,but just this time i can't configure what's wrong.

Man, i read a guide for making a buffer but i didnt find anywhere action buttons.So,you mean for ingame buttons or smth else?

Or at least give me this link you have in your mind.

It's not first time i add buffer,but just this time i can't configure what's wrong.

 

okay than i try to explain(still its a huge failure of all of you you guys never learn + google skills = 0)

 

when you add a python buffer you have a html in the default folder(for noobs named with the ID of the npc you have in sql)this html have a link which is start the script, than the script starts and the scripts(in this case buffer)html pop up here you have your buttons used in the scripts

 

crystal clear?

  • Author

Ok i understand it.

I will test it once again to see finally if it will work.

No...Nothing just the chat window of NpcBuffer dissapear... Damn i hate this!!!

Try thisss !! <<

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.quest import State

from net.sf.l2j.gameserver.model.quest import QuestState

from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

 

qn = "60551_NPCBuffer"

 

NPC=[60551]

ADENA_ID=57

QuestId     = 60551

QuestName   = "NPCBuffer"

QuestDesc   = "custom"

InitialHtml = "1.htm"

 

print "importing custom: 9999: NPCBuffer"

 

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 < 0 or st.getPlayer().getLevel() < 1 :

htmltext = "Come back later."

else:

st.takeItems(ADENA_ID,0)

st.getPlayer().setTarget(st.getPlayer())

 

#MPHPCPreg

if event == "1":

st.takeItems(ADENA_ID,0)

st.getPlayer().setCurrentHp(st.getPlayer().getMaxHp())

st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())

st.getPlayer().setCurrentCp(st.getPlayer().getMaxCp())

return "1.htm"

st.setState(COMPLETED)

 

#CANCEL BUFF

if event == "2":

st.takeItems(ADENA_ID,0)

st.getPlayer().stopAllEffects()

return "1.htm"

st.setState(COMPLETED)

 

if htmltext != event:

st.setState(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(STARTED)

  return InitialHtml

 

QUEST       = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)

CREATED=State('Start',QUEST)

STARTED=State('Started',QUEST)

COMPLETED=State('Completed',QUEST)

 

QUEST.setInitialState(CREATED)

 

for npcId in NPC:

QUEST.addStartNpc(npcId)

QUEST.addTalkId(npcId)

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.