Help with code for Custom Buffer

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
l2chrono
Posts: 7
Joined: Mon Oct 26, 2009 9:35 am

Help with code for Custom Buffer

Post by l2chrono »

L2J Revision 3662:
L2JDP Revision 6757:

I need to create a NPC buffer... with a custom Code... every time he buffs a player... the duration of the buff should be 3 hours... but I want to do this without changing the time of the skills in configuration or in Xml...
for example if a player use Improved condition ... he'll have 40 minutes of buff... if he buy the buff from the NPC will have 3 Hours

I got an Idea but I do not know what code to use :roll:

Code: Select all

if event == "1":		st.takeItems(ADENA_ID,10)		SkillTable.getInstance().getInfo(1204,2).getEffects(st.getPlayer(),st.getPlayer()) [b]//Here i neded to change the Buff duration[/b]		return "1.htm"				st.setState(COMPLETED)

if someone can post a list of the core codes would help a lot :wink:
if someone tells me what code to use I would be grateful :D

PS: Sorry for bad English... i'm finishing the course :P
User avatar
Tan
L2j Veteran
L2j Veteran
Posts: 873
Joined: Wed Jun 10, 2009 10:31 pm
Location: Poland

Re: Help with code for Custom Buffer

Post by Tan »

I think there is no other way then just change it by :
Chracter.Proparites:
EnableModifySkillDuration = true
# Skill duration list
# Format: skillid,newtime;skillid2,newtime2...
# Example:
# This enable 1h(3600) duration for songs, the "\"indicates new line,
# and is only set for formating purposes.
# SkillDurationList = 264,3600;265,3600;266,3600;267,3600;268,3600;\
# 269,3600;270,3600;304,3600;305,1200;306,3600;308,3600;349,3600;\
# 363,3600;364,3600
SkillDurationList = here you write id of these buffs you have in the NPC buffer

or trough editing XML
{by using the program on attach will be easier}
You do not have the required permissions to view the files attached to this post.
Some people believe in God... i believe in Music... some people pray..... I turn on Winamp
http://www.last.fm/user/L2jTan
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Help with code for Custom Buffer

Post by janiii »

you have to use 2 different skills if you want to have 2 different skill durations. you can check the admin buffs and use those skills for special buffs with different duration.
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
l2chrono
Posts: 7
Joined: Mon Oct 26, 2009 9:35 am

Re: Help with code for Custom Buffer

Post by l2chrono »

Thanks for help ^^
User avatar
lakshman
Posts: 21
Joined: Fri Apr 24, 2009 7:09 am

Re: Help with code for Custom Buffer

Post by lakshman »

can someone please help make this one work:

Code: Select all

#Cancellation			if event == "90":				st.takeItems(ADENA_ID,1000)				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4094,12),False,False)				st.getPlayer().stopAllEffects())				return "6.htm"				st.setState(COMPLETED)
its for my custom buffer...
tnx!!
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Help with code for Custom Buffer

Post by janiii »

what is not working on that?
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
User avatar
lakshman
Posts: 21
Joined: Fri Apr 24, 2009 7:09 am

Re: Help with code for Custom Buffer

Post by lakshman »

there is an error when loading server with this line
st.getPlayer().stopAllEffects())

....

and when i want to use fighter buffs i only get prohpet/orc buffs but not song and dances

Code: Select all

#Fighter Buffs			if event == "80":				st.takeItems(ADENA_ID,1000000)				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4342,2),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4355,3),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4353,6),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4348,6),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4360,3),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4359,3),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4357,2),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4346,4),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4350,4),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4352,2),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4347,6),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(1388,3),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4358,3),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4349,2),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4344,3),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4345,3),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(4354,4),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(271,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())   				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(274,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(275,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(264,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(268,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(267,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(363,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(304,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(269,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp()) 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(270,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(364,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(349,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                 				st.getPlayer().useMagic(SkillTable.getInstance().getInfo(1363,1),False,False)				st.getPlayer().setCurrentMp(st.getPlayer().getMaxMp())                                                                                             				return "6.htm"				st.setState(COMPLETED) 
any ideas?
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Help with code for Custom Buffer

Post by janiii »

lakshman wrote:there is an error when loading server with this line
st.getPlayer().stopAllEffects())
what error is on that line? write the error message from server! just give full info about the error and then we will be able to help you!
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
wan
Posts: 9
Joined: Tue May 19, 2009 9:08 am
Location: Russia

Re: Help with code for Custom Buffer

Post by wan »

lakshman wrote:there is an error when loading server with this line
st.getPlayer().stopAllEffects())

any ideas?
And this bracket is necessary in the end?
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Help with code for Custom Buffer

Post by _DS_ »

Never use stopAllEffects(), players will use it for cheating.
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
User avatar
lakshman
Posts: 21
Joined: Fri Apr 24, 2009 7:09 am

Re: Help with code for Custom Buffer

Post by lakshman »

Code: Select all

Error on: ..../gameserver/data/scripts/custom/70006_NPCBuffer/__init__.py.error.logLine: -1 - Column: -1 Traceback (innermost last):  (no code object) at line 0SyntaxError: ('invalid syntax', ('__init__.py', 655, 64, '\t\t\t\tst.getPlayer().stopAllEffects())'))
and when i use preset for mage or fighter buffs there is no error written/seen on server it just doesnt do anything, only gives prophet/orc buffs....
User avatar
lakshman
Posts: 21
Joined: Fri Apr 24, 2009 7:09 am

Re: Help with code for Custom Buffer

Post by lakshman »

Code: Select all

#Cancellation			if event == "70":				st.takeItems				SkillTable.getInstance().getInfo(4094,12).getEffects(st.getPlayer(),st.getPlayer())				st.getPlayer().stopAllEffects()				return "1.htm"				st.setState(State.COMPLETED)
this is the original from my super old buffer. the scripts dont work any more in gracia final...
Post Reply