Jump to content
  • 0

[JAVA Help] Cancel Skills!!!


Question

Posted

Hello my friends,

 

I want someone experienced with java to tell me if i can resolve my problem..

 

I want to make the Cancellation skills to work only in olympiand.

E.g. the Chance of the skills outside the olympiand will become 0 and in the olympiand increased automatic based on my xml chance. Or the opposite. i dont know.

 

Can anyone help me to solve that?

 

Thanks in advance!!

11 answers to this question

Recommended Posts

  • 0
Posted

try

 

Index: dist/game/data/scripts/handlers/skillhandlers/Cancel.java
===================================================================
--- dist/game/data/scripts/handlers/skillhandlers/Cancel.java	(revision 263)
+++ dist/game/data/scripts/handlers/skillhandlers/Cancel.java	(working copy)
@@ -114,6 +114,16 @@
			if (target.isDead())
				continue;

+			if(target instanceof L2PcInstance)
+			{
+				L2PcInstance targ = (L2PcInstance)target;
+				
+				if(!targ.isInOlympiadMode())
+				{
+					continue;
+				}
+			}
+			
			int lastCanceledSkillId = 0;
			int count = skill.getMaxNegatedEffects();
			double rate = skill.getPower();

  • 0
Posted

try

 

Index: dist/game/data/scripts/handlers/skillhandlers/Cancel.java
===================================================================
--- dist/game/data/scripts/handlers/skillhandlers/Cancel.java	(revision 263)
+++ dist/game/data/scripts/handlers/skillhandlers/Cancel.java	(working copy)
@@ -114,6 +114,16 @@
			if (target.isDead())
				continue;

+			if(target instanceof L2PcInstance)
+			{
+				L2PcInstance targ = (L2PcInstance)target;
+				
+				if(!targ.isInOlympiadMode())
+				{
+					continue;
+				}
+			}
+			
			int lastCanceledSkillId = 0;
			int count = skill.getMaxNegatedEffects();
			double rate = skill.getPower();

 

That is for all Cancell skills mate??

  • 0
Posted

^Wyatt, "continue" involves you're already in a "for" loop (I'm lazy to check), makes it way before in order to avoid useless loop.

 

if (!currentGuyCasting.isInOlympiadMode)
      return;

 

Something like. Can change success rate for 0 instead, or add a message to previous, whatever you want.

  • 0
Posted

^Wyatt, "continue" involves you're already in a "for" loop (I'm lazy to check), makes it way before in order to avoid useless loop.

 

But that code is inside a "for" loop, but doesn't appear in the patch...

look to... if isDead()  continue... it's by default...

  • 0
Posted

What I posted... tryskell said that shouldn't be "continue" and should be "return" but is coz he didn`t see the "for" loop coz it doesn't appear in the patch, but it's there.

  • 0
Posted

Hey I want to add this for effecthandlers too . but it doesnt work..

this is my code :

 

	private static boolean cancel(L2Character caster, L2Character target, L2Effect effect)
{

+		if(target instanceof L2PcInstance)
+		{
+			L2PcInstance targ = (L2PcInstance)target;
+			
+			if(!targ.isInOlympiadMode())
+			{		
+				continue;
+			}
+
	if (target.isDead())
	{
		return false;
	}

 

 

and this my error I dont know whats wrong ...

 

----------
1. ERROR in /root/quitt/game2/game/data/scripts/handlers/effecthandlers/Cancel.java (at line 230)
return true;
           ^
Syntax error, insert "}" to complete Statement
----------
1 problem (1 error)Syntax error, insert "}" to complete Statement
Exception in thread "main" java.lang.Error: Problems while running EffectMansterHandler
at com.l2jserver.gameserver.handler.EffectHandler.executeScript(EffectHandler.java:69)
at com.l2jserver.gameserver.GameServer.<init>(GameServer.java:217)
at com.l2jserver.gameserver.GameServer.main(GameServer.java:459)
Caused by: javax.script.ScriptException: compilation failed
at com.l2jserver.script.java.JavaScriptEngine.compile(JavaScriptEngine.java:248)
at com.l2jserver.script.java.JavaScriptEngine.compile(JavaScriptEngine.java:103)
at com.l2jserver.script.java.JavaScriptEngine.compile(JavaScriptEngine.java:109)
at com.l2jserver.gameserver.scripting.L2ScriptEngineManager.executeScript(L2ScriptEngineManager.java:375)
at com.l2jserver.gameserver.scripting.L2ScriptEngineManager.executeScript(L2ScriptEngineManager.java:326)
at com.l2jserver.gameserver.handler.EffectHandler.executeScript(EffectHandler.java:65)
... 2 more

  • 0
Posted

Drop the trash you did and put :

 

+ if (target instanceof L2PcInstance && !((L2PcInstance)target).isInOlympiadMode())
+	return false;

 

I didn't test the "!" condition. Just add some () if you got an error.

Guest
This topic is now closed to further replies.


×
×
  • Create New...