Isto é uma pré-visualização de um tema em Hitskin.com
Instalar o tema • Voltar para a ficha do tema
[EO 2.3] 8 Direções
2 participantes
Página 1 de 1
[EO 2.3] 8 Direções
Oi, esse tutorial não é meu. Todos os créditos há seus devidos autores
Esse tutorial foi testado na EO 2.3, talvez funcione em outras versões
Client-Side
Primeiro vá para modGlobals e encontre
Adicione abaixo dele
Em modInput no sub sub CheckKeys
E adicione acima disso
No mesmo módulo, substitua o CheckInputKeys sub por este
Agora em modConstants encontrar
E adicione diretamente abaixo dele
Em modGameLogic no sub CanMove encontrar
E adicione abaixo dele
No mesmo módulo, mas na função CheckDirection procure
Adicione dois novos casos abaixo dele
no sub CheckMovement encontrar
Adicione abaixo dele
Agora em modHandleData no sub HandlePlayerMove encontrar
Adicione diretamente abaixo dele
Em modGameLogic no sub ProcessMovement procure
E adicione abaixo dele
no mesmo sub encontrar
E substitua-o por este
Exatamente abaixo deste sub no sub ProcessNpcMovement procure
Adicione abaixo dele
E adicione abaixo dele
no mesmo sub encontrar
E adicione abaixo dele
Em sub BltNpc encontrar
Adicione abaixo dele
no mesmo mod encontrar
Adicione abaixo dele
Em modGameLogic na função IsTryingToMove encontrar
E substitua-o por
Em modHandleData no sub HandlePlayerData encontrar
Adicione abaixo dele
Client-Side terminado
--Server-Side--
Em modConstants encontrar
Adicione abaixo dele
em modGameLogic em sub CanNpcMove procure
Substitua-o por
no mesmo sub encontrar
e adicione abaixo dele
no mesmo módulo em sub NpcMove procure
e substitua-o por
No mesmo sub encontrar
adicione abaixo dele
em modHandleData no sub HandlePlayerMove procure
e substitua-o por
no mesmo módulo no sub HandlePlayerDir encontrar
e substitua-o por
no sub HandleRequestNewMap encontrar
e substitua-o por
em modServerLoop no sub UpdateMapLogic procure
e substituí-lo com este
no modPlayer no sub PlayerMove procure
substitua-o por
no mesmo sub encontrar
abaixo adicionar
no sub ForcePlayerMove substitua todo o sub com este
no sub UseItem ache
adicione abaixo dele
em modCombat no sub CanPlayerAttackNpc procure
e substitua-o por
no sub CanPlayerAttackPlayer encontrar
e substitua-o por
É isso aí! Eu pensei que nunca ia acaba
Creditos: Criar e Disponibilizar o tutorial blwcrow
Esse tutorial foi testado na EO 2.3, talvez funcione em outras versões
Client-Side
Primeiro vá para modGlobals e encontre
- Código:
Public DirRight as boolean
Adicione abaixo dele
- Código:
Public DirUpLeft As Boolean
Public DirUpRight As Boolean
Public DirDownLeft As Boolean
Public DirDownRight As Boolean
Em modInput no sub sub CheckKeys
- Código:
If GetAsyncKeyState(VK_UP) >= 0 Then DirUp = False
E adicione acima disso
- Código:
If GetAsyncKeyState(VK_UP) >= 0 And GetAsyncKeyState(VK_LEFT) >= 0 Then DirUpLeft = False
If GetAsyncKeyState(VK_UP) >= 0 And GetAsyncKeyState(VK_RIGHT) >= 0 Then DirUpRight = False
If GetAsyncKeyState(VK_DOWN) >= 0 And GetAsyncKeyState(VK_LEFT) >= 0 Then DirDownLeft = False
If GetAsyncKeyState(VK_DOWN) >= 0 And GetAsyncKeyState(VK_RIGHT) >= 0 Then DirDownRight = False
No mesmo módulo, substitua o CheckInputKeys sub por este
- Código:
Public Sub CheckInputKeys()
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
If GetKeyState(vbKeyShift) < 0 Then
ShiftDown = True
Else
ShiftDown = False
End If
If GetKeyState(vbKeyReturn) < 0 Then
CheckMapGetItem
End If
If GetKeyState(vbKeyControl) < 0 Then
ControlDown = True
Else
ControlDown = False
End If
'Move Up Left
If GetAsyncKeyState(VK_UP) < 0 And GetAsyncKeyState(VK_LEFT) < 0 Then
DirUp = False
DirDown = False
DirLeft = False
DirRight = False
DirUpLeft = True
DirUpRight = False
DirDownLeft = False
DirDownRight = False
Exit Sub
Else
DirUpLeft = False
End If
'Move Up Right
If GetAsyncKeyState(VK_UP) < 0 And GetAsyncKeyState(VK_RIGHT) < 0 Then
DirUp = False
DirDown = False
DirLeft = False
DirRight = False
DirUpLeft = False
DirUpRight = True
DirDownLeft = False
DirDownRight = False
Exit Sub
Else
DirUpRight = False
End If
'Move Down Left
If GetAsyncKeyState(VK_DOWN) < 0 And GetAsyncKeyState(VK_LEFT) < 0 Then
DirUp = False
DirDown = False
DirLeft = False
DirRight = False
DirUpLeft = False
DirUpRight = False
DirDownLeft = True
DirDownRight = False
Exit Sub
Else
DirDownLeft = False
End If
'Move Down Right
If GetAsyncKeyState(VK_DOWN) < 0 And GetAsyncKeyState(VK_RIGHT) < 0 Then
DirUp = False
DirDown = False
DirLeft = False
DirRight = False
DirUpLeft = False
DirUpRight = False
DirDownLeft = False
DirDownRight = True
Exit Sub
Else
DirDownRight = False
End If
'Move Up
If GetAsyncKeyState(VK_UP) < 0 Then
DirUp = True
DirDown = False
DirLeft = False
DirRight = False
DirUpLeft = False
DirUpRight = False
DirDownLeft = False
DirDownRight = False
Exit Sub
Else
DirUp = False
End If
'Move Right
If GetAsyncKeyState(VK_RIGHT) < 0 Then
DirUp = False
DirDown = False
DirLeft = False
DirRight = True
DirUpLeft = False
DirUpRight = False
DirDownLeft = False
DirDownRight = False
Exit Sub
Else
DirRight = False
End If
'Move down
If GetAsyncKeyState(VK_DOWN) < 0 Then
DirUp = False
DirDown = True
DirLeft = False
DirRight = False
DirUpLeft = False
DirUpRight = False
DirDownLeft = False
DirDownRight = False
Exit Sub
Else
DirDown = False
End If
'Move left
If GetAsyncKeyState(VK_LEFT) < 0 Then
DirUp = False
DirDown = False
DirLeft = True
DirRight = False
DirUpLeft = False
DirUpRight = False
DirDownLeft = False
DirDownRight = False
Exit Sub
Else
DirLeft = False
End If
' Error handler
Exit Sub
errorhandler:
HandleError "CheckInputKeys", "modInput", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
Agora em modConstants encontrar
- Código:
Public Const DIR_RIGHT As Byte = 3
E adicione diretamente abaixo dele
- Código:
Public Const DIR_UP_LEFT As Byte = 4
Public Const DIR_UP_RIGHT As Byte = 5
Public Const DIR_DOWN_LEFT As Byte = 6
Public Const DIR_DOWN_RIGHT As Byte = 7
Em modGameLogic no sub CanMove encontrar
- Código:
d = GetPlayerDir(MyIndex)
E adicione abaixo dele
- Código:
If DirUpLeft Then
Call SetPlayerDir(MyIndex, DIR_UP_LEFT)
' Check to see if they are trying to go out of bounds
If GetPlayerY(MyIndex) > 0 And GetPlayerX(MyIndex) > 0 Then
If CheckDirection(DIR_UP) Then
CanMove = False
' Set the new direction if they weren't facing that direction
If d <> DIR_UP_LEFT Then
Call SendPlayerDir
End If
Exit Function
End If
Else
' Check if they can warp to a new map
If Map.Up > 0 And Map.Left > 0 Then
Call MapEditorLeaveMap
Call SendPlayerRequestNewMap
GettingMap = True
CanMoveNow = False
End If
CanMove = False
Exit Function
End If
End If
If DirUpRight Then
Call SetPlayerDir(MyIndex, DIR_UP_RIGHT)
' Check to see if they are trying to go out of bounds
If GetPlayerY(MyIndex) > 0 And GetPlayerX(MyIndex) < Map.MaxX Then
If CheckDirection(DIR_UP) Then
CanMove = False
' Set the new direction if they weren't facing that direction
If d <> DIR_UP_RIGHT Then
Call SendPlayerDir
End If
Exit Function
End If
Else
' Check if they can warp to a new map
If Map.Up > 0 And Map.Right > 0 Then
Call MapEditorLeaveMap
Call SendPlayerRequestNewMap
GettingMap = True
CanMoveNow = False
End If
CanMove = False
Exit Function
End If
End If
If DirDownLeft Then
Call SetPlayerDir(MyIndex, DIR_DOWN_LEFT)
' Check to see if they are trying to go out of bounds
If GetPlayerY(MyIndex) < Map.MaxY And GetPlayerX(MyIndex) > 0 Then
If CheckDirection(DIR_DOWN) Then
CanMove = False
' Set the new direction if they weren't facing that direction
If d <> DIR_DOWN_LEFT Then
Call SendPlayerDir
End If
Exit Function
End If
Else
' Check if they can warp to a new map
If Map.Down > 0 And Map.Left > 0 Then
Call MapEditorLeaveMap
Call SendPlayerRequestNewMap
GettingMap = True
CanMoveNow = False
End If
CanMove = False
Exit Function
End If
End If
If DirDownRight Then
Call SetPlayerDir(MyIndex, DIR_DOWN_RIGHT)
' Check to see if they are trying to go out of bounds
If GetPlayerY(MyIndex) < Map.MaxY And GetPlayerX(MyIndex) < Map.MaxX Then
If CheckDirection(DIR_DOWN) Then
CanMove = False
' Set the new direction if they weren't facing that direction
If d <> DIR_DOWN_RIGHT Then
Call SendPlayerDir
End If
Exit Function
End If
Else
' Check if they can warp to a new map
If Map.Down > 0 And Map.Right > 0 Then
Call MapEditorLeaveMap
Call SendPlayerRequestNewMap
GettingMap = True
CanMoveNow = False
End If
CanMove = False
Exit Function
End If
End If
No mesmo módulo, mas na função CheckDirection procure
- Código:
Case DIR_RIGHT
x = GetPlayerX(MyIndex) + 1
y = GetPlayerY(MyIndex)
Adicione dois novos casos abaixo dele
- Código:
Case DIR_UP_LEFT
x = GetPlayerX(MyIndex) - 1
y = GetPlayerY(MyIndex) - 1
Case DIR_UP_RIGHT
x = GetPlayerX(MyIndex) + 1
y = GetPlayerY(MyIndex) - 1
Case DIR_DOWN_LEFT
x = GetPlayerX(MyIndex) - 1
y = GetPlayerY(MyIndex) + 1
Case DIR_DOWN_RIGHT
x = GetPlayerX(MyIndex) + 1
y = GetPlayerY(MyIndex) + 1
no sub CheckMovement encontrar
- Código:
Case DIR_RIGHT
Call SendPlayerMove
Player(MyIndex).XOffset = PIC_X * -1
Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) + 1)
Adicione abaixo dele
- Código:
Case DIR_UP_LEFT
Call SendPlayerMove
Player(MyIndex).YOffset = PIC_Y
Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) - 1)
Player(MyIndex).XOffset = PIC_X
Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) - 1)
Case DIR_UP_RIGHT
Call SendPlayerMove
Player(MyIndex).YOffset = PIC_Y
Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) - 1)
Player(MyIndex).XOffset = PIC_X * -1
Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) + 1)
Case DIR_DOWN_LEFT
Call SendPlayerMove
Player(MyIndex).YOffset = PIC_Y * -1
Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) + 1)
Player(MyIndex).XOffset = PIC_X
Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) - 1)
Case DIR_DOWN_RIGHT
Call SendPlayerMove
Player(MyIndex).YOffset = PIC_Y * -1
Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) + 1)
Player(MyIndex).XOffset = PIC_X * -1
Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) + 1)
Agora em modHandleData no sub HandlePlayerMove encontrar
- Código:
Case DIR_RIGHT
Player(i).XOffset = PIC_X * -1
Adicione diretamente abaixo dele
- Código:
Case DIR_UP_LEFT
Player(i).YOffset = PIC_Y
Player(i).XOffset = PIC_X
Case DIR_UP_RIGHT
Player(i).YOffset = PIC_Y
Player(i).XOffset = PIC_X * -1
Case DIR_DOWN_LEFT
Player(i).YOffset = PIC_Y * -1
Player(i).XOffset = PIC_X
Case DIR_DOWN_RIGHT
Player(i).YOffset = PIC_Y * -1
Player(i).XOffset = PIC_X * -1
Em modGameLogic no sub ProcessMovement procure
- Código:
Case DIR_RIGHT
Player(Index).XOffset = Player(Index).XOffset + MovementSpeed
If Player(Index).XOffset > 0 Then Player(Index).XOffset = 0
E adicione abaixo dele
- Código:
Case DIR_UP_LEFT
Player(Index).YOffset = Player(Index).YOffset - MovementSpeed
If Player(Index).YOffset < 0 Then Player(Index).YOffset = 0
Player(Index).XOffset = Player(Index).XOffset - MovementSpeed
If Player(Index).XOffset < 0 Then Player(Index).XOffset = 0
Case DIR_UP_RIGHT
Player(Index).YOffset = Player(Index).YOffset - MovementSpeed
If Player(Index).YOffset < 0 Then Player(Index).YOffset = 0
Player(Index).XOffset = Player(Index).XOffset + MovementSpeed
If Player(Index).XOffset > 0 Then Player(Index).XOffset = 0
Case DIR_DOWN_LEFT
Player(Index).YOffset = Player(Index).YOffset + MovementSpeed
If Player(Index).YOffset > 0 Then Player(Index).YOffset = 0
Player(Index).XOffset = Player(Index).XOffset - MovementSpeed
If Player(Index).XOffset < 0 Then Player(Index).XOffset = 0
Case DIR_DOWN_RIGHT
Player(Index).YOffset = Player(Index).YOffset + MovementSpeed
If Player(Index).YOffset > 0 Then Player(Index).YOffset = 0
Player(Index).XOffset = Player(Index).XOffset + MovementSpeed
If Player(Index).XOffset > 0 Then Player(Index).XOffset = 0
no mesmo sub encontrar
- Código:
If GetPlayerDir(Index) = DIR_RIGHT Or GetPlayerDir(Index) = DIR_DOWN Then
E substitua-o por este
- Código:
If GetPlayerDir(Index) = DIR_RIGHT Or GetPlayerDir(Index) = DIR_DOWN Or GetPlayerDir(Index) = DIR_DOWN_LEFT Or GetPlayerDir(Index) = DIR_DOWN_RIGHT Then
Exatamente abaixo deste sub no sub ProcessNpcMovement procure
- Código:
Case DIR_RIGHT
MapNpc(MapNpcNum).XOffset = MapNpc(MapNpcNum).XOffset + ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
If MapNpc(MapNpcNum).XOffset > 0 Then MapNpc(MapNpcNum).XOffset = 0
Adicione abaixo dele
- Código:
Case DIR_UP_LEFT
MapNpc(MapNpcNum).YOffset = MapNpc(MapNpcNum).YOffset - ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
If MapNpc(MapNpcNum).YOffset < 0 Then MapNpc(MapNpcNum).YOffset = 0
MapNpc(MapNpcNum).XOffset = MapNpc(MapNpcNum).XOffset - ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
If MapNpc(MapNpcNum).XOffset < 0 Then MapNpc(MapNpcNum).XOffset = 0
Case DIR_UP_RIGHT
MapNpc(MapNpcNum).YOffset = MapNpc(MapNpcNum).YOffset - ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
If MapNpc(MapNpcNum).YOffset < 0 Then MapNpc(MapNpcNum).YOffset = 0
MapNpc(MapNpcNum).XOffset = MapNpc(MapNpcNum).XOffset + ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
If MapNpc(MapNpcNum).XOffset > 0 Then MapNpc(MapNpcNum).XOffset = 0
Case DIR_DOWN_LEFT
MapNpc(MapNpcNum).YOffset = MapNpc(MapNpcNum).YOffset + ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
If MapNpc(MapNpcNum).YOffset > 0 Then MapNpc(MapNpcNum).YOffset = 0
MapNpc(MapNpcNum).XOffset = MapNpc(MapNpcNum).XOffset - ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
If MapNpc(MapNpcNum).XOffset < 0 Then MapNpc(MapNpcNum).XOffset = 0
Case DIR_DOWN_RIGHT
MapNpc(MapNpcNum).YOffset = MapNpc(MapNpcNum).YOffset + ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
If MapNpc(MapNpcNum).YOffset > 0 Then MapNpc(MapNpcNum).YOffset = 0
MapNpc(MapNpcNum).XOffset = MapNpc(MapNpcNum).XOffset + ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
If MapNpc(MapNpcNum).XOffset > 0 Then MapNpc(MapNpcNum).XOffset = 0
Em modDirectDraw7 sob o sub-BltPlayer encontrar
Case DIR_LEFT
spritetop = 1
E adicione abaixo dele
- Código:
Case DIR_UP_LEFT
spritetop = 3
Case DIR_UP_RIGHT
spritetop = 3
Case DIR_DOWN_LEFT
spritetop = 0
Case DIR_DOWN_RIGHT
spritetop = 0
no mesmo sub encontrar
- Código:
Case DIR_RIGHT
If (Player(Index).XOffset < -8) Then anim = Player(Index).Step
E adicione abaixo dele
- Código:
Case DIR_UP_LEFT
If (Player(Index).YOffset > 8) And (Player(Index).XOffset > 8) Then anim = Player(Index).Step
Case DIR_UP_RIGHT
If (Player(Index).YOffset > 8) And (Player(Index).XOffset < -8) Then anim = Player(Index).Step
Case DIR_DOWN_LEFT
If (Player(Index).YOffset < -8) And (Player(Index).XOffset > 8) Then anim = Player(Index).Step
Case DIR_DOWN_RIGHT
If (Player(Index).YOffset < -8) And (Player(Index).XOffset < -8) Then anim = Player(Index).Step
Em sub BltNpc encontrar
- Código:
Case DIR_RIGHT
If (MapNpc(MapNpcNum).XOffset < -8) Then anim = MapNpc(MapNpcNum).Step
Adicione abaixo dele
- Código:
Case DIR_UP_LEFT
If (MapNpc(MapNpcNum).YOffset > 8) And (MapNpc(MapNpcNum).XOffset > 8) Then anim = MapNpc(MapNpcNum).Step
Case DIR_UP_RIGHT
If (MapNpc(MapNpcNum).YOffset > 8) And (MapNpc(MapNpcNum).XOffset < -8) Then anim = MapNpc(MapNpcNum).Step
Case DIR_DOWN_LEFT
If (MapNpc(MapNpcNum).YOffset < -8) And (MapNpc(MapNpcNum).XOffset > 8) Then anim = MapNpc(MapNpcNum).Step
Case DIR_DOWN_RIGHT
If (MapNpc(MapNpcNum).YOffset < -8) And (MapNpc(MapNpcNum).XOffset < -8) Then anim = MapNpc(MapNpcNum).Step
no mesmo mod encontrar
Adicione abaixo dele
- Código:
Case DIR_UP_LEFT
spritetop = 3
Case DIR_UP_RIGHT
spritetop = 3
Case DIR_DOWN_LEFT
spritetop = 0
Case DIR_DOWN_RIGHT
spritetop = 0
Em modGameLogic na função IsTryingToMove encontrar
- Código:
If DirUp Or DirDown Or DirLeft Or DirRight Then
E substitua-o por
- Código:
If DirUp Or DirDown Or DirLeft Or DirRight Or DirUpLeft Or DirUpRight Or DirDownLeft Or DirDownRight Then
Em modHandleData no sub HandlePlayerData encontrar
- Código:
DirRight = False
Adicione abaixo dele
- Código:
DirUpLeft = False
DirUpRight = False
DirDownLeft = False
DirDownRight = False
Client-Side terminado
--Server-Side--
Em modConstants encontrar
- Código:
Public Const DIR_RIGHT As Byte = 3
Adicione abaixo dele
- Código:
Public Const DIR_UP_LEFT As Byte = 4
Public Const DIR_UP_RIGHT As Byte = 5
Public Const DIR_DOWN_LEFT As Byte = 6
Public Const DIR_DOWN_RIGHT As Byte = 7
em modGameLogic em sub CanNpcMove procure
- Código:
If mapnum <= 0 Or mapnum > MAX_MAPS Or mapNpcNum <= 0 Or mapNpcNum > MAX_MAP_NPCS Or Dir < DIR_UP Or Dir > DIR_RIGHT Then
Substitua-o por
- Código:
If mapnum <= 0 Or mapnum > MAX_MAPS Or mapNpcNum <= 0 Or mapNpcNum > MAX_MAP_NPCS Or Dir < DIR_UP Or Dir > DIR_DOWN_RIGHT Then
no mesmo sub encontrar
- Código:
Select Case Dir
e adicione abaixo dele
- Código:
Case DIR_UP_LEFT
' Check to make sure not outside of boundries
If y > 0 And x > 0 Then
n = Map(mapnum).Tile(x - 1, y - 1).Type
' Check to make sure that the tile is walkable
If n <> TILE_TYPE_WALKABLE And n <> TILE_TYPE_ITEM And n <> TILE_TYPE_NPCSPAWN Then
CanNpcMove = False
Exit Function
End If
' Check to make sure that there is not a player in the way
For i = 1 To Player_HighIndex
If IsPlaying(i) Then
If (GetPlayerMap(i) = mapnum) And (GetPlayerX(i) = MapNpc(mapnum).Npc(mapNpcNum).x - 1) And (GetPlayerY(i) = MapNpc(mapnum).Npc(mapNpcNum).y - 1) Then
CanNpcMove = False
Exit Function
End If
End If
Next
' Check to make sure that there is not another npc in the way
For i = 1 To MAX_MAP_NPCS
If (i <> mapNpcNum) And (MapNpc(mapnum).Npc(i).Num > 0) And (MapNpc(mapnum).Npc(i).x = MapNpc(mapnum).Npc(mapNpcNum).x - 1) And (MapNpc(mapnum).Npc(i).y = MapNpc(mapnum).Npc(mapNpcNum).y - 1) Then
CanNpcMove = False
Exit Function
End If
Next
' Directional blocking
If isDirBlocked(Map(mapnum).Tile(MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y).DirBlock, DIR_UP + 1) And isDirBlocked(Map(mapnum).Tile(MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y).DirBlock, DIR_LEFT + 1) Then
CanNpcMove = False
Exit Function
End If
Else
CanNpcMove = False
End If
Case DIR_UP_RIGHT
' Check to make sure not outside of boundries
If y > 0 And x < Map(mapnum).MaxX Then
n = Map(mapnum).Tile(x + 1, y - 1).Type
' Check to make sure that the tile is walkable
If n <> TILE_TYPE_WALKABLE And n <> TILE_TYPE_ITEM And n <> TILE_TYPE_NPCSPAWN Then
CanNpcMove = False
Exit Function
End If
' Check to make sure that there is not a player in the way
For i = 1 To Player_HighIndex
If IsPlaying(i) Then
If (GetPlayerMap(i) = mapnum) And (GetPlayerX(i) = MapNpc(mapnum).Npc(mapNpcNum).x + 1) And (GetPlayerY(i) = MapNpc(mapnum).Npc(mapNpcNum).y - 1) Then
CanNpcMove = False
Exit Function
End If
End If
Next
' Check to make sure that there is not another npc in the way
For i = 1 To MAX_MAP_NPCS
If (i <> mapNpcNum) And (MapNpc(mapnum).Npc(i).Num > 0) And (MapNpc(mapnum).Npc(i).x = MapNpc(mapnum).Npc(mapNpcNum).x + 1) And (MapNpc(mapnum).Npc(i).y = MapNpc(mapnum).Npc(mapNpcNum).y - 1) Then
CanNpcMove = False
Exit Function
End If
Next
' Directional blocking
If isDirBlocked(Map(mapnum).Tile(MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y).DirBlock, DIR_UP + 1) And isDirBlocked(Map(mapnum).Tile(MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y).DirBlock, DIR_RIGHT + 1) Then
CanNpcMove = False
Exit Function
End If
Else
CanNpcMove = False
End If
Case DIR_DOWN_LEFT
' Check to make sure not outside of boundries
If y < Map(mapnum).MaxY And x > 0 Then
n = Map(mapnum).Tile(x - 1, y + 1).Type
' Check to make sure that the tile is walkable
If n <> TILE_TYPE_WALKABLE And n <> TILE_TYPE_ITEM And n <> TILE_TYPE_NPCSPAWN Then
CanNpcMove = False
Exit Function
End If
' Check to make sure that there is not a player in the way
For i = 1 To Player_HighIndex
If IsPlaying(i) Then
If (GetPlayerMap(i) = mapnum) And (GetPlayerX(i) = MapNpc(mapnum).Npc(mapNpcNum).x - 1) And (GetPlayerY(i) = MapNpc(mapnum).Npc(mapNpcNum).y + 1) Then
CanNpcMove = False
Exit Function
End If
End If
Next
' Check to make sure that there is not another npc in the way
For i = 1 To MAX_MAP_NPCS
If (i <> mapNpcNum) And (MapNpc(mapnum).Npc(i).Num > 0) And (MapNpc(mapnum).Npc(i).x = MapNpc(mapnum).Npc(mapNpcNum).x - 1) And (MapNpc(mapnum).Npc(i).y = MapNpc(mapnum).Npc(mapNpcNum).y + 1) Then
CanNpcMove = False
Exit Function
End If
Next
' Directional blocking
If isDirBlocked(Map(mapnum).Tile(MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y).DirBlock, DIR_DOWN + 1) And isDirBlocked(Map(mapnum).Tile(MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y).DirBlock, DIR_LEFT + 1) Then
CanNpcMove = False
Exit Function
End If
Else
CanNpcMove = False
End If
Case DIR_DOWN_RIGHT
' Check to make sure not outside of boundries
If y < Map(mapnum).MaxY And x < Map(mapnum).MaxX Then
n = Map(mapnum).Tile(x + 1, y + 1).Type
' Check to make sure that the tile is walkable
If n <> TILE_TYPE_WALKABLE And n <> TILE_TYPE_ITEM And n <> TILE_TYPE_NPCSPAWN Then
CanNpcMove = False
Exit Function
End If
' Check to make sure that there is not a player in the way
For i = 1 To Player_HighIndex
If IsPlaying(i) Then
If (GetPlayerMap(i) = mapnum) And (GetPlayerX(i) = MapNpc(mapnum).Npc(mapNpcNum).x + 1) And (GetPlayerY(i) = MapNpc(mapnum).Npc(mapNpcNum).y + 1) Then
CanNpcMove = False
Exit Function
End If
End If
Next
' Check to make sure that there is not another npc in the way
For i = 1 To MAX_MAP_NPCS
If (i <> mapNpcNum) And (MapNpc(mapnum).Npc(i).Num > 0) And (MapNpc(mapnum).Npc(i).x = MapNpc(mapnum).Npc(mapNpcNum).x + 1) And (MapNpc(mapnum).Npc(i).y = MapNpc(mapnum).Npc(mapNpcNum).y + 1) Then
CanNpcMove = False
Exit Function
End If
Next
' Directional blocking
If isDirBlocked(Map(mapnum).Tile(MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y).DirBlock, DIR_DOWN + 1) And isDirBlocked(Map(mapnum).Tile(MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y).DirBlock, DIR_RIGHT + 1) Then
CanNpcMove = False
Exit Function
End If
Else
CanNpcMove = False
End If
no mesmo módulo em sub NpcMove procure
- Código:
If mapnum <= 0 Or mapnum > MAX_MAPS Or mapNpcNum <= 0 Or mapNpcNum > MAX_MAP_NPCS Or Dir < DIR_UP Or Dir > DIR_RIGHT Or movement < 1 Or movement > 2 Then
e substitua-o por
- Código:
If mapnum <= 0 Or mapnum > MAX_MAPS Or mapNpcNum <= 0 Or mapNpcNum > MAX_MAP_NPCS Or Dir < DIR_UP Or Dir > DIR_down_RIGHT Or movement < 1 Or movement > 2 Then
No mesmo sub encontrar
- Código:
Select Case Dir
adicione abaixo dele
- Código:
Case DIR_UP_LEFT
MapNpc(mapnum).Npc(mapNpcNum).y = MapNpc(mapnum).Npc(mapNpcNum).y - 1
MapNpc(mapnum).Npc(mapNpcNum).x = MapNpc(mapnum).Npc(mapNpcNum).x - 1
Set buffer = New clsBuffer
buffer.WriteLong SNpcMove
buffer.WriteLong mapNpcNum
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).x
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).y
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).Dir
buffer.WriteLong movement
SendDataToMap mapnum, buffer.ToArray()
Set buffer = Nothing
Case DIR_UP_RIGHT
MapNpc(mapnum).Npc(mapNpcNum).y = MapNpc(mapnum).Npc(mapNpcNum).y - 1
MapNpc(mapnum).Npc(mapNpcNum).x = MapNpc(mapnum).Npc(mapNpcNum).x + 1
Set buffer = New clsBuffer
buffer.WriteLong SNpcMove
buffer.WriteLong mapNpcNum
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).x
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).y
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).Dir
buffer.WriteLong movement
SendDataToMap mapnum, buffer.ToArray()
Set buffer = Nothing
Case DIR_DOWN_LEFT
MapNpc(mapnum).Npc(mapNpcNum).y = MapNpc(mapnum).Npc(mapNpcNum).y + 1
MapNpc(mapnum).Npc(mapNpcNum).x = MapNpc(mapnum).Npc(mapNpcNum).x - 1
Set buffer = New clsBuffer
buffer.WriteLong SNpcMove
buffer.WriteLong mapNpcNum
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).x
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).y
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).Dir
buffer.WriteLong movement
SendDataToMap mapnum, buffer.ToArray()
Set buffer = Nothing
Case DIR_DOWN_RIGHT
MapNpc(mapnum).Npc(mapNpcNum).y = MapNpc(mapnum).Npc(mapNpcNum).y + 1
MapNpc(mapnum).Npc(mapNpcNum).x = MapNpc(mapnum).Npc(mapNpcNum).x + 1
Set buffer = New clsBuffer
buffer.WriteLong SNpcMove
buffer.WriteLong mapNpcNum
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).x
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).y
buffer.WriteLong MapNpc(mapnum).Npc(mapNpcNum).Dir
buffer.WriteLong movement
SendDataToMap mapnum, buffer.ToArray()
Set buffer = Nothing
em modHandleData no sub HandlePlayerMove procure
- Código:
If Dir < DIR_UP Or Dir > DIR_RIGHT Then
e substitua-o por
- Código:
If Dir < DIR_UP Or Dir > DIR_DOWN_RIGHT Then
no mesmo módulo no sub HandlePlayerDir encontrar
- Código:
If Dir < DIR_UP Or Dir > DIR_RIGHT Then
e substitua-o por
- Código:
If Dir < DIR_UP Or Dir > DIR_DOWN_RIGHT Then
no sub HandleRequestNewMap encontrar
- Código:
If Dir < DIR_UP Or Dir > DIR_RIGHT Then
e substitua-o por
- Código:
If Dir < DIR_UP Or Dir > DIR_DOWN_RIGHT Then
em modServerLoop no sub UpdateMapLogic procure
- Código:
Select Case i
Case 0
' Up
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_UP) Then
Call NpcMove(mapnum, x, DIR_UP, MOVING_WALKING)
didwalk = True
End If
End If
' Down
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_DOWN) Then
Call NpcMove(mapnum, x, DIR_DOWN, MOVING_WALKING)
didwalk = True
End If
End If
' Left
If MapNpc(mapnum).Npc(x).x > TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_LEFT) Then
Call NpcMove(mapnum, x, DIR_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
' Right
If MapNpc(mapnum).Npc(x).x < TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_RIGHT) Then
Call NpcMove(mapnum, x, DIR_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
Case 1
' Right
If MapNpc(mapnum).Npc(x).x < TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_RIGHT) Then
Call NpcMove(mapnum, x, DIR_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
' Left
If MapNpc(mapnum).Npc(x).x > TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_LEFT) Then
Call NpcMove(mapnum, x, DIR_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
' Down
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_DOWN) Then
Call NpcMove(mapnum, x, DIR_DOWN, MOVING_WALKING)
didwalk = True
End If
End If
' Up
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_UP) Then
Call NpcMove(mapnum, x, DIR_UP, MOVING_WALKING)
didwalk = True
End If
End If
Case 2
' Down
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_DOWN) Then
Call NpcMove(mapnum, x, DIR_DOWN, MOVING_WALKING)
didwalk = True
End If
End If
' Up
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_UP) Then
Call NpcMove(mapnum, x, DIR_UP, MOVING_WALKING)
didwalk = True
End If
End If
' Right
If MapNpc(mapnum).Npc(x).x < TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_RIGHT) Then
Call NpcMove(mapnum, x, DIR_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
' Left
If MapNpc(mapnum).Npc(x).x > TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_LEFT) Then
Call NpcMove(mapnum, x, DIR_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
Case 3
' Left
If MapNpc(mapnum).Npc(x).x > TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_LEFT) Then
Call NpcMove(mapnum, x, DIR_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
' Right
If MapNpc(mapnum).Npc(x).x < TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_RIGHT) Then
Call NpcMove(mapnum, x, DIR_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
' Up
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_UP) Then
Call NpcMove(mapnum, x, DIR_UP, MOVING_WALKING)
didwalk = True
End If
End If
' Down
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_DOWN) Then
Call NpcMove(mapnum, x, DIR_DOWN, MOVING_WALKING)
didwalk = True
End If
End If
End Select
e substituí-lo com este
- Código:
Select Case i
Case 0
' Up Left
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x > TargetX Then
If CanNpcMove(mapnum, x, DIR_UP_LEFT) Then
Call NpcMove(mapnum, x, DIR_UP_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Up right
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x < TargetX Then
If CanNpcMove(mapnum, x, DIR_UP_RIGHT) Then
Call NpcMove(mapnum, x, DIR_UP_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Down Left
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x > TargetX Then
If CanNpcMove(mapnum, x, DIR_DOWN_LEFT) Then
Call NpcMove(mapnum, x, DIR_DOWN_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Down Right
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x < TargetX Then
If CanNpcMove(mapnum, x, DIR_DOWN_RIGHT) Then
Call NpcMove(mapnum, x, DIR_DOWN_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Up
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_UP) Then
Call NpcMove(mapnum, x, DIR_UP, MOVING_WALKING)
didwalk = True
End If
End If
' Down
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_DOWN) Then
Call NpcMove(mapnum, x, DIR_DOWN, MOVING_WALKING)
didwalk = True
End If
End If
' Left
If MapNpc(mapnum).Npc(x).x > TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_LEFT) Then
Call NpcMove(mapnum, x, DIR_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
' Right
If MapNpc(mapnum).Npc(x).x < TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_RIGHT) Then
Call NpcMove(mapnum, x, DIR_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
Case 1
' Up Left
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x > TargetX Then
If CanNpcMove(mapnum, x, DIR_UP_LEFT) Then
Call NpcMove(mapnum, x, DIR_UP_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Up right
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x < TargetX Then
If CanNpcMove(mapnum, x, DIR_UP_RIGHT) Then
Call NpcMove(mapnum, x, DIR_UP_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Down Left
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x > TargetX Then
If CanNpcMove(mapnum, x, DIR_DOWN_LEFT) Then
Call NpcMove(mapnum, x, DIR_DOWN_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Down Right
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x < TargetX Then
If CanNpcMove(mapnum, x, DIR_DOWN_RIGHT) Then
Call NpcMove(mapnum, x, DIR_DOWN_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Right
If MapNpc(mapnum).Npc(x).x < TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_RIGHT) Then
Call NpcMove(mapnum, x, DIR_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
' Left
If MapNpc(mapnum).Npc(x).x > TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_LEFT) Then
Call NpcMove(mapnum, x, DIR_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
' Down
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_DOWN) Then
Call NpcMove(mapnum, x, DIR_DOWN, MOVING_WALKING)
didwalk = True
End If
End If
' Up
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_UP) Then
Call NpcMove(mapnum, x, DIR_UP, MOVING_WALKING)
didwalk = True
End If
End If
Case 2
' Up Left
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x > TargetX Then
If CanNpcMove(mapnum, x, DIR_UP_LEFT) Then
Call NpcMove(mapnum, x, DIR_UP_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Up right
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x < TargetX Then
If CanNpcMove(mapnum, x, DIR_UP_RIGHT) Then
Call NpcMove(mapnum, x, DIR_UP_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Down Left
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x > TargetX Then
If CanNpcMove(mapnum, x, DIR_DOWN_LEFT) Then
Call NpcMove(mapnum, x, DIR_DOWN_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Down Right
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x < TargetX Then
If CanNpcMove(mapnum, x, DIR_DOWN_RIGHT) Then
Call NpcMove(mapnum, x, DIR_DOWN_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Down
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_DOWN) Then
Call NpcMove(mapnum, x, DIR_DOWN, MOVING_WALKING)
didwalk = True
End If
End If
' Up
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_UP) Then
Call NpcMove(mapnum, x, DIR_UP, MOVING_WALKING)
didwalk = True
End If
End If
' Right
If MapNpc(mapnum).Npc(x).x < TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_RIGHT) Then
Call NpcMove(mapnum, x, DIR_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
' Left
If MapNpc(mapnum).Npc(x).x > TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_LEFT) Then
Call NpcMove(mapnum, x, DIR_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
Case 3
' Up Left
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x > TargetX Then
If CanNpcMove(mapnum, x, DIR_UP_LEFT) Then
Call NpcMove(mapnum, x, DIR_UP_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Up right
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x < TargetX Then
If CanNpcMove(mapnum, x, DIR_UP_RIGHT) Then
Call NpcMove(mapnum, x, DIR_UP_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Down Left
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x > TargetX Then
If CanNpcMove(mapnum, x, DIR_DOWN_LEFT) Then
Call NpcMove(mapnum, x, DIR_DOWN_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Down Right
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If MapNpc(mapnum).Npc(x).x < TargetX Then
If CanNpcMove(mapnum, x, DIR_DOWN_RIGHT) Then
Call NpcMove(mapnum, x, DIR_DOWN_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
End If
' Left
If MapNpc(mapnum).Npc(x).x > TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_LEFT) Then
Call NpcMove(mapnum, x, DIR_LEFT, MOVING_WALKING)
didwalk = True
End If
End If
' Right
If MapNpc(mapnum).Npc(x).x < TargetX And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_RIGHT) Then
Call NpcMove(mapnum, x, DIR_RIGHT, MOVING_WALKING)
didwalk = True
End If
End If
' Up
If MapNpc(mapnum).Npc(x).y > TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_UP) Then
Call NpcMove(mapnum, x, DIR_UP, MOVING_WALKING)
didwalk = True
End If
End If
' Down
If MapNpc(mapnum).Npc(x).y < TargetY And Not didwalk Then
If CanNpcMove(mapnum, x, DIR_DOWN) Then
Call NpcMove(mapnum, x, DIR_DOWN, MOVING_WALKING)
didwalk = True
End If
End If
End Select
no modPlayer no sub PlayerMove procure
- Código:
If IsPlaying(index) = False Or Dir < DIR_UP Or Dir > DIR_RIGHT Or movement < 1 Or movement > 2 Then
substitua-o por
- Código:
If IsPlaying(index) = False Or Dir < DIR_UP Or Dir > DIR_DOWN_RIGHT Or movement < 1 Or movement > 2 Then
no mesmo sub encontrar
- Código:
Select Case Dir
abaixo adicionar
- Código:
Case DIR_UP_LEFT
' Check to make sure not outside of boundries
If GetPlayerY(index) > 0 Or GetPlayerX(index) > 0 Then
' Check to make sure that the tile is walkable
If Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_UP + 1) And Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_LEFT + 1) Then
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_BLOCKED Then
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_RESOURCE Then
' Check to see if the tile is a key and if it is check if its opened
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index) - 1, GetPlayerY(index) - 1) = YES) Then
Call SetPlayerY(index, GetPlayerY(index) - 1)
Call SetPlayerX(index, GetPlayerX(index) - 1)
SendPlayerMove index, movement, sendToSelf
Moved = YES
End If
End If
End If
End If
Else
' Check to see if we can move them to the another map
If Map(GetPlayerMap(index)).Up > 0 And Map(GetPlayerMap(index)).Left > 0 Then
NewMapY = Map(Map(GetPlayerMap(index)).Up).MaxY
Call PlayerWarp(index, Map(GetPlayerMap(index)).Up, GetPlayerX(index), NewMapY)
Moved = YES
' clear their target
TempPlayer(index).target = 0
TempPlayer(index).targetType = TARGET_TYPE_NONE
SendTarget index
End If
End If
Case DIR_UP_RIGHT
' Check to make sure not outside of boundries
If GetPlayerY(index) > 0 Or GetPlayerX(index) < Map(mapnum).MaxX Then
' Check to make sure that the tile is walkable
If Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_UP + 1) And Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_RIGHT + 1) Then
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_BLOCKED Then
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_RESOURCE Then
' Check to see if the tile is a key and if it is check if its opened
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) - 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index) + 1, GetPlayerY(index) - 1) = YES) Then
Call SetPlayerY(index, GetPlayerY(index) - 1)
Call SetPlayerX(index, GetPlayerX(index) + 1)
SendPlayerMove index, movement, sendToSelf
Moved = YES
End If
End If
End If
End If
Else
' Check to see if we can move them to the another map
If Map(GetPlayerMap(index)).Up > 0 And Map(GetPlayerMap(index)).Right > 0 Then
NewMapY = Map(Map(GetPlayerMap(index)).Up).MaxY
Call PlayerWarp(index, Map(GetPlayerMap(index)).Up, GetPlayerX(index), NewMapY)
Moved = YES
' clear their target
TempPlayer(index).target = 0
TempPlayer(index).targetType = TARGET_TYPE_NONE
SendTarget index
End If
End If
Case DIR_DOWN_LEFT
' Check to make sure not outside of boundries
If GetPlayerY(index) < Map(mapnum).MaxY Or GetPlayerX(index) > 0 Then
' Check to make sure that the tile is walkable
If Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_DOWN + 1) And Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_LEFT + 1) Then
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_BLOCKED Then
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_RESOURCE Then
' Check to see if the tile is a key and if it is check if its opened
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index) + 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index) - 1, GetPlayerY(index) + 1) = YES) Then
Call SetPlayerY(index, GetPlayerY(index) + 1)
Call SetPlayerX(index, GetPlayerX(index) - 1)
SendPlayerMove index, movement, sendToSelf
Moved = YES
End If
End If
End If
End If
Else
' Check to see if we can move them to the another map
If Map(GetPlayerMap(index)).Down > 0 And Map(GetPlayerMap(index)).Left > 0 Then
Call PlayerWarp(index, Map(GetPlayerMap(index)).Down, GetPlayerX(index), 0)
Moved = YES
' clear their target
TempPlayer(index).target = 0
TempPlayer(index).targetType = TARGET_TYPE_NONE
SendTarget index
End If
End If
Case DIR_DOWN_RIGHT
' Check to make sure not outside of boundries
If GetPlayerY(index) < Map(mapnum).MaxY Or GetPlayerX(index) < Map(mapnum).MaxX Then
' Check to make sure that the tile is walkable
If Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_DOWN + 1) And Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_RIGHT + 1) Then
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_BLOCKED Then
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_RESOURCE Then
' Check to see if the tile is a key and if it is check if its opened
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) + 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index) + 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index) + 1, GetPlayerY(index) + 1) = YES) Then
Call SetPlayerY(index, GetPlayerY(index) + 1)
Call SetPlayerX(index, GetPlayerX(index) + 1)
SendPlayerMove index, movement, sendToSelf
Moved = YES
End If
End If
End If
End If
Else
' Check to see if we can move them to the another map
If Map(GetPlayerMap(index)).Down > 0 And Map(GetPlayerMap(index)).Right > 0 Then
Call PlayerWarp(index, Map(GetPlayerMap(index)).Down, GetPlayerX(index), 0)
Moved = YES
' clear their target
TempPlayer(index).target = 0
TempPlayer(index).targetType = TARGET_TYPE_NONE
SendTarget index
End If
End If
no sub ForcePlayerMove substitua todo o sub com este
- Código:
Sub ForcePlayerMove(ByVal index As Long, ByVal movement As Long, ByVal Direction As Long)
If Direction < DIR_UP Or Direction > DIR_DOWN_RIGHT Then Exit Sub
If movement < 1 Or movement > 2 Then Exit Sub
Select Case Direction
Case DIR_UP
If GetPlayerY(index) = 0 Then Exit Sub
Case DIR_LEFT
If GetPlayerX(index) = 0 Then Exit Sub
Case DIR_DOWN
If GetPlayerY(index) = Map(GetPlayerMap(index)).MaxY Then Exit Sub
Case DIR_RIGHT
If GetPlayerX(index) = Map(GetPlayerMap(index)).MaxX Then Exit Sub
Case DIR_UP_LEFT
If GetPlayerY(index) = 0 And GetPlayerX(index) = 0 Then Exit Sub
Case DIR_UP_RIGHT
If GetPlayerY(index) = 0 And GetPlayerX(index) = Map(GetPlayerMap(index)).MaxX Then Exit Sub
Case DIR_DOWN_LEFT
If GetPlayerY(index) = Map(GetPlayerMap(index)).MaxY And GetPlayerX(index) = 0 Then Exit Sub
Case DIR_DOWN_RIGHT
If GetPlayerY(index) = Map(GetPlayerMap(index)).MaxY And GetPlayerX(index) = Map(GetPlayerMap(index)).MaxX Then Exit Sub
End Select
PlayerMove index, Direction, movement, True
End Sub
no sub UseItem ache
- Código:
Case DIR_RIGHT
If GetPlayerX(index) < Map(GetPlayerMap(index)).MaxX Then
x = GetPlayerX(index) + 1
y = GetPlayerY(index)
Else
Exit Sub
End If
adicione abaixo dele
- Código:
Case DIR_UP_LEFT
If GetPlayerY(index) > 0 And GetPlayerX(index) > 0 Then
x = GetPlayerX(index) - 1
y = GetPlayerY(index) - 1
Else
Exit Sub
End If
Case DIR_UP_RIGHT
If GetPlayerY(index) > 0 And GetPlayerX(index) < Map(GetPlayerMap(index)).MaxX Then
x = GetPlayerX(index) + 1
y = GetPlayerY(index) - 1
Else
Exit Sub
End If
Case DIR_DOWN_LEFT
If GetPlayerY(index) < Map(GetPlayerMap(index)).MaxY And GetPlayerX(index) > 0 Then
x = GetPlayerX(index) - 1
y = GetPlayerY(index) + 1
Else
Exit Sub
End If
Case DIR_DOWN_RIGHT
If GetPlayerY(index) < Map(GetPlayerMap(index)).MaxY And GetPlayerX(index) > 0 Then
x = GetPlayerX(index) + 1
y = GetPlayerY(index) + 1
Else
Exit Sub
End If
em modCombat no sub CanPlayerAttackNpc procure
- Código:
Select Case GetPlayerDir(attacker)
Case DIR_UP
NpcX = MapNpc(mapnum).Npc(mapNpcNum).x
NpcY = MapNpc(mapnum).Npc(mapNpcNum).y + 1
Case DIR_DOWN
NpcX = MapNpc(mapnum).Npc(mapNpcNum).x
NpcY = MapNpc(mapnum).Npc(mapNpcNum).y - 1
Case DIR_LEFT
NpcX = MapNpc(mapnum).Npc(mapNpcNum).x + 1
NpcY = MapNpc(mapnum).Npc(mapNpcNum).y
Case DIR_RIGHT
NpcX = MapNpc(mapnum).Npc(mapNpcNum).x - 1
NpcY = MapNpc(mapnum).Npc(mapNpcNum).y
End Select
e substitua-o por
- Código:
Select Case GetPlayerDir(attacker)
Case DIR_UP, DIR_UP_LEFT, DIR_UP_RIGHT
NpcX = MapNpc(mapnum).Npc(mapNpcNum).x
NpcY = MapNpc(mapnum).Npc(mapNpcNum).y + 1
Case DIR_DOWN, DIR_DOWN_LEFT, DIR_DOWN_RIGHT
NpcX = MapNpc(mapnum).Npc(mapNpcNum).x
NpcY = MapNpc(mapnum).Npc(mapNpcNum).y - 1
Case DIR_LEFT
NpcX = MapNpc(mapnum).Npc(mapNpcNum).x + 1
NpcY = MapNpc(mapnum).Npc(mapNpcNum).y
Case DIR_RIGHT
NpcX = MapNpc(mapnum).Npc(mapNpcNum).x - 1
NpcY = MapNpc(mapnum).Npc(mapNpcNum).y
End Select
no sub CanPlayerAttackPlayer encontrar
- Código:
Select Case GetPlayerDir(attacker)
Case DIR_UP
If Not ((GetPlayerY(victim) + 1 = GetPlayerY(attacker)) And (GetPlayerX(victim) = GetPlayerX(attacker))) Then Exit Function
Case DIR_DOWN
If Not ((GetPlayerY(victim) - 1 = GetPlayerY(attacker)) And (GetPlayerX(victim) = GetPlayerX(attacker))) Then Exit Function
Case DIR_LEFT
If Not ((GetPlayerY(victim) = GetPlayerY(attacker)) And (GetPlayerX(victim) + 1 = GetPlayerX(attacker))) Then Exit Function
Case DIR_RIGHT
If Not ((GetPlayerY(victim) = GetPlayerY(attacker)) And (GetPlayerX(victim) - 1 = GetPlayerX(attacker))) Then Exit Function
Case Else
Exit Function
End Select
e substitua-o por
- Código:
Select Case GetPlayerDir(attacker)
Case DIR_UP, DIR_UP_LEFT, DIR_UP_RIGHT
If Not ((GetPlayerY(victim) + 1 = GetPlayerY(attacker)) And (GetPlayerX(victim) = GetPlayerX(attacker))) Then Exit Function
Case DIR_DOWN, DIR_DOWN_LEFT, DIR_DOWN_RIGHT
If Not ((GetPlayerY(victim) - 1 = GetPlayerY(attacker)) And (GetPlayerX(victim) = GetPlayerX(attacker))) Then Exit Function
Case DIR_LEFT
If Not ((GetPlayerY(victim) = GetPlayerY(attacker)) And (GetPlayerX(victim) + 1 = GetPlayerX(attacker))) Then Exit Function
Case DIR_RIGHT
If Not ((GetPlayerY(victim) = GetPlayerY(attacker)) And (GetPlayerX(victim) - 1 = GetPlayerX(attacker))) Then Exit Function
Case Else
Exit Function
End Select
É isso aí! Eu pensei que nunca ia acaba
Creditos: Criar e Disponibilizar o tutorial blwcrow
Itukakitu- Novato
- Mensagens : 4
Créditos : 2
Kotol gosta desta mensagem
Re: [EO 2.3] 8 Direções
Agora sim, arrumado e bunito.
Parabéns e obrigado por nos trazer esse sistema.
Para os que interessam em passar para o DX8; as apenas pequenas modificações que precisam ser feitas, como por exemplo ao inves de aplicar as mudanças na BLTPlayer, a mudança é feita numa DrawPlayer (que é a versão dx8 da Blt)
Continue nos trazendo mais sistemas Old Gallaxy < 3
Att
Parabéns e obrigado por nos trazer esse sistema.
Para os que interessam em passar para o DX8; as apenas pequenas modificações que precisam ser feitas, como por exemplo ao inves de aplicar as mudanças na BLTPlayer, a mudança é feita numa DrawPlayer (que é a versão dx8 da Blt)
Continue nos trazendo mais sistemas Old Gallaxy < 3
Att
_________________
"Mistress of shattered hopes and forever broken dreams"
Profane ~- Colaborador
- Mensagens : 818
Créditos : 130
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|