Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Minimap 1.3


iHero
 Share

Recommended Posts

  • Replies 79
  • Created
  • Last Reply

Top Posters In This Topic

chage sub
```
Sub BltMiniMap()
Dim i As Long
Dim X As Integer, Y As Integer
Dim Direction As Byte
Dim CameraX As Long, CameraY As Long
Dim BlockRect As RECT, WarpRect As RECT, ItemRect As RECT, ShopRect As RECT, NpcOtherRect As RECT, PlayerRect As RECT, PlayerPkRect As RECT, NpcAttackerRect As RECT, NpcShopRect As RECT, NadaRect As RECT
Dim MapX As Long, MapY As Long

' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

MapX = Map.MaxX
MapY = Map.MaxY

' ************
' *** Nada ***
' ************
With NadaRect
.top = 4
.Bottom = .top + 4
.Left = 0
.Right = .Left + 4
End With

' Defini-lo no minimap
For X = 0 To MapX
For Y = 0 To MapY
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, NadaRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
Next Y
Next X

' *****************
' *** Atributos ***
' *****************

' Bloqueio
With BlockRect
.top = 4
.Bottom = .top + 4
.Left = 4
.Right = .Left + 4
End With

' Warp
With WarpRect
.top = 4
.Bottom = .top + 4
.Left = 8
.Right = .Left + 4
End With

' Item
With ItemRect
.top = 4
.Bottom = .top + 4
.Left = 12
.Right = .Left + 4
End With

' Shop
With ShopRect
.top = 4
.Bottom = .top + 4
.Left = 16
.Right = .Left + 4
End With

' Defini-los no minimap
For X = 0 To MapX
For Y = 0 To MapY
Select Case Map.Tile(X, Y).Type
Case TILE_TYPE_BLOCKED
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, BlockRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
Case TILE_TYPE_WARP
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, WarpRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
Case TILE_TYPE_ITEM
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, ItemRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
Case TILE_TYPE_SHOP
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, ShopRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
End Select
Next Y
Next X

' **************
' *** Player ***
' **************

' Normal
With PlayerRect
.top = 0
.Bottom = .top + 4
.Left = 4
.Right = .Left + 4
End With

' Pk
With PlayerPkRect
.top = 0
.Bottom = .top + 4
.Left = 8
.Right = .Left + 4
End With

' Defini-los no minimap
For i = 1 To Player_HighIndex
If IsPlaying(i) Then
Select Case Player(i).PK
Case 0
X = Player(i).X
Y = Player(i).Y
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, PlayerRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Case 1
X = Player(i).X
Y = Player(i).Y
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, PlayerPkRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Select
End If
Next i

' ***********
' *** NPC ***
' ***********

' Atacar ao ser atacado e quando for atacado
With NpcAttackerRect
.top = 0
.Bottom = .top + 4
.Left = 12
.Right = .Left + 4
End With

' Vendendor
With NpcShopRect
.top = 0
.Bottom = .top + 4
.Left = 16
.Right = .Left + 4
End With

' Outros
With NpcOtherRect
.top = 0
.Bottom = .top + 4
.Left = 20
.Right = .Left + 4
End With

' Defini-lo no minimap
For i = 1 To Npc_HighIndex
If MapNpc(i).num > 0 Then
Select Case NPC(i).Behaviour
Case NPC_BEHAVIOUR_ATTACKONSIGHT Or NPC_BEHAVIOUR_ATTACKWHENATTACKED
X = MapNpc(i).X
Y = MapNpc(i).Y
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, NpcAttackerRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Case NPC_BEHAVIOUR_SHOPKEEPER
X = MapNpc(i).X
Y = MapNpc(i).Y
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, NpcShopRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Case Else
X = MapNpc(i).X
Y = MapNpc(i).Y
CameraX = Camera.Left + 650 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, NpcOtherRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Select
End If
Next i

' Error handler
Exit Sub
errorhandler:
HandleError "BltMiniMap", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
```
in this:

```
Sub BltMiniMap()
Dim i As Long
Dim X As Integer, Y As Integer
Dim Direction As Byte
Dim CameraX As Long, CameraY As Long
Dim BlockRect As RECT, WarpRect As RECT, ItemRect As RECT, ShopRect As RECT, NpcOtherRect As RECT, PlayerRect As RECT, PlayerPkRect As RECT, NpcAttackerRect As RECT, NpcShopRect As RECT, NadaRect As RECT
Dim MapX As Long, MapY As Long

' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

MapX = Map.MaxX
MapY = Map.MaxY

' ************
' *** Nada ***
' ************
With NadaRect
.top = 4
.Bottom = .top + 4
.Left = 0
.Right = .Left + 4
End With

' Defini-lo no minimap
For X = 0 To MapX
For Y = 0 To MapY
CameraX = Camera.Left + 25 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, NadaRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
Next Y
Next X

' *****************
' *** Atributos ***
' *****************

' Bloqueio
With BlockRect
.top = 4
.Bottom = .top + 4
.Left = 4
.Right = .Left + 4
End With

' Warp
With WarpRect
.top = 4
.Bottom = .top + 4
.Left = 8
.Right = .Left + 4
End With

' Item
With ItemRect
.top = 4
.Bottom = .top + 4
.Left = 12
.Right = .Left + 4
End With

' Shop
With ShopRect
.top = 4
.Bottom = .top + 4
.Left = 16
.Right = .Left + 4
End With

' Defini-los no minimap
For X = 0 To MapX
For Y = 0 To MapY
Select Case Map.Tile(X, Y).Type
Case TILE_TYPE_BLOCKED
CameraX = Camera.Left + 25 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, BlockRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
Case TILE_TYPE_WARP
CameraX = Camera.Left + 25 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, WarpRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
Case TILE_TYPE_ITEM
CameraX = Camera.Left + 25 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, ItemRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
Case TILE_TYPE_SHOP
CameraX = Camera.Left +25+ (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Engine_BltFast CameraX, CameraY, DDS_MiniMap, ShopRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
End Select
Next Y
Next X

' **************
' *** Player ***
' **************

' Normal
With PlayerRect
.top = 0
.Bottom = .top + 4
.Left = 4
.Right = .Left + 4
End With

' Pk
With PlayerPkRect
.top = 0
.Bottom = .top + 4
.Left = 8
.Right = .Left + 4
End With

' Defini-los no minimap
For i = 1 To Player_HighIndex
If IsPlaying(i) Then
Select Case Player(i).PK
Case 0
X = Player(i).X
Y = Player(i).Y
CameraX = Camera.Left + 25 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, PlayerRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Case 1
X = Player(i).X
Y = Player(i).Y
CameraX = Camera.Left + 25 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, PlayerPkRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Select
End If
Next i

' ***********
' *** NPC ***
' ***********

' Atacar ao ser atacado e quando for atacado
With NpcAttackerRect
.top = 0
.Bottom = .top + 4
.Left = 12
.Right = .Left + 4
End With

' Vendendor
With NpcShopRect
.top = 0
.Bottom = .top + 4
.Left = 16
.Right = .Left + 4
End With

' Outros
With NpcOtherRect
.top = 0
.Bottom = .top + 4
.Left = 20
.Right = .Left + 4
End With

' Defini-lo no minimap
For i = 1 To Npc_HighIndex
If MapNpc(i).num > 0 Then
Select Case NPC(i).Behaviour
Case NPC_BEHAVIOUR_ATTACKONSIGHT Or NPC_BEHAVIOUR_ATTACKWHENATTACKED
X = MapNpc(i).X
Y = MapNpc(i).Y
CameraX = Camera.Left + 25 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, NpcAttackerRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Case NPC_BEHAVIOUR_SHOPKEEPER
X = MapNpc(i).X
Y = MapNpc(i).Y
CameraX = Camera.Left + 25+ (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, NpcShopRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Case Else
X = MapNpc(i).X
Y = MapNpc(i).Y
CameraX = Camera.Left + 25 + (X * 4)
CameraY = Camera.top + 25 + (Y * 4)
Call DDS_BackBuffer.BltFast(CameraX, CameraY, DDS_MiniMap, NpcOtherRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Select
End If
Next i

' Error handler
Exit Sub
errorhandler:
HandleError "BltMiniMap", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
```
Link to comment
Share on other sites

why do i get this:
[![](http://www.freemmorpgmaker.com/files/imagehost/pics/9dd2ec461c07c20cb09eccd11479e658.bmp)](http://www.freemmorpgmaker.com/files/imagehost/#9dd2ec461c07c20cb09eccd11479e658.bmp)

Did I do something wrong, or is it just because my map is big. Is there a way to make it show a smaller area so this doesnt happen.
Link to comment
Share on other sites

I don't think u can zopto.. but I do atleast recommend using the blank tile attribute from the other mini map tutorial I think it makes the mini map look 20x better on larger maps so its not just a big ugly white square
Link to comment
Share on other sites

  • 4 weeks later...
First off this is a great tutorial and I love having it as an addition in my game, but I am having 1 small problem. As you can see from the attached picture not all 'enemy' npcs show up as the orange color that they should, there are 20 NPC's on this map and only 1 is showing as its correct color, I am not sure as to why it is like that, but how can I fix it?
Link to comment
Share on other sites

```
  CameraX = Camera.Left + 25 + (X * 4)
            CameraY = Camera.top + 25 + (Y * 4)
            Engine_BltFast CameraX, CameraY, DDS_MiniMap, NadaRect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
```Should be here.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...