blkcrow Posted September 12, 2012 Author Share Posted September 12, 2012 Client SideHi this is the first tutorial that i am releasing on this forum. This system has been tested and made in EO 2.3First go to modGlobals and find``` Public DirRight as boolean ```Add below it```Public DirUpLeft As BooleanPublic DirUpRight As BooleanPublic DirDownLeft As BooleanPublic DirDownRight As Boolean```In modInput in the CheckKeys sub find```If GetAsyncKeyState(VK_UP) >= 0 Then DirUp = False```And add above it```If GetAsyncKeyState(VK_UP) >= 0 And GetAsyncKeyState(VK_LEFT) >= 0 Then DirUpLeft = FalseIf GetAsyncKeyState(VK_UP) >= 0 And GetAsyncKeyState(VK_RIGHT) >= 0 Then DirUpRight = FalseIf GetAsyncKeyState(VK_DOWN) >= 0 And GetAsyncKeyState(VK_LEFT) >= 0 Then DirDownLeft = FalseIf GetAsyncKeyState(VK_DOWN) >= 0 And GetAsyncKeyState(VK_RIGHT) >= 0 Then DirDownRight = False```In the same module replace the CheckInputKeys sub with this one```Public Sub CheckInputKeys()' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerIf GetKeyState(vbKeyShift) < 0 Then ShiftDown = TrueElse ShiftDown = FalseEnd IfIf GetKeyState(vbKeyReturn) < 0 Then CheckMapGetItemEnd IfIf GetKeyState(vbKeyControl) < 0 Then ControlDown = TrueElse ControlDown = FalseEnd If'Move Up LeftIf 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 SubElse DirUpLeft = FalseEnd If'Move Up RightIf 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 SubElse DirUpRight = FalseEnd If'Move Down LeftIf 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 SubElse DirDownLeft = FalseEnd If'Move Down RightIf 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 SubElse DirDownRight = FalseEnd If'Move UpIf GetAsyncKeyState(VK_UP) < 0 Then DirUp = True DirDown = False DirLeft = False DirRight = False DirUpLeft = False DirUpRight = False DirDownLeft = False DirDownRight = False Exit SubElse DirUp = FalseEnd If'Move RightIf GetAsyncKeyState(VK_RIGHT) < 0 Then DirUp = False DirDown = False DirLeft = False DirRight = True DirUpLeft = False DirUpRight = False DirDownLeft = False DirDownRight = False Exit SubElse DirRight = FalseEnd If'Move downIf GetAsyncKeyState(VK_DOWN) < 0 Then DirUp = False DirDown = True DirLeft = False DirRight = False DirUpLeft = False DirUpRight = False DirDownLeft = False DirDownRight = False Exit SubElse DirDown = FalseEnd If'Move leftIf GetAsyncKeyState(VK_LEFT) < 0 Then DirUp = False DirDown = False DirLeft = True DirRight = False DirUpLeft = False DirUpRight = False DirDownLeft = False DirDownRight = False Exit SubElse DirLeft = FalseEnd If' Error handlerExit Suberrorhandler:HandleError "CheckInputKeys", "modInput", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub```Now in modConstants find```Public Const DIR_RIGHT As Byte = 3```And add directly below it```Public Const DIR_UP_LEFT As Byte = 4Public Const DIR_UP_RIGHT As Byte = 5Public Const DIR_DOWN_LEFT As Byte = 6Public Const DIR_DOWN_RIGHT As Byte = 7```In modGameLogic in sub CanMove find```d = GetPlayerDir(MyIndex)```And add below it```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 IfEnd IfIf 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 IfEnd IfIf 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 IfEnd IfIf 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 IfEnd If```In the same module but in function CheckDirection find```Case DIR_RIGHT x = GetPlayerX(MyIndex) + 1 y = GetPlayerY(MyIndex)```Add two new cases below it```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```in sub CheckMovement find```Case DIR_RIGHT Call SendPlayerMove Player(MyIndex).XOffset = PIC_X * -1 Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) + 1)```Add below it```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)```Now in modHandleData in the sub HandlePlayerMove find```Case DIR_RIGHT Player(i).XOffset = PIC_X * -1```Add directly below it```Case DIR_UP_LEFT Player(i).YOffset = PIC_Y Player(i).XOffset = PIC_XCase DIR_UP_RIGHT Player(i).YOffset = PIC_Y Player(i).XOffset = PIC_X * -1Case DIR_DOWN_LEFT Player(i).YOffset = PIC_Y * -1 Player(i).XOffset = PIC_XCase DIR_DOWN_RIGHT Player(i).YOffset = PIC_Y * -1 Player(i).XOffset = PIC_X * -1```In modGameLogic in sub ProcessMovement find```Case DIR_RIGHT Player(Index).XOffset = Player(Index).XOffset + MovementSpeed If Player(Index).XOffset > 0 Then Player(Index).XOffset = 0```And add below it```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 = 0Case 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 = 0Case 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 = 0Case 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```in the same sub find```If GetPlayerDir(Index) = DIR_RIGHT Or GetPlayerDir(Index) = DIR_DOWN Then```And replace it with this```If GetPlayerDir(Index) = DIR_RIGHT Or GetPlayerDir(Index) = DIR_DOWN Or GetPlayerDir(Index) = DIR_DOWN_LEFT Or GetPlayerDir(Index) = DIR_DOWN_RIGHT Then```Exactly below this sub in sub ProcessNpcMovement find```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```Add below it```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```In modDirectDraw7 under the sub BltPlayer find```Case DIR_LEFT spritetop = 1```And add below it```Case DIR_UP_LEFT spritetop = 3 Case DIR_UP_RIGHT spritetop = 3 Case DIR_DOWN_LEFT spritetop = 0 Case DIR_DOWN_RIGHT spritetop = 0```in the same sub find```Case DIR_RIGHT If (Player(Index).XOffset < -8) Then anim = Player(Index).Step```And add below it```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```In sub BltNpc find```Case DIR_RIGHT If (MapNpc(MapNpcNum).XOffset < -8) Then anim = MapNpc(MapNpcNum).Step```Add below it```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```in the same mod findAdd below it```Case DIR_UP_LEFT spritetop = 3 Case DIR_UP_RIGHT spritetop = 3 Case DIR_DOWN_LEFT spritetop = 0 Case DIR_DOWN_RIGHT spritetop = 0```On modGameLogic in function IsTryingToMove find```If DirUp Or DirDown Or DirLeft Or DirRight Then```And replace it with```If DirUp Or DirDown Or DirLeft Or DirRight Or DirUpLeft Or DirUpRight Or DirDownLeft Or DirDownRight Then```In modHandleData in sub HandlePlayerData find```DirRight = False```Add below it```DirUpLeft = False DirUpRight = False DirDownLeft = False DirDownRight = False```And we are done in the client ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)Server SideIn modConstants find```Public Const DIR_RIGHT As Byte = 3```Add below it```Public Const DIR_UP_LEFT As Byte = 4Public Const DIR_UP_RIGHT As Byte = 5Public Const DIR_DOWN_LEFT As Byte = 6Public Const DIR_DOWN_RIGHT As Byte = 7```in modGameLogic in sub CanNpcMove find```If mapnum <= 0 Or mapnum > MAX_MAPS Or mapNpcNum <= 0 Or mapNpcNum > MAX_MAP_NPCS Or Dir < DIR_UP Or Dir > DIR_RIGHT Then```Replace it with```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```in the same sub find```Select Case Dir```and add below it```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```in the same module in sub NpcMove find```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```and replace it with```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```In the same sub find```Select Case Dir```add below it```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```in modHandleData in sub HandlePlayerMove find```If Dir < DIR_UP Or Dir > DIR_RIGHT Then```and replace it with```If Dir < DIR_UP Or Dir > DIR_DOWN_RIGHT Then```in the same module in sub HandlePlayerDir find```If Dir < DIR_UP Or Dir > DIR_RIGHT Then```and replace it with```If Dir < DIR_UP Or Dir > DIR_DOWN_RIGHT Then```in sub HandleRequestNewMap find```If Dir < DIR_UP Or Dir > DIR_RIGHT Then```and replace it with```If Dir < DIR_UP Or Dir > DIR_DOWN_RIGHT Then```in modServerLoop in sub UpdateMapLogic find``` 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```and replace it with this```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```in modPlayer in sub PlayerMove find```If IsPlaying(index) = False Or Dir < DIR_UP Or Dir > DIR_RIGHT Or movement < 1 Or movement > 2 Then```replace it with```If IsPlaying(index) = False Or Dir < DIR_UP Or Dir > DIR_DOWN_RIGHT Or movement < 1 Or movement > 2 Then```in the same sub find```Select Case Dir```below it add```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```in sub ForcePlayerMove replace the whole sub with this```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, TrueEnd Sub```in sub UseItem find```Case DIR_RIGHT If GetPlayerX(index) < Map(GetPlayerMap(index)).MaxX Then x = GetPlayerX(index) + 1 y = GetPlayerY(index) Else Exit Sub End If```add below it```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```in modCombat in sub CanPlayerAttackNpc find```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```and replace it with```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```in the sub CanPlayerAttackPlayer find```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```and replace it with```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```Thats it! I thought it was never gonna end ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png) Link to comment Share on other sites More sharing options...
UzGo Posted September 12, 2012 Share Posted September 12, 2012 This is so cool !!! I have not tried yet but i think it will be cool ! Link to comment Share on other sites More sharing options...
CrAzYxD Posted September 12, 2012 Share Posted September 12, 2012 Here I had a problem with the npcs. The npcs walk "blinking" when going diagonally.The rest seems to work without problems.Thanks, and if the solution to npcs, ask to speak what is. ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
quintensky Posted September 12, 2012 Share Posted September 12, 2012 THIS IS GREAT! LONG THOUGH! Link to comment Share on other sites More sharing options...
iSnow Posted September 13, 2012 Share Posted September 13, 2012 Question about the code, say I added ranged projectiles or linear spells, would I need to change anything to make this work? Any difference in how it targets? Link to comment Share on other sites More sharing options...
blkcrow Posted September 13, 2012 Author Share Posted September 13, 2012 > Question about the code, say I added ranged projectiles or linear spells, would I need to change anything to make this work? Any difference in how it targets?No this code does not touch targeting i dont know though what changes your systems make to the code so i cant be sure but i dont think you will have a problem> Here I had a problem with the npcs. The npcs walk "blinking" when going diagonally.> > The rest seems to work without problems.> > Thanks, and if the solution to npcs, ask to speak what is. ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)I had completly forgoten about the NPC movement and remembered it before i posted the tutorial so it was something like a last minute edit i will look at it again and try to fix it when i get the time Link to comment Share on other sites More sharing options...
MrPerfecTR Posted September 13, 2012 Share Posted September 13, 2012 Thank you ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png):) Link to comment Share on other sites More sharing options...
Link Posted September 14, 2012 Share Posted September 14, 2012 This is a great release, I was thinking of this as a possibility for the up coming programming contest since it hasn't been reportedly released until now, great job here. This will most definitely be useful or just fun for many games. Link to comment Share on other sites More sharing options...
blkcrow Posted September 14, 2012 Author Share Posted September 14, 2012 > Thank you ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)You are welcome> This is a great release, I was thinking of this as a possibility for the up coming programming contest since it hasn't been reportedly released until now, great job here. This will most definitely be useful or just fun for many games.Programming contest!? ![:blink:](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/blink.png) When? i hope it will be some time before it begins i in the process of moving and i cant code much Link to comment Share on other sites More sharing options...
Ganjika Posted September 15, 2012 Share Posted September 15, 2012 Does this work on 3.0/nightly (Dx8) and do I have to change my character graphics to accommodate this? Link to comment Share on other sites More sharing options...
Link Posted September 16, 2012 Share Posted September 16, 2012 Try to implement it? It states that it has only been tested in 2.3. Link to comment Share on other sites More sharing options...
iSnow Posted September 16, 2012 Share Posted September 16, 2012 I have this in 3.0 and everything is the same and requires no change of code. But instead of bltPlayer and NPC, it's Draw. Link to comment Share on other sites More sharing options...
Stein Posted September 16, 2012 Share Posted September 16, 2012 Won't this just cause major awkwardness in combat? Link to comment Share on other sites More sharing options...
blkcrow Posted September 16, 2012 Author Share Posted September 16, 2012 even throught the player can move in 8 direction it can only attack in 4 so yeah i think it should cause amkwardness in combat too. I can test it right now though. waitnig till someone post it as a bug and see from there how i will fix it Link to comment Share on other sites More sharing options...
iSnow Posted September 19, 2012 Share Posted September 19, 2012 Hmm, considering you can't face diagonally anyway everyone aligns to a normal combat position. If you can keep the movment rate of the player at a decent speed it doesn't come out too bad. Link to comment Share on other sites More sharing options...
Justn Posted September 20, 2012 Share Posted September 20, 2012 Hmm I would love to use this if it didn't ruin combat.. I'm sure its not that hard to make u able to attack and be attacked from all 8 sides.. Gonna look into it now, if anyone has suggestions please help a spearchucker out. Link to comment Share on other sites More sharing options...
blkcrow Posted September 20, 2012 Author Share Posted September 20, 2012 It is easy to make it able to attack and be attacked from all 8 sides it will be weird though without aditional frames for the diagonal movement you wont know wether you face straight or diagonally. Also combat works fine for me Link to comment Share on other sites More sharing options...
Rob Janes Posted September 20, 2012 Share Posted September 20, 2012 I had in included this feature in one of my EO edit releases over a year ago…not sure if you did this from scratch or learnt from mine but either way good on ya for releasing this for everyone as a tutorial, I know players will love it! Link to comment Share on other sites More sharing options...
blkcrow Posted September 21, 2012 Author Share Posted September 21, 2012 > I had in included this feature in one of my EO edit releases over a year ago…not sure if you did this from scratch or learnt from mine but either way good on ya for releasing this for everyone as a tutorial, I know players will love it!Thanks. I have made it from scratch. I remember your EO edit the one with the WASD and mouse movement right? ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png) I remember it i never downloaded though Link to comment Share on other sites More sharing options...
Rob Janes Posted September 21, 2012 Share Posted September 21, 2012 I don't remember if i had WASD movement or not, though it's not very hard to do either. Mine had the 8 Directional Movement and Mouse Movement along with some other nifty features. No point in brining it back though, it was build on a very old build of EO. Link to comment Share on other sites More sharing options...
santa-clause Posted September 29, 2012 Share Posted September 29, 2012 I like it i'm gonna test it out when i come on my pc but anyway.GOOD JOB ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
Zopto Posted September 29, 2012 Share Posted September 29, 2012 dose npc movment works or it skip frame? Link to comment Share on other sites More sharing options...
Daneta Posted February 15, 2013 Share Posted February 15, 2013 it does not work pls help, i use dragon eclipse Link to comment Share on other sites More sharing options...
Wortel Angels Posted February 15, 2013 Share Posted February 15, 2013 It is working if you do it correctthe npc's are blinking -> refresh ratebut for player its working Link to comment Share on other sites More sharing options...
DarkDino Posted June 17, 2013 Share Posted June 17, 2013 Have fix for NPC Blink? 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