• Sign up for TFS Icon Competition! The prize includes Otland Premium time and a medal, as well as obviously taking part in TFS history.
  • There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[8.60] OTX 3.8 - Server with REBIRTH, LOOT/TASK CHANNEL, AUTOLOOT, & DAILY TASKS.

OP
Fablow

Fablow

Intermediate OT User
Content Editor
Joined
May 7, 2008
Messages
1,569
Solutions
6
Reaction score
132
Location
Canada
GitHub
Fablow77
Updated!:


New version:


What's new?:
C++:
--Creature walkOnFields (use tags: fire, poison, energy in monster flags)
--Fixed Delay in onWalk
--Quiver for Paladins

It is recommend to use the latest sources, this has all the fixes.
 

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
246
Location
Santiago - Chile
@Fablow add this fix to the repository, it is tested and working

Fix Sight Line for players/monsters

Here is the recorded test (check Orc Spearman behaviour)
Player attack is tested too but not recorded, it works with the new sight line

Regards!

#edit
Check for this too

Can try this instead of zbisu's algorythm.

Change #1
Below
C++:
    if ((fromPos.z >= 8 && toPos.z < 8) || (toPos.z >= 8 && fromPos.z < 8)) {
        return false;
    }
Add
C++:
 int32_t deltaz = Position::getDistanceZ(fromPos, toPos);
    if (fromPos.z > toPos.z && deltaz > 2) {
        return false;
Change #2
Below
C++:
return isSightClear(fromPos, toPos, false);
}

Above
C++:
const Tile* Map::canWalkTo(const Creature& creature, const Position& pos) const

Place the following:
C++:
uint8_t Map::isTileClear(uint16_t x, uint16_t y, uint8_t z) const
{
    const Tile* tile = getTile(x, y, z);
    if (!tile || !tile->hasProperty(CONST_PROP_BLOCKPROJECTILE)) {
        return 0;
    }

    return tile->getFieldItem() ? 2 : 1;
}

uint8_t Map::getSteepLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t z) const
{
    float dx = x1 - x0;
    float dy = y1 - y0;
    float grad = (dx == 0) ? 1 : dy / dx;
    float xy = y0 + grad;

    for (int y = x0 + 1; y < x1; ++y) {
        uint16_t newX = std::floor(xy);
        uint8_t tileClear = isTileClear(newX, y, z);
        if (tileClear != 0) {
            return tileClear;
        }
        xy += grad;
    }

    return 0;
}

uint8_t Map::getSlightLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t z) const
{
    float dx = x1 - x0;
    float dy = y1 - y0;
    float grad = (dx == 0) ? 1 : dy / dx;
    float xy = y0 + grad;

    for (int x = x0 + 1; x < x1; ++x) {
        uint16_t newY = std::floor(xy + 0.1);
        uint8_t tileClear = isTileClear(x, newY, z);
        if (tileClear != 0) {
            return tileClear;
        }
        xy += grad;
    }

    return 0;
}

uint8_t Map::checkSightLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t z) const
{
    if (x0 == x1 && y0 == y1) {
        return 0;
    }

    if (std::abs(y1 - y0) > std::abs(x1 - x0)) {
        if (y1 > y0) {
            return getSteepLine(y0, x0, y1, x1, z);
        }
        return getSteepLine(y1, x1, y0, x0, z);
    }
    if (x0 > x1) {
        return getSlightLine(x1, y1, x0, y0, z);
    }

    return getSlightLine(x0, y0, x1, y1, z);
}

bool Map::isSightClear(const Position& fromPos, const Position& toPos, bool floorCheck) const
{
    uint8_t z0 = fromPos.z, z1 = toPos.z;
    if (floorCheck && z0 != z1) {
        return false;
    }

    uint16_t x0 = fromPos.x, y0 = fromPos.y, x1 = toPos.x, y1 = toPos.y;
    uint8_t sightClear = checkSightLine(x0, y0, x1, y1, z0);
    if (sightClear == 2 || sightClear == 1 && z0 == z1) {
        return false;
    }

    if (z0 < z1) {
        if (sightClear == 1 || isTileClear(x1, y1, z0) != 0) {
            return false;
        }

        for (uint8_t z = z0 + 1; z <= z1; ++z) {
            if (isTileClear(x1, y1, z) != 0 || checkSightLine(x0, y0, x1, y1, z) == 2) {
                return false;
            }
        }
    }
    else if (isTileClear(x1, y1, z1) != 0 || checkSightLine(x0, y0, x1, y1, z1) != 0) {
        return false;
    }

    return true;
}

Change#3
And this to map.h
C++:
        bool isSightClear(const Position& fromPos, const Position& toPos, bool floorCheck) const;
        uint8_t isTileClear(uint16_t x, uint16_t y, uint8_t z) const;
        uint8_t checkSightLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t z) const;
        uint8_t getSteepLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t z) const;
        uint8_t getSlightLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t z) const;
 
Last edited:

Xizze

New Member
Joined
Nov 3, 2008
Messages
14
Reaction score
3
Updated!:


New version:


What's new?:
C++:
--Creature walkOnFields (use tags: fire, poison, energy in monster flags)
--Fixed Delay in onWalk
--Quiver for Paladins

It is recommend to use the latest sources, this has all the fixes.
Iv'e downloaded the latest release from github but i get this errors in the console when i startup.

1618599548085.png

The server starts after. But i just dont know what to do. I didnt compile the latest release i just replaced the files in the org release.
 

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
246
Location
Santiago - Chile
The server starts after. But i just dont know what to do. I didnt compile the latest release i just replaced the files in the org release.
You need to compile/download the lastest release or sources. Thoose flags (canwalkon...) has been added on 1.4 version after this reviews #review1 #review2
Code:
--Creature walkOnFields (use tags: fire, poison, energy in monster flags)
Be sure to download 1.5, that has the lastest source fix based on TFS main repository.
Code:
--Optimized Pathfinding
--Fix Sight Line for players/monsters
Here you can see all the released versions, to try 1.4 if 1.5 doesn't work or has missing updates
Regards!
 
Last edited:
OP
Fablow

Fablow

Intermediate OT User
Content Editor
Joined
May 7, 2008
Messages
1,569
Solutions
6
Reaction score
132
Location
Canada
GitHub
Fablow77
Thanks to @ralke repo was updated.

Please use the latest version which is 1.5 or 1.5.0 if you want your hit points and mana points to be a percentage.


Also, I've edited Znote Acc for this distribution:

 

Monkey D Cria

New Member
Joined
May 3, 2021
Messages
3
Reaction score
1
Hey !

I am trying to create my high exp server. However, I used another distro. But now I intend to use yours because it is aimed at this type of project. Anyway, I would like very much to increase the limit of hp / mp, skills, damage and heal so that we can enjoy even more of some systems in this area. Please, It is a niche server that needs it a lot.
I've tried to use the forum distro and some tutorials, but they bug.
 
Last edited:
Top