Page 1 of 1

Zone

Posted: Sat Jun 29, 2013 12:53 am
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?

Re: Zone

Posted: Sat Jun 29, 2013 10:22 am
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.

Re: Zone

Posted: Mon Nov 04, 2013 9:38 pm
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

Re: Zone

Posted: Tue Nov 05, 2013 4:23 am
by Zoey76
You need to save the old quest somewhere, otherwise you set crest 0 and then you restore last crest: 0.

Re: Zone

Posted: Wed Nov 06, 2013 9:34 am
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?

Re: Zone

Posted: Wed Nov 06, 2013 9:41 am
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.