Jump to content
  • 0

geodata z check


Question

Posted (edited)

Hello.

Now im trying to find where is problem, but can't :D

function:

    public boolean canSeeTarget(final L2Object cha, final L2Object target)
    {
        // If geo is off do simple check :]
        // Don't allow casting on players on different dungeon lvls etc
        return Math.abs(target.getZ() - cha.getZ()) < 1000;
    }

check:

		if (skill.getCastRange() > 0 && !GeoData.getInstance().canSeeTarget(this, target))
		{
			sendMessage("target z:"+target.getZ()+" cha z:"+this.getZ()+"Z:"+ Math.abs(target.getZ() - this.getZ()));
			sendPacket(new SystemMessage(SystemMessageId.CANT_SEE_TARGET));
			sendPacket(ActionFailed.STATIC_PACKET);
			return;
		}


https://prnt.sc/gk7yg8

cast range = 900
565-565=0

0<1000=true
900>0 = true

so it must be true and false in if.

so where is problem?

and this problem only in fortress of dead

Edited by wongerlt

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

And the problem is? Even if the value is +-900, it's still < 1000, so it returns true.

Edited by SweeTs
  • 0
Posted
52 minutes ago, SweeTs said:

And the problem is? Even if the value is +-900, it's still < 1000, so it returns true.

canseetarget return false, but why?

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.

×
×
  • Create New...