L2JMobius

High Five attack inside the city

Susuy · 12 · 2742

Offline Susuy

  • Heir
  • **
    • Posts: 32
I'm adding the townWar event and so far everything is working correctly with the exception of using skills.
Can anyone who can help me with this?
players attack each other with weapons but fighters don't use offensive skills or debuffs and mages don't attack with magic during the event. I couldn't find which part of the code to modify...


Offline nasseka

  • Distinguished King
  • *****
    • Posts: 1729
    • L2Unknown

Offline Susuy

  • Heir
  • **
    • Posts: 32
yes, anyway the event works as it should, the cursor changes to a sword like in sieges. it is possible to kill the other player by attacking with F1, respawn is normal, add pvp points too. what is not possible is to attack using skills


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16047
Code: [Select]
Index: java/org/l2jmobius/gameserver/model/actor/Player.java
===================================================================
--- java/org/l2jmobius/gameserver/model/actor/Player.java (revision 10372)
+++ java/org/l2jmobius/gameserver/model/actor/Player.java (working copy)
@@ -8373,7 +8373,7 @@
  // Check if the attacker is a Playable
  if (attacker.isPlayable())
  {
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) && !eventIsActive())
  {
  return false;
  }



Offline Index

  • Black Sheep
  • Marquis
  • *****
    • Posts: 536
did not work
it been example.
You need make implementation of "is Event Activity" or change it on FALSE


Offline Susuy

  • Heir
  • **
    • Posts: 32
I use "isInTownWarEvent()" which does the same thing. the problem is in the amount as they restrict.
in Player.java and in Creature.java there are messages informing that the player cannot attack in a peaceful area, I modified the verification and now the players attack with magic! but for some reason they stopped attacking physically. the mobius tip didn't work. what made them physically attack each other was before "if (attacker.isPlayable())" I added

if (attacker.isPlayable() && isInTownWarEvent())

after I added checks in Player and Creature to release skills now only skills work and stopped attacking each other physically


Offline kinghanker

  • Knight
  • ***
    • Posts: 64
Try!!!

Player.java
Code: [Select]
public boolean isAutoAttackable(Creature attacker)
{
if (attacker == null)
{
return false;
}

// Check if the attacker isn't the Player Pet
if ((attacker == this) || (attacker == _summon))
{
return false;
}

+if (attacker.isInTownWarEvent())
+{
+ return true;
+}

Creature.java
Code: [Select]
public boolean isInsidePeaceZone(Player attacker)
{
+ if (attacker.isPlayer() && attacker.isInTownWarEvent())
+ {
+ return false;
+ }
return isInsidePeaceZone(attacker, this);
}
probably the chars will attack each other


Offline Susuy

  • Heir
  • **
    • Posts: 32
Try!!!

Player.java
Code: [Select]
public boolean isAutoAttackable(Creature attacker)
{
if (attacker == null)
{
return false;
}

// Check if the attacker isn't the Player Pet
if ((attacker == this) || (attacker == _summon))
{
return false;
}

+if (attacker.isInTownWarEvent())
+{
+ return true;
+}

Creature.java
Code: [Select]
public boolean isInsidePeaceZone(Player attacker)
{
+ if (attacker.isPlayer() && attacker.isInTownWarEvent())
+ {
+ return false;
+ }
return isInsidePeaceZone(attacker, this);
}
probably the chars will attack each other
it worked, thank you very much


Offline Susuy

  • Heir
  • **
    • Posts: 32
Guys, I came back with the same problem in a different way!
During the townWar event players attack each other and use skills correctly but some skills still don't work.
Massive and area skills do not work. the skill rush for example, when the player tries to use nothing happens. can anyone help me with this?


Offline kinghanker

  • Knight
  • ***
    • Posts: 64
I had the same problem and I managed to solve it this way
Code: [Select]
--- a/java/org/l2jmobius/gameserver/model/skill/Skill.java
+++ b/java/org/l2jmobius/gameserver/model/skill/Skill.java
@@ -1109,7 +1109,7 @@ public class Skill implements IIdentifiable
  return false;
  }
 
- if (skill.isBad() && target.isInsideZone(ZoneId.PEACE))
+ if (skill.isBad() && target.isInsideZone(ZoneId.PEACE) && !targetPlayer.isInTownWarEvent())
  {
  return false;
  }
@@ -1139,7 +1139,7 @@ public class Skill implements IIdentifiable
  return false;
  }
 
- if (!sourceInArena && !(targetPlayer.isInsideZone(ZoneId.PVP) && !targetPlayer.isInsideZone(ZoneId.SIEGE)))
+ if (!sourceInArena && !(targetPlayer.isInsideZone(ZoneId.PVP) && !targetPlayer.isInsideZone(ZoneId.SIEGE)) && !targetPlayer.isInTownWarEvent())


Offline Susuy

  • Heir
  • **
    • Posts: 32