• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.
[TFS 1.4.2][RME] Zone System

[TFS 1.4.2][RME] Zone System

fridai

Put banana in your ear!
Joined
May 13, 2010
Messages
181
Solutions
2
Reaction score
200
GitHub
fridaii
Twitch
fridai__
fridai submitted a new resource:

[TFS 1.4.2][RME] Zone System - Place zones with RME and assign them any functionality!

Zone system is a revolutionary tool, allowing you for efficient coding based on selected area!

It contains modification to RME which allows you to select and place zoneids on map which can overlap, and later write code based on areas and Ids you selected.


Once you are done placing the zones you can register them either in movements:
View attachment 85971
or in...

Read more about this resource...
 
Dope, would've made things easier in times i couldn't code, you could always do a position ranges comparison in certain scripts, but this is much easier in case u need to add a onstepin event actionid on 30 tiles individual tiles or wasting resources with a infinite loop to check for certain conditions.
 
Thanks for sharing dude, I have been using in a lot of different ways and I haven't noticed any performance issue or bugs 🥰
 
I am utterly in love with this!
The amount of things I can script following the zones is just so practical.. saves me tons of time and configurations on positions.

This allowed me to easily create a scene that was first composed out of multiple scripts, now all in one!
The sky is the limit indeed, i've been using it for quite many things already.

  • I have coal basins, lighting up when player enter a zone.
  • I can start quests and blocking players immersively from walking into the zone when quest6 event is in progress, instead of using a lever to teleport players to a quest zone. (this is huge to me)
  • I can create regions, that will allow me to set specific raids to specific zones.
  • I can create dynamic area's that can change environments, world changes, with much ease.
The list goes on and on..

This might be the single greatest system i've been using the past year. ❤️
 
Am I missing something or doing something wrong or is this actually quite buggy?
If you add one zone in remeres and then start the server you end up with two entries for the same zone because of "Tile::setTrueZoneId"
The entire "CreatureMove" function seems to be a trainwreck.
We first get a moveEventsLists with getEvents and do nothing with it.

Then inside of the loop for tile items we get more moveEvents.
C++:
moveEvent = getEvent(tile, tileItem, eventType);
if (moveEvent) {
    ret &= moveEvent->fireStepEvent(creature, tileItem, pos, 0);
}

So we've added this code to the getEvent function with, tile, tileItem and eventType.
If there is a zone here it's going to return an event. We're going to fire it in the fireStepEvent with zone 0.
C++:
const auto& zoneIds = tile->getZoneIds();
    if (!zoneIds.empty()) {
        for (auto& zoneId : zoneIds) {
            it = zoneIdMap.find(zoneId);
            if (it != zoneIdMap.end()) {
                std::list<MoveEvent>& moveEventList = it->second.moveEvent[eventType];
                if (!moveEventList.empty()) {
                    return &(*moveEventList.begin());
                }
            }
        }
    }

Then below that we go over the zones again.
C++:
const auto& zoneIds = tile->getZoneIds();
if (!zoneIds.empty()) {
    std::vector<MoveEventList*> moveEventsLists = getEvents(tile, tileItem, eventType);
    for (auto moveEventList : moveEventsLists) {
        if (moveEventList) {
            uint32_t zoneId = moveEventList->zoneId;
            for (MoveEvent& moveEvent : moveEventList->moveEvent[eventType]) {
                ret &= moveEvent.fireStepEvent(creature, tileItem, pos, zoneId);
            }
        }
    }
}

Then we get the events again and run them again?
Using your example in the resource with the stepin event, i had my events run multiple times.

Have i done something wrong or is this just bad code?
 
i can clearly analyse what went wrong without seeing your lua code, let me just telepathically fix it.
 
i can clearly analyse what went wrong without seeing your lua code, let me just telepathically fix it.
I clearly explained i used your example as you posted in resoursces in my original post.

Create a zone with ID 100.
And there you go.
LUA:
local zone = MoveEvent()
zone:type("stepin")


function zone.onStepIn(creature, item, pos, fromPos, zonePos)
    if creature:isPlayer() then
        print("executed", zonePos)
    end
    return true
end

zone:zoneid(100)
zone:register()

Or as your example
 

Attachments

  • 1731684127364.webp
    1731684127364.webp
    46.9 KB · Views: 22 · VirusTotal
So many use cases with this resources :D. Just working on different house prices per SQM depending on Zone Id. So if house is in certain zone eg. town square it will multiply the price by value in config.lua . Idea to share ;)
 
excuse my ignorance but with these changes someone might be able to do some refreshable tiles for certain places like in old real tibia or similar?
 
Back
Top