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

LUA Auto Border

G4BB3R

New Member
Joined
Jul 23, 2010
Messages
80
Reaction score
4
Recently to practise LUA scripting and logic, I was trying to make an action that I would use the pick in a earth cave border and then the square would be removed and the borders would be reajusted.
Remeres map editor has a similar algorithm to make the earth auto border (the same for water tiles and others)

6HSwL.jpg


Can someone give me some tips to make this algorithm ?


Thanks
 
Last edited:
The easiest way is to check if all borders are placed in an order so you can use a variable and add 1 or -1 to it, to get ther right border for all grounds. For example as the doors or levers.

^^^^
That is just a thought, but I think it's much harder than that.
 
First you should check RME files. There are:
C:\Program Files\Remere's Map Editor\data\960\borders.xml
C:\Program Files\Remere's Map Editor\data\960\grounds.xml

From grounds.xml you must take information what border-id you should use between elements X and Y [first you must find out their types based on their item id (mud and mud wall? :) )] - for all 8 tiles around tile that you change.
Then you must use your brain and calculate on which tiles you should add something. Then just check what is direction from tile you edit to tile on which you want add 'border'.
You can use function getDirectionTo(pos1, pos2) from data/lib/032-position.lua

Remember that RME borders are not perfect. Some types of ground/wall/sea looks ugly when more then 2 types of border are on neighbouring tiles.

Of course for your tests you don't need to parse these files. Just find cave border and earth ground IDs and borders:
Code:
    <brush name="cave" type="ground" lookid="351" z-order="2000">
        <item id="351" chance="6"/>
        <item id="352" chance="1"/>
        <item id="353" chance="1"/>
        <item id="354" chance="1"/>
        <item id="355" chance="1"/>
       
        <border align="outer" id="7"/>
    </brush>

    <brush name="earth" type="ground" lookid="101" z-order="10500">
        <item id="101" chance="150"/>
        <item id="5711" chance="1"/>
        <item id="5712" chance="1"/>
        <item id="5713" chance="1"/>
        <item id="5714" chance="1"/>
        <item id="5715" chance="1"/>
        <item id="5716" chance="1"/>
        <item id="5717" chance="1"/>
        <item id="5718" chance="1"/>
        <item id="5719" chance="1"/>
        <item id="5720" chance="1"/>
        <item id="5721" chance="1"/>
        <item id="5722" chance="1"/>
        <item id="5723" chance="1"/>
        <item id="5724" chance="1"/>
        <item id="5725" chance="1"/>
        <item id="5726" chance="1"/>
       
        <border align="outer" id="21"/>
        <border align="outer" to="none" id="21"/>
    </brush>

Code:
    <border id="7"> -- cave border --
        <borderitem edge="n"   item="4796"/>
        <borderitem edge="e"   item="4797"/>
        <borderitem edge="s"   item="4798"/>
        <borderitem edge="w"   item="4799"/>
        <borderitem edge="cnw" item="4800"/>
        <borderitem edge="cne" item="4801"/>
        <borderitem edge="csw" item="4802"/>
        <borderitem edge="cse" item="4803"/>
        <borderitem edge="dnw" item="4804"/>
        <borderitem edge="dne" item="4805"/>
        <borderitem edge="dsw" item="4806"/>
        <borderitem edge="dse" item="4807"/>
    </border>


    <border id="21"> -- cave wall border --
        <borderitem edge="n"   item="5632"/>
        <borderitem edge="e"   item="5637"/>
        <borderitem edge="s"   item="5638"/>
        <borderitem edge="w"   item="5631"/>
        <borderitem edge="cnw" item="5635"/>
        <borderitem edge="cne" item="5636"/>
        <borderitem edge="csw" item="5634"/>
        <borderitem edge="cse" item="5633"/>
        <borderitem edge="dnw" item="5647"/>
        <borderitem edge="dne" item="5651"/>
        <borderitem edge="dsw" item="5650"/>
        <borderitem edge="dse" item="5649"/>
    </border>
 
Back
Top