Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
Tile is walkable help.. - Page 2
Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Tile is walkable help..

  1. #11
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    RE: Tile is walkable help..

    Do you use memory locations? They are necessary to find paths, as the player will not always be in the center of the grid

  2. #12
    Senior Member
    Join Date
    May 2009
    Posts
    107

    RE: Tile is walkable help..

    Can someone help me ?
    I have USD 11,40 on paypal to give XD

    They are not out of limit, never o_0
    So I can't understand why this still occurs :/
    (Look at the generated map by map-reading)
    http://postimage.org/gallery/5exxjai/27da07c7/
    The bug is on half of screen each X sqms

    [code=Delphi]
    Function Rel_Z(TileNum:integer):integer;
    begin
    Result := trunc( TileNum / (14 * 18) );
    result := fixThreshhold(result, 8);
    if not between(result, 0, 8) then showmessage('z: ' + inttostr(result));
    end;

    Function Rel_Y(TileNum:integer):integer;
    begin
    Result := trunc((TileNum - Rel_Z( TileNum ) * 14 * 18) / 18);
    result := fixThreshhold(result, 14);
    if not between(result, 0, 14) then showmessage('y: ' + inttostr(result));
    end;

    Function Rel_X(TileNum:integer):integer;
    begin
    Result := trunc(TileNum - Rel_Z(TileNum) * 14 * 18 - Rel_Y( TileNum ) * 18);
    result := fixThreshhold(result, 18);
    if not between(result, 0, 18) then showmessage('x: ' + inttostr(result));
    end;

    Function Abs_Z(TileNum:integer):integer;
    begin
    Result := p.Z + Rel_Z( tileNum ) - Rel_Z( PlayerTile );
    end;

    Function Abs_Y(TileNum:integer):integer;
    begin
    Result := p.Y + Rel_Y( tileNum ) - Rel_Y( PlayerTile );
    end;

    Function Abs_X(TileNum:integer):integer;
    begin
    Result := p.X + Rel_X( tileNum ) - Rel_X( playerTile );
    end;
    [/code]

    Formulas are the same as TibiaAuto article :/

  3. #13
    Senior Member
    Join Date
    Jan 2012
    Posts
    417

    RE: Tile is walkable help..

    several problems on some tile check property is due to some mistake at GetTile(x,y,z)... so I recommend you give it a try

    [Tutorial] Map Structure

  4. #14
    Senior Member
    Join Date
    May 2009
    Posts
    107

    RE: Tile is walkable help..

    I am able to do everything on this tutorial, I can understand...
    I just can't understad why some places bug, cause formulas are correct :|

  5. #15

    RE: Tile is walkable help..

    Different languages handle non-float to floating point operations differently. All of you values are integers. I don't know delphi but its possible that extra floating point data is being discarded, making your math operate incorrectly. Try using float values to do the math and then using floor to make them int after all math is complete.

  6. #16
    Senior Member
    Join Date
    May 2009
    Posts
    107

    RE: Tile is walkable help..

    I wanna die :dodgy:
    I looked on a old "maces quick fish", and even using his functions, the problem persist o___o
    Look he did what you are saying, first do the maths and after floor/trunc the value :0

    [code=Delphi]
    function Rel_Z(ATileNum: Integer): Integer;
    var
    vValue: Extended;
    begin
    vValue := ATileNum / (14 * 18);
    Result := Trunc(vValue);
    end;

    function Rel_Y(ATileNum: Integer): Integer;
    var
    vValue: Extended;
    begin
    vValue := (ATileNum - Rel_Z(ATileNum) * 14 * 18) / 18;
    Result := Trunc(vValue);
    end;

    function Rel_X(ATileNum: Integer): Integer;
    var
    vValue: Extended;
    begin
    vValue := (ATileNum - Rel_Z(ATileNum) * 14 * 18 - Rel_Y(ATileNum) * 18);
    Result := Trunc(vValue);
    end;
    [/code]

    Even TibiaAPI do the same:
    [code=C#]
    public static Location ToMemoryLocation(this uint tileNumber)
    {
    Location l = new Location();

    l.Z = Convert.ToInt32(tileNumber / (14 * 18));
    l.Y = Convert.ToInt32((tileNumber - l.Z * 14 * 18) / 18);
    l.X = Convert.ToInt32((tileNumber - l.Z * 14 * 18) - l.Y * 18);

    return l;
    }
    [/code]
    :huh:
    Any Delphi programmer can give-me a hand ?
    Maybe a mistake or a bug ?
    Thanks

    ---
    and no, I am not copyng and pasting without knowing what I am doing o_x

  7. #17

    RE: Tile is walkable help..

    You didn't change shit. Your inputs are still integers and will be treated as integers, regardless of where the result is being moved to or what type it is. Cast your inputs to float. Also, like I said, floating point math is usually handled different for different languages, so what TibiaAPI does is irrelevant. If floats don't work and you're correctly fixing the "threshhold," I have no clue what to tell you, because the code I've shown works for me.

  8. #18
    Senior Member
    Join Date
    May 2009
    Posts
    107

    RE: Tile is walkable help..

    Darkstar, now I understood the *** I did XD
    The problem is that I was trying to map read with the 4 parts from TibiaAuto's article, and I never got the part 5 and it's utility...

    Today I though: "It would be strange exist a useless part"
    Then I tried to undestand and I looked at more examples at TibiaAPI and Blequi tutorial...

    Finally *_*

    Thanks everyone )

    #############
    So, if you are getting the same problem, try the Darkstar's solution.
    If the problem persists, try to convert XYZ to tileNumber, then loop
    though the tiles, check if the number = tileNumberStored and do what you want

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •