Zone

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
t102030
Posts: 24
Joined: Sun Jun 23, 2013 2:32 am

Zone

Post by t102030 »

L2J Revision Number: 6086
L2JDP Revision Number: 9839

Hello, I have created one new Zone but i get one error on start the game server!

ScreenShot:
Image

My Custom Zone:

Code: Select all

package com.l2jserver.gameserver.model.zone.type; import java.util.Random; import com.l2jserver.gameserver.ThreadPoolManager;import com.l2jserver.gameserver.model.actor.L2Character;import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;import com.l2jserver.util.Rnd; public class L2CustomPvP extends L2RespawnZone{    L2PcInstance activeChar;    private static int[] _x =    {        11551,        10999,        10401    };    private static int[] _y =    {        -24264,        -23576,        -24030    };    private static int[] _z =    {        -3644,        -3651,        -3660    };        public L2CustomPvP(int id)    {        super(5555);    }        @Override    protected void onEnter(L2Character character)    {        if (character instanceof L2PcInstance)        {            Random r = new Random();            activeChar.setName("" + r.nextInt());            activeChar.setClan(null);            activeChar.getClan().setCrestId(0);            ((L2PcInstance) character).setPvpFlag(1);        }    }        static class BackToPvp implements Runnable    {        private final L2Character _activeChar;                BackToPvp(L2Character character)        {            _activeChar = character;        }                @SuppressWarnings("synthetic-access")        @Override        public void run()        {            int r = Rnd.get(3);            _activeChar.teleToLocation(_x[r], _y[r], _z[r]);        }    }        @Override    public void onDieInside(L2Character character)    {        if (character instanceof L2PcInstance)        {        }    }        @Override    public void onReviveInside(L2Character character)    {        ThreadPoolManager.getInstance().scheduleGeneral(new BackToPvp(character), 500);        ((L2PcInstance) character).isNoblesseBlessed();    }}
HOW TO FIX IT?
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Zone

Post by jurchiks »

That script is awful...
You're using both java.util.Random AND com.l2jserver.util.Rnd, coordinates are arrays of integers instead of an array of 3x Location objects, onEnter is simply terrible, you'll ruin the player's experience on your server (you're removing their clan and changing their name without restoring it when they come back out), and there's even an NPE in there (activeChar.getClan().setCrestId(0) will fail because you set the player's clan to null in the previous line).

I'd definitely advise not using that script.

And the error is probably because the zone XSD has a list of allowed zone types and you haven't added your new zone in that list, so the parser considers it invalid.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Re: Zone

Post by HappyLDE »

How to hide crest and put it back? Because that code don't work! The hide work but the putback doesn't. Event after you restart, the crest won't show back.. Btw is this affecting whole clan crest on all players or just the player's object copy of clan?

Code: Select all

 // OnEnterplayer.getClan().setCrestId(0); // OnExitplayer.getClan().setCrestId(player.getClan().getCrestId()); 
I tested now in local server and if a player enters... all the others get their crest removed! xD
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7008
Joined: Tue Aug 11, 2009 3:36 am

Re: Zone

Post by Zoey76 »

You need to save the old quest somewhere, otherwise you set crest 0 and then you restore last crest: 0.
Powered by Eclipse 4.34 🌌 | Eclipse Temurin 21 ☕ | MariaDB 11.3.2 🗃️ | L2J Server 2.6.3.0 - High Five 🚀

🔗 Join our Discord! 🎮💬
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Re: Zone

Post by HappyLDE »

Zoey76 wrote:You need to save the old quest somewhere, otherwise you set crest 0 and then you restore last crest: 0.
You mean old clan in L2PcInstance? I done it but if someone get client crash in that zone he won't get the oldCLan back.. player.setClan() changes database or just running instance?
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
NosBit
L2j Veteran
L2j Veteran
Posts: 314
Joined: Mon Mar 11, 2013 4:19 pm

Re: Zone

Post by NosBit »

What you are trying todo will remove crest for all clan members i would add a boolean on L2PcInstance that would make L2PcInstance.getClanCrestId() return 0.
Image
Post Reply