Jump to content
  • 0

[+1 reward]Zone[NO clan]


Question

7 answers to this question

Recommended Posts

  • 0
Posted

"getClan() != null" check on onEnter method from your custom zone. As it's a L2Character, you have to retrieve the player first via getActingPlayer, if it's != null then it is a summon/player and you can act on it, otherwise do nothing. About the "if" part, it depends... Probably you want to teleport to another loc.

 

For complete code or details, ask another person. Here's a skeleton, it is 80% of your ask :

 

// Retrieve the acting player ; owner in case of a summon, player in case of player. Otherwise, do nothing.
final L2PcInstance victim = character.getActingPlayer();
if (victim != null && victim.getClan() != null)
{
    // Do whatever you want with character (NOT victim , it is "character" who entered in the zone), probably teleport it out.
    character.doSomething();
}

 

PS : if you say you got a red error on doSomething() method, I swear I close your thread.

  • 0
Posted

"getClan() != null" check on onEnter method from your custom zone. As it's a L2Character, you have to retrieve the player first via getActingPlayer, if it's != null then it is a summon/player and you can act on it, otherwise do nothing. About the "if" part, it depends... Probably you want to teleport to another loc.

 

For complete code or details, ask another person. Here's a skeleton, it is 80% of your ask :

 

// Retrieve the acting player ; owner in case of a summon, player in case of player. Otherwise, do nothing.
final L2PcInstance victim = character.getActingPlayer();
if (victim != null && victim.getClan != null)
{
    // Do whatever you want with character (NOT victim , it is "character" who entered in the zone), probably teleport it out.
    character.doSomething();
}

 

PS : if you say you got a red error on doSomething() method, I swear I close your thread.

 

Lol, i'm stupid :D why you give me that kind of code's to think about...

I'm looking for answer for stupid people... like me :D

So what happend? :

@Override

protected void onEnter(L2Character character)

{

character.setInsideZone(L2Character.ZONE_PVP, false);

character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);

 

if (character instanceof L2PcInstance)

{

      ((L2PcInstance) character).sendMessage("You enter a PvP Area");

          ((L2PcInstance) character).setPvpFlag(1);

        // Retrieve the acting player ; owner in case of a summon, player in case of player. Otherwise, do nothing.

          final L2PcInstance victim = character.getActingPlayer();

          if (player.getClan != null)

          {

              // Do whatever you want with character (NOT victim , it is "character" who entered in the zone), probably teleport it out.

              character.teleToLocation(100,100,100);

          }

}

}

 

 

1 problem, help :D

  • 0
Posted
@Override

protected void onEnter(L2Character character)

{

character.setInsideZone(L2Character.ZONE_PVP, false);

character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);

 

if (character instanceof L2PcInstance)

{

      ((L2PcInstance) character).sendMessage("You enter a PvP Area");

          ((L2PcInstance) character).setPvpFlag(1);

        // Retrieve the acting player ; owner in case of a summon, player in case of player. Otherwise, do nothing.

          final L2PcInstance player = character.getActingPlayer();

          if (player.getClan != null)

          {

              // Do whatever you want with character (NOT victim , it is "character" who entered in the zone), probably teleport it out.

              character.teleToLocation(100,100,100);

          }

}

}

 

 

@Override

 

After i change Victim to player...

method .getclan is in red now :D

 

 

 if (player.getClan() != null)

This should work?

  • 0
Posted

"getClan() != null" check on onEnter method from your custom zone. As it's a L2Character, you have to retrieve the player first via getActingPlayer, if it's != null then it is a summon/player and you can act on it, otherwise do nothing. About the "if" part, it depends... Probably you want to teleport to another loc.

 

For complete code or details, ask another person. Here's a skeleton, it is 80% of your ask :

 

// Retrieve the acting player ; owner in case of a summon, player in case of player. Otherwise, do nothing.
final L2PcInstance victim = character.getActingPlayer();
if (victim != null && victim.getClan != null)
{
    // Do whatever you want with character (NOT victim , it is "character" who entered in the zone), probably teleport it out.
    character.doSomething();
}

 

PS : if you say you got a red error on doSomething() method, I swear I close your thread.

+1 for you thanks for help, solved

  • 0
Posted

player will be null if a monster enters in the zone, be sure to make as I said, all was useful.

 

With your code, if a monster enters in the zone you will have a NPE.

 

And yes sorry I have forgotten (), I edited skeleton.

Guest
This topic is now closed to further replies.


×
×
  • Create New...