Jump to content

Question

Posted

Hello there, can somebody help me and give me a clue how i could make the following case?

 

While a player is in jail,  he cant target nothing (NPC's,other players, summons etc etc)

 

-Freya Client

11 answers to this question

Recommended Posts

  • 0
Posted

yea, but this way player wont be able to target players who are in jail. I want to make him cant target anything, anywhere...(Just to make it simple, i dont want it for jail, i want it for one of my conditions, so i though this jail thingy will clean things for you).

 

P.S: I want it if player.isInEvent can't target anything.....

 

FREYA CLIENT

try onAction packet you may have better results

  • 0
Posted (edited)

Basically you have to add a check @ onTarget method, like if target instanceof L2Playable || L2NpcInstance then return. Ofc you need a check about the zone first if isInsideZone(ZoneId.JAIL) or w/e method is on your pack (probably frozen) :P

 

better!

 

Do not spam.

Edited by SweeTs
  • 0
Posted (edited)

Basically you have to add a check @ onTarget method, like if target instanceof L2Playable || L2Summon then return. Ofc you need a check about the zone first if isInsideZone(ZoneId.JAIL) or w/e method is on your pack (probably frozen) :P

 

 

Do not spam.

 

I tried to this one but nothing...

 

public void setTarget(L2Object object)
{
+    if (this instanceof L2PcInstance)
+     {
+          L2PcInstance p = (L2PcInstance)this;
+           if (p.isInJail())
+          {
+                return;
+         }
+     }
     if (object != null && !object.isVisible())
         object = null;
 
    if (object != null && object != _target)
    {
         getKnownList().addKnownObject(object);
         object.getKnownList().addKnownObject(this);
     }
     _target = object;
}
 
 
L2Character.java
Edited by Medisept
  • 0
Posted (edited)
if (object instanceof L2PcInstance && object.isInsideZone(ZoneId.JAIL))
   return;

If so

Edited by SweeTs
  • 0
Posted
if (object instanceof L2PcInstance && object.isInsideZone(ZoneId.JAIL))
   return;

If so

 

 

 

yea, but this way player wont be able to target players who are in jail. I want to make him cant target anything, anywhere...(Just to make it simple, i dont want it for jail, i want it for one of my conditions, so i though this jail thingy will clean things for you).

 

P.S: I want it if player.isInEvent can't target anything.....

 

FREYA CLIENT

  • 0
Posted (edited)

Yup, I just cleaned your example.

 

Add w/e instance you want to (block) that check :P

Edited by SweeTs
Guest
This topic is now closed to further replies.
×
×
  • Create New...