• 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!

RevScripts Monsters respawns from x/y/z to x/y/z

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,312
Reaction score
135
Hey

Idea:

in script i can set multiple lines, to set in map areas, and in those areas monsters shoud respawn even if players are on screen, also beforing spawning and on spawn give effects.



On the server enterely players can block monster respawning, but i want to make in some areas that even player standing doesnt block monster respawning
 
I belive TFS checks monsterType:isIgnoringSpawnBlock() on spawn so you could create some monsters that ignore spawn block with attribute ignorespawnblock

XML:
<flags>
        <flag ignorespawnblock="1" />
</flags>
or in LUA:
Lua:
local mType = Game.createMonsterType("example")
local monster = {}
monster.description = "an example"

monster.flags = {
    ignoreSpawnBlock = true
}
 
I belive TFS checks monsterType:isIgnoringSpawnBlock() on spawn so you could create some monsters that ignore spawn block with attribute ignorespawnblock

XML:
<flags>
        <flag ignorespawnblock="1" />
</flags>
or in LUA:
Lua:
local mType = Game.createMonsterType("example")
local monster = {}
monster.description = "an example"

monster.flags = {
    ignoreSpawnBlock = true
}
But i want set direcly for x/y/z - x/y/z , example from 7/7/7 - 14/17/7 area all monsters starts respawning even if player is nearby.

i think your solutions doesnt help here or it does ?
 
Replace this code with:
C++:
using nonBlockableRangesVec = std::vector<std::pair<Position, Position>>;

struct spawnBlock_t {
    Position pos;
    std::vector<std::pair<MonsterType*, uint16_t>> mTypes;
    static nonBlockableRangesVec nonBlockableRanges;
    int64_t lastSpawn;
    uint32_t interval;
    Direction direction;
};

inline nonBlockableRangesVec spawnBlock_t::nonBlockableRanges = {
    {
        Position(100, 100, 7), // from
        Position(100, 100, 7)  // to
    }
};

Paste this code here
C++:
if (isBlocked)
{
    for (auto& pair : spawnBlock_t::nonBlockableRanges)
    {
        if (
            sb.pos.x >= pair.first.x && sb.pos.x <= pair.second.x &&
            sb.pos.y >= pair.first.y && sb.pos.y <= pair.second.y &&
            sb.pos.z >= pair.first.z && sb.pos.z <= pair.second.z
        ) {
            isBlocked = false;
            break;
        }
    }
}
 
Replace this code with:
C++:
using nonBlockableRangesVec = std::vector<std::pair<Position, Position>>;

struct spawnBlock_t {
    Position pos;
    std::vector<std::pair<MonsterType*, uint16_t>> mTypes;
    static nonBlockableRangesVec nonBlockableRanges;
    int64_t lastSpawn;
    uint32_t interval;
    Direction direction;
};

inline nonBlockableRangesVec spawnBlock_t::nonBlockableRanges = {
    {
        Position(100, 100, 7), // from
        Position(100, 100, 7)  // to
    }
};

Paste this code here
C++:
if (isBlocked)
{
    for (auto& pair : spawnBlock_t::nonBlockableRanges)
    {
        if (
            sb.pos.x >= pair.first.x && sb.pos.x <= pair.second.x &&
            sb.pos.y >= pair.first.y && sb.pos.y <= pair.second.y &&
            sb.pos.z >= pair.first.z && sb.pos.z <= pair.second.z
        ) {
            isBlocked = false;
            break;
        }
    }
}
Thanks, will try later



So it means, that only via source editing i can make the idea work ?
 
So it means, that only via source editing i can make the idea work ?
It will always involve C++ yes, it cannot be done just on Lua side (unless you handle the spawns from the non-blockable ranges in Lua too)
 
Back
Top