L2JMobius

level restriction siege area

Marrdin · 4 · 816

Offline Marrdin

  • Vassal
  • *
    • Posts: 7
Hi.
Im thinking that different castles can have different lvl requirements to siege them. This is one step to keep lower lvl areas alive through the whole server lifetime.
For example, gludio castle max lvl 40, dion castle max lvl 52, shuttgart castle max lvl 61, rune castle max lvl 80.
Is it hard to add this feature in the siege file?
Greatful for help. 

//Marrdin


Offline D00M

  • Vassal
  • *
    • Posts: 5
I think for a low/medium rates server is a great feature. I hope you can make it work !


Online Reanimation

  • Knight
  • ***
    • Posts: 62
Hi.
Im thinking that different castles can have different lvl requirements to siege them. This is one step to keep lower lvl areas alive through the whole server lifetime.
For example, gludio castle max lvl 40, dion castle max lvl 52, shuttgart castle max lvl 61, rune castle max lvl 80.
Is it hard to add this feature in the siege file?
Greatful for help. 

//Marrdin

hello, good afternoon, do this test for the areas that you say you want to do

create the class corresponding to the zone you want to make, in this case: LevelZone11To20.java
in the following location:
package org.l2jmobius.gameserver.model.zone.type.LevelZone11To20.java
Code: [Select]
package org.l2jmobius.gameserver.model.zone.type;

import org.l2jmobius.gameserver.data.SkillTable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.zone.ZoneType;

public class LevelZone11To20 extends ZoneType
{
    public LevelZone11To20(int id)
    {
        super(id);
    }
   
    @Override
    protected void onEnter(Creature creature)
    {
        if (creature instanceof Player)
        {
            Player player = (Player) creature;
            if (player.getLevel() >= 11 && player.getLevel() <= 20)
            {
                // Apply effects and set PvpFlag
                SkillTable.getInstance().getSkill(1323, 1).applyEffects(player, player);
                player.setPvpFlag(1);
                player.sendMessage("You entered a Level 11-20 Zone.");
                player.broadcastUserInfo();
            }
            else
            {
                // Teleport to nearest town
                player.teleToLocation(0, 0, 0); // Replace with real coordinates, by coordinates of the city you want the characters to return to
            }
        }
    }
   
    @Override
    protected void onExit(Creature creature)
    {
        if (creature instanceof Player)
        {
            Player player = (Player) creature;
            if (player.getLevel() >= 11 && player.getLevel() <= 20)
            {
                // Remove effects and reset PvpFlag
                player.stopSkillEffects(1323);
                player.setPvpFlag(0);
                player.sendMessage("You left the Level 11-20 Zone.");
                player.broadcastUserInfo();
            }
        }
    }
}


now you must add, that is, register the zone in the ZoneData.java class
the one in the following location
package org.l2jmobius.gameserver.data.xml.ZoneData.java
add line
Code: [Select]
case "LevelZone11To20":
{
      temp = new LevelZone11To20(zoneId);
break;
}

Finally, you must create the xml file where you are going to specify the zone, with its coordinates and locations.
game\data\zones\LevelZone11To20.xml
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
<zone name="Primeval Isle" type="LevelZone11To20" shape="NPoly" minZ="-4290" maxZ="-1290"> <!-- Primeval Isle (Town Zone) -->
<node X="10408" Y="-27395" />
<node X="12065" Y="-25334" />
<node X="12223" Y="-23159" />
<node X="10424" Y="-22340" />
<node X="9566" Y="-23131" />
<node X="9290" Y="-24261" />
<spawn X="10468" Y="-24569" Z="-3645" />
</zone>
</list>

Remember, that this is just an example of a basic code, that you may need to adjust some values, for that you can use other types of zones that already exist in the source as an example.

I hope it is helpful, you can tell me anything and I will gladly try to help you.


Offline Marrdin

  • Vassal
  • *
    • Posts: 7