Mist world bot

mwBot => English zone => Topic started by: Nikolaj on 20 July 2024, 11:29

Title: Obstacle maps. How to use it? character auto navigation
Post by: Nikolaj on 20 July 2024, 11:29
To use auto-navigation (the `goposition` function), you need to create or obtain a ready-made terrain map. I create obstacle maps to the best of my abilities. The current archive of maps can be found in the bot's file exchange. My maps are created in the Chinese version, so you need to rename them and place them in the wall folder.
I'll explain how to use obstacle maps in your scripts. There are two ways to use them.
To have the bot automatically use the terrain map, you must name it exactly as it is in your game. For example, check the coordinates:
Rock Square;Giant Rock City;204;195;central plains
The name of this terrain map is: central plains
If there is a file named `central plains` in the wall folder, the bot will get the list of obstacle coordinates from it. If you have a different file name, you should connect it in the script using the command:
mapwall=YourFilename
If you don't do any of this, don't be surprised if your character runs into walls and gets stuck.
A few words about the cartographer (https://mwbot.kutsenko.cc/index.php/topic,49.0.html). Don't forget to check the list (https://mwbot.kutsenko.cc/index.php/topic,50.0.html) of commands for creating scripts.
Explanation from Dippydippy

First, let's talk without premium.

When there is no premium, the bot doesn't know where the walls are on its own.
So we used handmade maps.

It's like telling the bot:
"There is a wall around this city"
"There is a wall around this building."

Some maps are very well drawn and complete.
Others only have drawn the areas where people walk the most.

When premium is off, the bot only uses those map files that we made.

---

Now when premium is activated.

With premium, the bot uses premium maps automatically.
These maps are the same thing (walls), but they were not drawn by a person.

Some developers made tools that read game files directly.
From there they take all the real walls in the game and create a complete map.

That map includes:

 buildings
 cities
 map edges (the limits)

Exits are not on premium maps, because they do not exist within the game map files.

If we see it very slow, the game does this:

1. Load the map
2. Mark where the exits are
3. Charge the enemies
4. Load trees, sounds and other things

All of that happens in microseconds, but that's how it works.

---

When premium is activated, the bot:

 grab those premium maps
 and automatically loads them from the server

---

Now comes the important part.

If you delete all your local maps, but premium is still on, almost everything will work fine.
You won't hit walls, because the bot uses the server maps.

But...
If you still have files with the name of a city, something special happens.

The bot:

1. Load the premium map from the server
2. Then put the information you find in your local file on top

It's like putting one drawing on top of another.

Example:

 The premium map has a house to the north, south, east and west
 Your local file has houses in the same places

Everything matches → no problem.

But if your local file says:
"There is a building in the center"
then the bot thinks there is a building in the center, even though the premium map doesn't have it.

---

Now:
How do we delete all the walls from the premium map?

It is done by writing this line:

!1-600 1-600

The exclamation point doesn't create a wall, it creates air.
It is the opposite of a wall.

Since it covers the entire map (from 1 to 600 in X and in Y),
erase absolutely all the walls.

---

After that line, the map is empty.

So, everything you write below is new walls, from scratch.

Example:

 You put first: !1-600 1-600
 Then you write: 1-50 1

Now the map:

 Does not have premium walls
 It doesn't have old walls
 It only has a small wall at the top left, from 1 to 50

---

That's why that line is always put at the beginning of the file.

It's like this:

Imagine a table full of houses made of paper.
First you flatten them all and leave the table completely flat.
Then you build new houses on top, exactly where you want.

That's how that line works.