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

    • I think its offline. They deleted all channels in Discord. Maybe because had to give the $500 contest reward 😄
    • amigo como eu coloco pra mostra os icone enchant no inventory  vc pode da essa ajuda @ShooterLineage2 ?
    • 📢 𝐖𝐞 𝐚𝐫𝐞 𝐢𝐧 𝐛𝐞𝐭𝐚 𝐭𝐞𝐬𝐭, 𝐰𝐞 𝐰𝐢𝐥𝐥 𝐬𝐭𝐚𝐫𝐭 𝐨𝐧 𝐉𝐮𝐧𝐞 𝟐𝟎 𝐚𝐭 𝟏𝟖:𝟎𝟎 𝐦𝐨𝐫𝐞 𝐢𝐧𝐟𝐨𝐬 𝐢𝐧 https://l2bless.online/infos.html ⚔️ 𝗥𝗮𝘁𝗲𝘀: 𝗫𝗣 𝟐𝟎𝐗, 𝗔𝗱𝗲𝗻𝗮 𝟐𝟎𝐗, 𝗦𝗽𝗼𝗶𝗹 𝟐𝟎𝐗, 𝗗𝗿𝗼𝗽 𝟐𝟎𝐗, 💬 𝗠𝗮𝘅 𝗲𝗻𝗰𝗵𝗮𝗻𝘁 +𝟭𝟲 𝘄𝗶𝘁𝗵 𝟲𝟱% 𝗻𝗼𝗿𝗺𝗮𝗹 𝗮𝗻𝗱 𝟳𝟬% 𝗯𝗹𝗲𝘀𝘀𝗲𝗱, 👉 𝟳𝟬+ 𝗔𝘂𝘁𝗼 𝗲𝘃𝗲𝗻𝘁𝘀, 𝗖𝘂𝘀𝘁𝗼𝗺 𝗥𝗮𝗶𝗱𝘀, 𝟱𝟱 𝗻𝗲𝘄𝘀 𝗖𝗹𝗼𝗮𝗸𝘀, 🌍 𝗪𝗲𝗯𝗦𝗶𝘁𝗲: https://l2bless.online/
    • What unique features ? 
    • Welcome to SmurfsZone   Buy League of Legends accounts across all servers and jump straight into Ranked Games with amazing quality and support.   Why Choose SmurfsZone? 24/7 Instant Delivery: Get your full access LoL smurf account immediately. 100% Hand-Leveled: High-quality accounts leveled by hand. Versatile MMR Options: High MMR, Standard MMR, Fresh MMR (ARAMs), and Ranked accounts available. Valorant Accounts: Expand your gaming experience. Our Commitment to You: Unopened Loot: Customize your champion pool. Lifetime Warranty: Valid if you change the email, username, and password upon purchase. Password Changeable: Ensure your account's security. Full Recovery Information: Complete access to account recovery details. Unverified and Changeable Email: Easy to personalize and secure your account. Completely Unranked: Fresh start with no ranked history in any season. Responsive Customer Support: Our dedicated team is available to assist you 24/7.   Experience the best place to buy League of Legends accounts with exceptional quality and dedicated support. We're here for YOU!
  • Topics

×
×
  • Create New...