Jump to content
  • 0

[Help]Npc buffer probblem with script.


Question

Posted

Hello Mxc Members....

 

Well two days i am trying to fix the npc buffer i use .

Everything ok ,except Button "Heal" and "Cancel".

 

In the first page when you click on Npc buffer as .htm file for heal button and canel button is this :

 

<table>

<tr>

<td><button action="bypass -h Quest 60551_NPCBuffer 71" 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 71" value="Cancel Buffs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>

<td></td>

</tr>

</table>

 

 

Now as about : scripts/custom/60551_NPCBuffer/_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 by Myxoske [version 0.5]"

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 == "1":
			st.takeItems(ADENA_ID,0)
			SkillTable.getInstance().getInfo(4094,12).getEffects(st.getPlayer(),st.getPlayer())
			st.getPlayer().stopAllEffects()
			return "1.htm"
			st.setState(State.COMPLETED)

		if event == "71":
			st.getPlayer().useMagic(SkillTable.getInstance().getInfo(90001,1),False,False)
			st.getPlayer().useMagic(SkillTable.getInstance().getInfo(90002,1),False,False)
			st.getPlayer().useMagic(SkillTable.getInstance().getInfo(90003,1),False,False)
			return "1.htm"		
			st.setState(State.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)

 

 

 

and at stats/skills  i made a .xml file named Heal with the following :

 

 

 

<?xml version='1.0' encoding='utf-8'?>
<list>
<skill id="90001" levels="1" name="Mega CP Heal">
  <set name="mpConsume" val="0"/>
  <set name="power" val="65535"/>
  <set name="target" val="TARGET_SELF"/>
  <set name="hitTime" val="1"/>
  <set name="reuseDelay" val="1"/>
  <set name="skillType" val="COMBATPOINTHEAL"/>
  <set name="isMagic" val="true"/>
  <set name="operateType" val="OP_ACTIVE"/>
  <set name="castRange" val="-1"/>
</skill>
<skill id="90002" levels="1" name="Mega HP Heal">
  <set name="mpConsume" val="0"/>
  <set name="power" val="65535"/>
  <set name="target" val="TARGET_SELF"/>
  <set name="reuseDelay" val="1"/>
  <set name="hitTime" val="1"/>
  <set name="skillType" val="HEAL"/>
  <set name="isMagic" val="true"/>
  <set name="operateType" val="OP_ACTIVE"/>
  <set name="castRange" val="-1"/>
</skill>
<skill id="90003" levels="1" name="Mega MP Heal">
  <set name="mpConsume" val="0"/>
  <set name="power" val="65535"/>
  <set name="target" val="TARGET_SELF"/>
  <set name="reuseDelay" val="1"/>
  <set name="hitTime" val="1"/>
  <set name="skillType" val="MANARECHARGE"/>
  <set name="isMagic" val="true"/>
  <set name="operateType" val="OP_ACTIVE"/>
  <set name="castRange" val="-1"/>
</skill>
</list>

 

 

 

 

But when i click at Heal and at Cancle button ingame,nothing happened.What i am doing wrong?

Plz help me,i can't any more this shit :/

 

 

Recommended Posts

  • 0
Posted

<td><button action="bypass -h Quest 60551_NPCBuffer 71" 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 71" value="Cancel Buffs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>

 

 

 

if event == "1":  ??

st.takeItems(ADENA_ID,0)

SkillTable.getInstance().getInfo(4094,12).getEffects(st.getPlayer(),st.getPlayer())

st.getPlayer().stopAllEffects()

return "1.htm"

st.setState(State.COMPLETED)

 

if event == "71":

st.getPlayer().useMagic(SkillTable.getInstance().getInfo(90001,1),False,False)

st.getPlayer().useMagic(SkillTable.getInstance().getInfo(90002,1),False,False)

st.getPlayer().useMagic(SkillTable.getInstance().getInfo(90003,1),False,False)

return "1.htm"

st.setState(State.COMPLETED)

 

 

 

  • 0
Posted

When i press cancel ,yes i want to cancel all buffs,and when i press heal to heal me full(mp,hp,cp)

 

As about "1" is this file that it has in the same folder : gameserver\data\scripts\custom\60551_NPCBuffer

 

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

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

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

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

<button action="bypass -h npc_%objectId%_Chat 0" value="Back" width=90 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">

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

 

<td><button action="bypass -h Quest 60551_NPCBuffer 71" 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 71" value="Cancel Buffs" width=120 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>

 

I replace it to 1 but again nothing.

  • 0
Posted

 

 

to cancel put this into your py

 

if event == "xxx": Change the red

st.getPlayer().stopAllEffects()

st.getPlayer().restoreHPMP()

return "1.htm"

st.setState(COMPLETED)

  • 0
Posted

And when it says "return to 1.htm" for which file speak about?need to add other "1.hml'?

 

In return to 1.htm you must put your main html file ( where all options are )

  • 0
Posted

And when it says "return to 1.htm" for which file speak about?need to add other "1.hml'?

 

i thought it was 1.htm ??

 

and ofcourse for heal use this:

 

if event == "xxx": change the xxx

st.getPlayer().restoreHPMP()

return "1.htm"

st.setState(COMPLETED)

  • 0
Posted

Nothing guys :/

 

I have put these lines at : gameserver\data\html\mods\NpcBuffer.htm

 

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

 

101 and 102 "xxx" that i have changed....But still nothing.I press "heal"= nothing  ,i press "cancel"=again nothing :(

 

 

 

***Also at gameserver\data\scripts\custom\60551_NPCBuffer : i put inside "1.htm" file the First page of npc as i had it here gameserver\data\html\mods\NpcBuffer.htm

  • 0
Posted

The lines for cancel and heal must be at the init_py of your buffer with the event numbers of 101 and 102.

 

Then edit your buffer's html file with these ones :

 

bypass -h Quest 60551_NPCBuffer ''101'' <- the number of the event ( from init_py)

 

For example :

 

This code goes to : npc buffer/init_py

 

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

 

The main html file of your npc buffer should look like this:

 

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

 

  • 0
Posted

Yes Commodus,i have done everything as you said but nothing happened to heal neither to cancel .

 

Dunno what's happening.Is there a script error when you pressing at button heal or cancel?

  • 0
Posted

Can you provide us with an error log in the quest folder? And you use l2j right? You could try check some other buffer to check the method, if it corresponds.

 

 

I know it's wrong section, but it's too late now anyway ^^

  • 0
Posted

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

Guest
This topic is now closed to further replies.



×
×
  • Create New...