EffectHandlers related question.

This is not a Support area! Discuss about the Server here. Non-Server related discussion goes in Off-Topic Discussion.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
ofelin
Posts: 3
Joined: Tue Jun 11, 2013 6:06 pm

EffectHandlers related question.

Post by ofelin »

Hello there,

As a newbie i am trying to understand various things related to L2J.

For now i am trying to create a simple skill effect that sets a monsters HP to 1 just to practice and move to more complicated stuff in the future.

What have i done so far:

The skill effect:

Code: Select all

public class ReduceHp extends AbstractEffect
{
	
	/**
	 * @param attachCond
	 * @param applyCond
	 * @param set
	 * @param params
	 */
	public ReduceHp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
	{
		super(attachCond, applyCond, set, params);
		
	}
	
	@Override
	public void onStart(BuffInfo info)
	{
		L2Character target = info.getEffected();
		
		if (target.isMonster())
		{
			target.setCurrentHp(1);
		}
		
	}
}
Added it to EffectMasterHandler like this:

Code: Select all

...,
ReduceHp.class,
...,
and the XML part:

Code: Select all

<for>
		<effect name="ReduceHp"/>
	</for>
The effect does not seem to work. The attack fires but the hp of the monster does not being reduced

Thanks for your time and applauses for your outstanding work :clap:
Last edited by ofelin on Sun Jul 19, 2015 5:18 am, edited 3 times in total.
User avatar
Avanael92
Advanced User
Advanced User
Posts: 189
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: EffectHandlers related question.

Post by Avanael92 »

For now I'm catching a typo at your class name :)

ReduceHp != ReduceHP

Good luck at trying to understand L2J, I'm trying that as well :mrgreen:
ofelin
Posts: 3
Joined: Tue Jun 11, 2013 6:06 pm

Re: EffectHandlers related question.

Post by ofelin »

Haha, thanks for pointing this out. Silly me :P
User avatar
Avanael92
Advanced User
Advanced User
Posts: 189
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: EffectHandlers related question.

Post by Avanael92 »

Since you have edited your first post, it's still not working? Because it does for me. Try to put in a broadcast to all players at "onStart" and see if it goes through. Apart from that, no errors or anything?
Post Reply