Page 1 of 1

EffectHandlers related question.

Posted: Sun Jul 19, 2015 3:02 am
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:

Re: EffectHandlers related question.

Posted: Sun Jul 19, 2015 3:19 am
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:

Re: EffectHandlers related question.

Posted: Sun Jul 19, 2015 5:18 am
by ofelin
Haha, thanks for pointing this out. Silly me :P

Re: EffectHandlers related question.

Posted: Sun Jul 19, 2015 3:15 pm
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?