canido Posted September 10, 2011 Author Share Posted September 10, 2011 Hello, today I come to explain how to install a layer "autotile"just above the "Ground" and below the "Mask 1"But it is difficult for me because English is not my usual language**Credits**: Robin for create of system**server side**Open **modEnumerations**And search **Public Enum MapLayer**And replaced by the following```Public Enum MapLayer Ground = 1 Autotile Mask Mask2 Fringe Fringe2 ' Make sure Layer_Count is below everything else Layer_CountEnd Enum```**Client side**Open **modGameLogic**And search **If tmr25 < Tick Then**And before of "If tmr25 < Tick Then" write…``` If tmr250 < Tick Then If autoAnim < 3 Then autoAnim = autoAnim + 1 Else autoAnim = 0 End If tmr250 = GetTickCount + 250 End If```Open **modGameEditors**And search **If EditorTileWidth = 1 And EditorTileHeight = 1 Then**And Remplace for```If (EditorTileWidth = 1 And EditorTileHeight = 1) Or CurLayer = MapLayer.Autotile Then 'single tile```And search **frmEditor_Map.shpSelected.height = PIC_Y**and below```If frmEditor_Map.optLayer(MapLayer.Autotile) Then EditorTileX = (X \ 32) EditorTileY = (Y \ 32) EditorTileWidth = 3 EditorTileHeight = 4 frmEditor_Map.shpSelected.top = EditorTileY * PIC_Y frmEditor_Map.shpSelected.Left = EditorTileX * PIC_X frmEditor_Map.shpSelected.width = 96 frmEditor_Map.shpSelected.height = 128 End If```Open **modDirectDraw7**And search **BltMapTile**and replace with the following```Public Sub BltMapTile(ByVal X As Long, ByVal Y As Long) Dim rec As DxVBLib.RECT Dim i As Long With Map.Tile(X, Y) For i = MapLayer.Ground To MapLayer.Mask2 ' skip tile if tileset isn't set If i = MapLayer.Autotile Then BltAutotile X, Y Else If .Layer(i).Tileset > 0 And .Layer(i).Tileset <= NumTileSets Then ' sort out rec rec.top = .Layer(i).Y * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = .Layer(i).X * PIC_X rec.Right = rec.Left + PIC_X ' render Call Engine_BltFast(ConvertMapX(X * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Tileset(.Layer(i).Tileset), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If Next End With ' Error handler Exit Suberrorhandler: HandleError "BltMapTile", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```Now go to the bottom of the mod(modDirectDraw7) and put the following code```Public Function isAutotileMatch(ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As Boolean isAutotileMatch = False ' end of the map, pretend there's a tile there :3 If x1 < 0 Or x1 > Map.MaxX Or x2 < 0 Or x2 > Map.MaxX Or y1 < 0 Or y1 > Map.MaxY Or y2 < 0 Or y2 > Map.MaxY Then isAutotileMatch = True Else If Map.Tile(x1, y1).Layer(MapLayer.Autotile).X = Map.Tile(x2, y2).Layer(MapLayer.Autotile).X Then If Map.Tile(x1, y1).Layer(MapLayer.Autotile).Y = Map.Tile(x2, y2).Layer(MapLayer.Autotile).Y Then If Map.Tile(x1, y1).Layer(MapLayer.Autotile).Tileset = Map.Tile(x2, y2).Layer(MapLayer.Autotile).Tileset Then isAutotileMatch = True End If End If End If End IfEnd FunctionPublic Sub BltAutotile(ByVal X As Long, ByVal Y As Long) Dim rec As DxVBLib.RECT Dim AutoSet As Long Dim bTop As Long Dim bLeft As Long AutoSet = Map.Tile(X, Y).Layer(MapLayer.Autotile).Tileset If AutoSet <= 0 Or AutoSet > NumTileSets Then Exit Sub bTop = Map.Tile(X, Y).Layer(MapLayer.Autotile).Y * 32 bLeft = Map.Tile(X, Y).Layer(MapLayer.Autotile).X * 32 ' animate If DDSD_Tileset(AutoSet).lWidth = 384 Then bLeft = autoAnim * 96 ' ######################## ' ######################## ' ### top left ### ' ######################## ' ######################## With rec .top = bTop + 32 .Bottom = .top + 16 .Left = bLeft + 0 .Right = .Left + 16 End With ' 1-dir horizontal join If isAutotileMatch(X, Y, X - 1, Y) Then With rec .top = bTop + 32 .Bottom = .top + 16 .Left = bLeft + 64 .Right = .Left + 16 End With ' 2-dir horizontal join If isAutotileMatch(X, Y, X + 1, Y) Then With rec .top = bTop + 32 .Bottom = .top + 16 .Left = bLeft + 32 .Right = .Left + 16 End With End If End If ' 1-dir vertical join If isAutotileMatch(X, Y, X, Y - 1) Then With rec .top = bTop + 96 .Bottom = .top + 16 .Left = bLeft + 0 .Right = .Left + 16 End With ' 2-dir vertical join If isAutotileMatch(X, Y, X, Y + 1) Then With rec .top = bTop + 64 .Bottom = .top + 16 .Left = bLeft + 0 .Right = .Left + 16 End With End If End If ' 1-dir corner join If isAutotileMatch(X, Y, X - 1, Y) And isAutotileMatch(X, Y, X, Y - 1) Then With rec .top = bTop + 0 .Bottom = .top + 16 .Left = bLeft + 64 .Right = .Left + 16 End With ' 2-dir corner join If isAutotileMatch(X, Y, X - 1, Y - 1) Then With rec .top = bTop + 96 .Bottom = .top + 16 .Left = bLeft + 64 .Right = .Left + 16 End With End If End If ' surrounded to the left or top If (isAutotileMatch(X, Y, X - 1, Y) And isAutotileMatch(X, Y, X, Y - 1) And _ isAutotileMatch(X, Y, X, Y + 1) And isAutotileMatch(X, Y, X - 1, Y - 1) And _ isAutotileMatch(X, Y, X - 1, Y + 1)) Or (isAutotileMatch(X, Y, X - 1, Y) And _ isAutotileMatch(X, Y, X + 1, Y) And isAutotileMatch(X, Y, X, Y - 1) And _ isAutotileMatch(X, Y, X + 1, Y - 1) And isAutotileMatch(X, Y, X - 1, Y - 1)) Then With rec .top = bTop + 64 .Bottom = .top + 16 .Left = bLeft + 32 .Right = .Left + 16 End With End If Call Engine_BltFast(ConvertMapX((X * PIC_X)), ConvertMapY((Y * PIC_Y)), DDS_Tileset(AutoSet), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) ' ######################## ' ######################## ' ### top right ### ' ######################## ' ######################## With rec .top = bTop + 32 .Bottom = .top + 16 .Left = bLeft + 80 .Right = .Left + 16 End With ' 1-dir horizontal join If isAutotileMatch(X, Y, X + 1, Y) Then With rec .top = bTop + 32 .Bottom = .top + 16 .Left = bLeft + 16 .Right = .Left + 16 End With ' 2-dir horizontal join If isAutotileMatch(X, Y, X - 1, Y) Then With rec .top = bTop + 32 .Bottom = .top + 16 .Left = bLeft + 48 .Right = .Left + 16 End With End If End If ' 1-dir vertical join If isAutotileMatch(X, Y, X, Y - 1) Then With rec .top = bTop + 96 .Bottom = .top + 16 .Left = bLeft + 80 .Right = .Left + 16 End With ' 2-dir vertical join If isAutotileMatch(X, Y, X, Y + 1) Then With rec .top = bTop + 64 .Bottom = .top + 16 .Left = bLeft + 80 .Right = .Left + 16 End With End If End If ' 1-dir corner join If isAutotileMatch(X, Y, X + 1, Y) And isAutotileMatch(X, Y, X, Y - 1) Then With rec .top = bTop + 0 .Bottom = .top + 16 .Left = bLeft + 80 .Right = .Left + 16 End With ' 2-dir corner join If isAutotileMatch(X, Y, X + 1, Y - 1) Then With rec .top = bTop + 96 .Bottom = .top + 16 .Left = bLeft + 16 .Right = .Left + 16 End With End If End If ' surrounded to the right or top If (isAutotileMatch(X, Y, X + 1, Y) And isAutotileMatch(X, Y, X, Y - 1) And _ isAutotileMatch(X, Y, X, Y + 1) And isAutotileMatch(X, Y, X + 1, Y - 1) And _ isAutotileMatch(X, Y, X + 1, Y + 1)) Or (isAutotileMatch(X, Y, X - 1, Y) And _ isAutotileMatch(X, Y, X + 1, Y) And isAutotileMatch(X, Y, X, Y - 1) And _ isAutotileMatch(X, Y, X + 1, Y - 1) And isAutotileMatch(X, Y, X - 1, Y - 1)) Then With rec .top = bTop + 64 .Bottom = .top + 16 .Left = bLeft + 48 .Right = .Left + 16 End With End If Call Engine_BltFast(ConvertMapX((X * PIC_X) + 16), ConvertMapY((Y * PIC_Y)), DDS_Tileset(AutoSet), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) ' ######################## ' ######################## ' ### bottom left ### ' ######################## ' ######################## With rec .top = bTop + 112 .Bottom = .top + 16 .Left = bLeft + 0 .Right = .Left + 16 End With ' 1-dir horizontal join If isAutotileMatch(X, Y, X - 1, Y) Then With rec .top = bTop + 112 .Bottom = .top + 16 .Left = bLeft + 64 .Right = .Left + 16 End With ' 2-dir horizontal join If isAutotileMatch(X, Y, X + 1, Y) Then With rec .top = bTop + 112 .Bottom = .top + 16 .Left = bLeft + 32 .Right = .Left + 16 End With End If End If ' 1-dir vertical join If isAutotileMatch(X, Y, X, Y + 1) Then With rec .top = bTop + 48 .Bottom = .top + 16 .Left = bLeft + 0 .Right = .Left + 16 End With ' 2-dir vertical join If isAutotileMatch(X, Y, X, Y - 1) Then With rec .top = bTop + 80 .Bottom = .top + 16 .Left = bLeft + 0 .Right = .Left + 16 End With End If End If ' 1-dir corner join If isAutotileMatch(X, Y, X - 1, Y) And isAutotileMatch(X, Y, X, Y + 1) Then With rec .top = bTop + 16 .Bottom = .top + 16 .Left = bLeft + 64 .Right = .Left + 16 End With ' 2-dir corner join If isAutotileMatch(X, Y, X - 1, Y + 1) Then With rec .top = bTop + 48 .Bottom = .top + 16 .Left = bLeft + 64 .Right = .Left + 16 End With End If End If ' surrounded to the left or top If (isAutotileMatch(X, Y, X - 1, Y) And isAutotileMatch(X, Y, X, Y - 1) And _ isAutotileMatch(X, Y, X, Y + 1) And isAutotileMatch(X, Y, X - 1, Y - 1) And _ isAutotileMatch(X, Y, X - 1, Y + 1)) Or (isAutotileMatch(X, Y, X - 1, Y) And _ isAutotileMatch(X, Y, X + 1, Y) And isAutotileMatch(X, Y, X, Y + 1) And _ isAutotileMatch(X, Y, X + 1, Y + 1) And isAutotileMatch(X, Y, X - 1, Y + 1)) Then With rec .top = bTop + 80 .Bottom = .top + 16 .Left = bLeft + 64 .Right = .Left + 16 End With End If Call Engine_BltFast(ConvertMapX((X * PIC_X)), ConvertMapY((Y * PIC_Y) + 16), DDS_Tileset(AutoSet), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) ' ######################## ' ######################## ' ### bottom right ### ' ######################## ' ######################## With rec .top = bTop + 112 .Bottom = .top + 16 .Left = bLeft + 80 .Right = .Left + 16 End With ' 1-dir horizontal join If isAutotileMatch(X, Y, X + 1, Y) Then With rec .top = bTop + 112 .Bottom = .top + 16 .Left = bLeft + 16 .Right = .Left + 16 End With ' 2-dir horizontal join If isAutotileMatch(X, Y, X - 1, Y) Then With rec .top = bTop + 112 .Bottom = .top + 16 .Left = bLeft + 48 .Right = .Left + 16 End With End If End If ' 1-dir vertical join If isAutotileMatch(X, Y, X, Y + 1) Then With rec .top = bTop + 48 .Bottom = .top + 16 .Left = bLeft + 80 .Right = .Left + 16 End With ' 2-dir vertical join If isAutotileMatch(X, Y, X, Y - 1) Then With rec .top = bTop + 80 .Bottom = .top + 16 .Left = bLeft + 80 .Right = .Left + 16 End With End If End If ' 1-dir corner join If isAutotileMatch(X, Y, X + 1, Y) And isAutotileMatch(X, Y, X, Y + 1) Then With rec .top = bTop + 16 .Bottom = .top + 16 .Left = bLeft + 80 .Right = .Left + 16 End With ' 2-dir corner join If isAutotileMatch(X, Y, X + 1, Y + 1) Then With rec .top = bTop + 48 .Bottom = .top + 16 .Left = bLeft + 16 .Right = .Left + 16 End With End If End If ' surrounded to the left or top If (isAutotileMatch(X, Y, X + 1, Y) And isAutotileMatch(X, Y, X, Y - 1) And _ isAutotileMatch(X, Y, X, Y + 1) And isAutotileMatch(X, Y, X + 1, Y - 1) And _ isAutotileMatch(X, Y, X + 1, Y + 1)) Or (isAutotileMatch(X, Y, X - 1, Y) And _ isAutotileMatch(X, Y, X + 1, Y) And isAutotileMatch(X, Y, X, Y + 1) And _ isAutotileMatch(X, Y, X + 1, Y + 1) And isAutotileMatch(X, Y, X - 1, Y + 1)) Then With rec .top = bTop + 80 .Bottom = .top + 16 .Left = bLeft + 48 .Right = .Left + 16 End With End If Call Engine_BltFast(ConvertMapX((X * PIC_X) + 16), ConvertMapY((Y * PIC_Y) + 16), DDS_Tileset(AutoSet), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)End Sub```Open **modEnumerations**And search **Public Enum MapLayer**And replaced by the following```Public Enum MapLayer Ground = 1 Autotile Mask Mask2 Fringe Fringe2 ' Make sure Layer_Count is below everything else Layer_CountEnd Enum```Open **modDatabase**And search **Put #f, , Map.Tile(x, y).DirBlock**put the following code After Put #f, , Map.Tile(x, y).Animation.Animation```Put #f, , Map.Tile(x, y).Animation.Animation```**Notes:**To play animations "Water" the tile should measure the "384" wide Here are some picture along with the frmEditor_MapChange frmEditor_Map by my you to download below Link to comment Share on other sites More sharing options...
Prince Posted September 10, 2011 Share Posted September 10, 2011 Gonne test it now Link to comment Share on other sites More sharing options...
Dzastin Posted September 10, 2011 Share Posted September 10, 2011 If i add this, i must delete my maps?… Link to comment Share on other sites More sharing options...
canido Posted September 10, 2011 Author Share Posted September 10, 2011 yes, you delete maps! Link to comment Share on other sites More sharing options...
Dzastin Posted September 10, 2011 Share Posted September 10, 2011 You could write a tutorial so that when you hit the ground layer, then the box appears asking if you want autotile, then there was it would be necessary to remove maps Link to comment Share on other sites More sharing options...
canido Posted September 10, 2011 Author Share Posted September 10, 2011 in this tutorial we add a new layer, do not edit, but change the funtion"Save maps" should do all the maps again Link to comment Share on other sites More sharing options...
Domino_ Posted September 10, 2011 Share Posted September 10, 2011 This is RPGMXP Autotile system not RPGMVX, yes? Link to comment Share on other sites More sharing options...
reven Posted September 10, 2011 Share Posted September 10, 2011 This'll kill your FPS, you shouldn't really use it. Link to comment Share on other sites More sharing options...
canido Posted September 10, 2011 Author Share Posted September 10, 2011 @Domino_:> This is RPGMXP Autotile system not RPGMVX, yes?not could tell that kind of autotile is .. but they are different from CS! Link to comment Share on other sites More sharing options...
MeteorRain Posted September 10, 2011 Share Posted September 10, 2011 This doesnt work at all. Link to comment Share on other sites More sharing options...
canido Posted September 10, 2011 Author Share Posted September 10, 2011 yes work! Link to comment Share on other sites More sharing options...
Medleyy Posted September 12, 2011 Share Posted September 12, 2011 Does this have an animating layer? Link to comment Share on other sites More sharing options...
MeteorRain Posted September 12, 2011 Share Posted September 12, 2011 There's no Put #f, , Map.Tile(x, y).DirBlock Link to comment Share on other sites More sharing options...
Murdoc Posted September 29, 2011 Share Posted September 29, 2011 @Meteor:> This doesnt work at all.Please be more specific when saying something doesnt work. Like, for example, saying what kind of errors youre getting etc. Are you sure YOU just dont know how to add it properly? Its an insult to canido who gracefully posted this tutorial to be so ignorant. Link to comment Share on other sites More sharing options...
Guest Posted October 6, 2011 Share Posted October 6, 2011 so i didnt follow this tut, but i did rip robins autotile feature, and i havnt noticed any fps drop even on my old 2ghz laptop. it may still have a fps leak, but i cant see one after 2 hours of playtesting. Link to comment Share on other sites More sharing options...
Thunderbird Posted October 7, 2011 Share Posted October 7, 2011 Canido, for the people like Meteor Rain and I, wouldn't it be nice to post a compiled client/server including this code? It's like what Alatar did with his quest system, it'd surely shake off doubts. So far I'm too have some doubts if it really works nicely enough. Link to comment Share on other sites More sharing options...
Draken Posted October 10, 2011 Share Posted October 10, 2011 This tutorial is not complete.You say Quote"Open modDatabaseAnd search Put #f, , Map.Tile(x, y).DirBlockput the following code After Put #f, , Map.Tile(x, y).Animation.Animation"Um if you use default EO 2.0 there is no line of code that says:Put #f, , Map.Tile(x, y).DirBlockOr one that says#f, , Map.Tile(x, y).Animation.AnimationI ran a search on the whole project and still not there, so you must have added something else to the system and not telling everyone.Please finish or Fix the tutorial. Link to comment Share on other sites More sharing options...
Robin Posted October 10, 2011 Share Posted October 10, 2011 If you're going to rip my systems at least do it properly. This is a bloody awful system. You've taken all the shit which was done in the caching and put it in the damn renderer! That shit should be done once on map change and cached for use, not re-calculated every loop.This is basic programming logic. Unless you have constantly changing data then you should have all your calculations done once and the results cached.How you managed to screw up ripping a fully working system I'll never know. Link to comment Share on other sites More sharing options...
Riiicardoo Posted October 13, 2011 Share Posted October 13, 2011 I looked in the tutorial and the time to take picture of the map will not get the autotile, faciu is correct, you just go in Sub Screnshotmap (I guess that's it) and a choice of more adiconar Screnshot Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now