L2JMobius

Free Users => General Discussion => Topic started by: Susuy on June 28, 2022, 05:37:38 PM

Title: attack inside the city
Post by: Susuy on June 28, 2022, 05:37:38 PM
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...
Title: Re: attack inside the city
Post by: nasseka on June 28, 2022, 09:05:50 PM
turn the zone pvp during event?
Title: Re: attack inside the city
Post by: Susuy on June 28, 2022, 10:29:48 PM
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
Title: Re: attack inside the city
Post by: Mobius on June 28, 2022, 10:38:34 PM
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;
  }
Title: Re: attack inside the city
Post by: Susuy on June 29, 2022, 08:13:17 AM
did not work
Title: Re: attack inside the city
Post by: Index on June 29, 2022, 11:30:21 AM
did not work
it been example.
You need make implementation of "is Event Activity" or change it on FALSE
Title: Re: attack inside the city
Post by: Susuy on June 29, 2022, 07:20:39 PM
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
Title: Re: attack inside the city
Post by: kinghanker on June 30, 2022, 05:32:20 AM
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
Title: Re: attack inside the city
Post by: Susuy on June 30, 2022, 02:10:05 PM
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
Title: Re: attack inside the city
Post by: Susuy on August 03, 2022, 08:58:42 PM
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?
Title: Re: attack inside the city
Post by: kinghanker on August 10, 2022, 03:26:51 AM
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())
Title: Re: attack inside the city
Post by: Susuy on August 10, 2022, 10:54:17 PM
solved, now the whole event works perfectly