Jump to content
  • 0

Help with this please.


MoNsT3ReN4RgY

Question

Hello all..i have created a party zone for 5+ players...and i set a check if a player leaves pt or die and pressed go to village and the party goes <5 then all going back to spawn.

but when a player leaves party he isn't teleported back to Town.. party also stay inside party zone with less than 5 players..  only if the player restart will be teleported back to town.any suggestions>?

https://pastebin.com/THVrji14 

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

Check the L2Party or something like this the methods where player leaving from party or party disband. And add there check for zone and teleport out from zone.

Link to comment
Share on other sites

  • 0
15 hours ago, Rootware said:

Check the L2Party or something like this the methods where player leaving from party or party disband. And add there check for zone and teleport out from zone.

        {
        }
    if (player.isInsideZone(ZoneId.PVP))
    {
        if (getMemberCount() < 5)
        {
            getPartyMembers().forEach(s -> s.teleToLocation(MapRegionTable.TeleportWhereType.Town));
        }
    }
    }

 

i added this one under this part of code on L2Party.java

 

    /**
     * Remove player from party Overloaded method that takes player's name as parameter
     * @param name
     */
    public void removePartyMember(final String name)
    {
        final L2PcInstance player = getPlayerByName(name);
        
        if (player != null)
            removePartyMember(player);

 

but i am getting an error on (ZoneId.PVP)

 

 

Link to comment
Share on other sites

  • 0

Most likely bcs you remove player from party and then loop party, which doesn't exists anymore for that player.

 

Move it above, first do check for members count and teleport them ALL and then remove player from party.

 

Also, this is funny

 

  1. public boolean isInsidePartyZone()
  2. {
  3. return isInsidePartyZone();
  4. }
Link to comment
Share on other sites

  • 0
On 10/16/2020 at 1:07 AM, SweeTs said:

Most likely bcs you remove player from party and then loop party, which doesn't exists anymore for that player.

 

Move it above, first do check for members count and teleport them ALL and then remove player from party.

 

Also, this is funny

 

  1. public boolean isInsidePartyZone()
  2. {
  3. return isInsidePartyZone();
  4. }

i manage to do it work for the player whos leaving the Party Inside party zone. but the rest party stays inside even if they are <5 ..here is the code i added on L2Party.java

    /**
     * Remove player from party
     * @param player
     */
    public void removePartyMember(final L2PcInstance player)
    {
        removePartyMember(player, true);
        {
            if (!player.isInsideZone(L2Character.ZONE_PARTYZONE))
            {
                if (player.getPartyMembers() < 5)
            {                
                    player.sendMessage("You can't stay inside party zone without party!");
                    {
                        player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
                        return;
                }
                    }
    }
        }
    }

Link to comment
Share on other sites

  • 0
1 hour ago, Rootware said:

You need use 2 checks:

1. For leaving player.

2. For patry after player kick.

Hello Rootware...you mean something like that under the code i placed?
    /**
     * Remove Party From PartyZone
     * @param Party
     */
    
    public void removeParty(final L2PcInstance Party)
    {
        removePartyMember(Party, true);
        {
            if (!Party.isInsideZone(L2Character.ZONE_PARTYZONE))
            {
             if (Party.getPartyMembers() < 5)
            {                
                    Party.sendMessage("You can't stay inside party zone with less than 5 players party!");
                    {
                        getPartyMembers.teleToLocation(MapRegionTable.TeleportWhereType.Town);
                        return;
                }
            }
            }
        }
    }
 

Link to comment
Share on other sites

  • 0

No. Inside L2PartyZone you need manages only 2 events: enter or exit from zone. All other cases with Party you need manage inside L2Party.java class with checking all actions for location in this zone.

Link to comment
Share on other sites

  • 0
2 hours ago, Rootware said:

No. Inside L2PartyZone you need manages only 2 events: enter or exit from zone. All other cases with Party you need manage inside L2Party.java class with checking all actions for location in this zone.

even this one is not working.. 

 

 

    public void removePartyMember(final L2PcInstance player)
    {
        removePartyMember(player, true);
        {
            if (player.isInsideZone(L2Character.ZONE_PARTYZONE) && (player.isInParty() && player.getPartyMembers() < 5 ))
            {            
                    player.sendMessage("You can't stay inside party zone without party!");
                    {
                        getPartyMembers().forEach(s -> s.teleToLocation(MapRegionTable.TeleportWhereType.Town));
                        return;
                }
            }
            }
        }

Link to comment
Share on other sites

  • 0

When you do Party#removePartyMember, it does what it says ; therefore all additional checks about Player's Party will return false, since he is ALREADY OUT OF THE PARTY. Interrogating Player#getParty() will therefore return ALWAYS NULL, which is PERFECTLY LOGICAL.

 

If you want to code such thing, you have to either :

  • In case of a second method using Party#removePartyMember (what you currently do) RETAIN the Party of the Player into a variable, and reuse it just after Party#removePartyMember if != null (Party can be disband by default in removePartyMember)
  • In case of Party#removePartyMember method edit : write directly in the method whatever check (there are already such checks for Duel and Dimensional Rift, DuelManager/DimensionalRiftManager#onPartyEdit - in L2J, EVERYTHING ALREADY EXISTS).

The good approach is the SECOND approach, since some vars are already validated inside the method (notably, player != null and Party#contains)

Edited by Tryskell
Link to comment
Share on other sites

  • 0
On 10/18/2020 at 11:49 AM, MoNsT3ReN4RgY said:

i manage to do it work for the player whos leaving the Party Inside party zone. but the rest party stays inside even if they are <5

I already told you what to do. Not my fault you don't listen.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Thank you for your reply. I have removed it from the L2Server.exe file, but the L2Server still crashes. It doesn't crash if I don't start l2npc, otherwise it will crash within a few days at the latest.
    • Welcome to my store :  https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11 Telegram : https://t.me/ultrastore1 Welcome to my store :  https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11
    • L2 ArenaWar: Low Rate PvP Server with Free Buffs & Autofarm [PVP]⚔️ [Free]🆓 Classic Interlude with  3x XP rates! Free starter pack(no grade) to kickstart your adventure! Autofarm for convenient grinding! Free buffs to keep you fighting fit! (2 job buffs) No experience loss on death! (Except with Karma) Clear Karma system to keep things fair! ⚖️ Active community of 800-1k players! Join our Discord to learn more! >> Discord <<     Server website: https://l2arenawar.com/en/    
    • This is dedication! 2 years working on a problem. Congratulations!
    • You indeed have to save player position over Enterworld to properly clean it up later (if you don't, even trying to delete packet content would eventually keep it up), that's what we do with debug packet (which is a reusable Map of ExServerPrimitive packets) on aCis.   It doesn't solve the FPS stuttering - more you draw/delete lines, more your client becomes laggy. It's like if client wasn't deleting drawn points/lines properly, but instead simply hide them and redrawn content above.   If you got a solution, I would happy to integrate it.   You should check aCis#Player _debug packet integration, it allows very big amount of lines/points to be drawn, it is also reusable.   https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java?ref_type=heads https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java?ref_type=heads  
  • Topics

×
×
  • Create New...