SkywardRiver Posted September 7, 2013 Author Share Posted September 7, 2013 Hey guys, yeah I get a run-time error 9 when traveling from map to map sometimes. Any idea why this is happening?>! ```Sub PlayerMove(ByVal Index As Long, ByVal Dir As Long, ByVal movement As Long, Optional ByVal sendToSelf As Boolean = False) Dim Buffer As clsBuffer, mapnum As Long, i As Long Dim x As Long, y As Long Dim Moved As Byte, MovedSoFar As Boolean Dim NewMapX As Byte, NewMapY As Byte Dim canwarp As Boolean Dim TileType As Long, VitalType As Long, Colour As Long, Amount As Long, begineventprocessing As Boolean>! ' Check for subscript out of range If IsPlaying(Index) = False Or Dir < DIR_UP Or Dir > DIR_RIGHT Or movement < 1 Or movement > 2 Then Exit Sub End If>! Call SetPlayerDir(Index, Dir) Moved = NO mapnum = GetPlayerMap(Index) Select Case Dir Case DIR_UP ' Check to make sure not outside of boundries If GetPlayerY(Index) > 0 Then ' Check to make sure that the tile is walkable If TempPlayer(Index).inDevSuite = YES Then Call SetPlayerY(Index, GetPlayerY(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES Else If Not isDirBlocked(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).DirBlock, DIR_UP + 1) Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_RESOURCE Then ' Check to see if the tile is a event and if it is check if its opened If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_EVENT Then Call SetPlayerY(Index, GetPlayerY(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES Else If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Data1 > 0 Then If Events(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Data1).WalkThrought = YES Or (player(Index).Char(TempPlayer(Index).CurChar).EventOpen(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Data1) = YES) Then Call SetPlayerY(Index, GetPlayerY(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES End If End If End If 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 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 ' Check to make sure not outside of boundries If GetPlayerY(Index) < Map(mapnum).MaxY Then ' Check to make sure that the tile is walkable If TempPlayer(Index).inDevSuite = YES Then Call SetPlayerY(Index, GetPlayerY(Index) + 1) SendPlayerMove Index, movement, sendToSelf Moved = YES Else If Not isDirBlocked(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).DirBlock, DIR_DOWN + 1) Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), 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), GetPlayerY(Index) + 1).Type <> TILE_TYPE_EVENT Then Call SetPlayerY(Index, GetPlayerY(Index) + 1) SendPlayerMove Index, movement, sendToSelf Moved = YES Else If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Data1 > 0 Then If Events(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Data1).WalkThrought = YES Or (player(Index).Char(TempPlayer(Index).CurChar).EventOpen(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Data1) = YES) Then Call SetPlayerY(Index, GetPlayerY(Index) + 1) SendPlayerMove Index, movement, sendToSelf Moved = YES End If End If End If 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 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_LEFT ' Check to make sure not outside of boundries If GetPlayerX(Index) > 0 Then ' Check to make sure that the tile is walkable If TempPlayer(Index).inDevSuite = YES Then Call SetPlayerX(Index, GetPlayerX(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES Else If 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)).Type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).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)).Type <> TILE_TYPE_EVENT Then Call SetPlayerX(Index, GetPlayerX(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES Else If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Data1 > 0 Then If Events(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Data1).WalkThrought = YES Or (player(Index).Char(TempPlayer(Index).CurChar).EventOpen(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Data1) = YES) Then Call SetPlayerX(Index, GetPlayerX(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES End If End If End If 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)).Left > 0 Then NewMapX = Map(Map(GetPlayerMap(Index)).Left).MaxX Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Left, NewMapX, GetPlayerY(Index)) Moved = YES ' clear their target TempPlayer(Index).Target = 0 TempPlayer(Index).targetType = TARGET_TYPE_NONE SendTarget Index End If End If>! Case DIR_RIGHT ' Check to make sure not outside of boundries If GetPlayerX(Index) < Map(mapnum).MaxX Then If TempPlayer(Index).inDevSuite = YES Then Call SetPlayerX(Index, GetPlayerX(Index) + 1) SendPlayerMove Index, movement, sendToSelf Moved = YES Else ' Check to make sure that the tile is walkable If 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)).Type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).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)).Type <> TILE_TYPE_EVENT Then Call SetPlayerX(Index, GetPlayerX(Index) + 1) SendPlayerMove Index, movement, sendToSelf Moved = YES Else If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Data1 > 0 Then If Events(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Data1).WalkThrought = YES Or (player(Index).Char(TempPlayer(Index).CurChar).EventOpen(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Data1) = YES) Then Call SetPlayerX(Index, GetPlayerX(Index) + 1) SendPlayerMove Index, movement, sendToSelf Moved = YES End If End If End If 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)).Right > 0 Then Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Right, 0, GetPlayerY(Index)) Moved = YES ' clear their target TempPlayer(Index).Target = 0 TempPlayer(Index).targetType = TARGET_TYPE_NONE SendTarget Index End If End If End Select With Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)) ' Check to see if the tile is a warp tile, and if so warp them If .Type = TILE_TYPE_WARP Then mapnum = .Data1 x = .Data2 y = .Data3 If (mapnum And INSTANCED_MAP_MASK) > 0 Then If TempPlayer(Index).inParty Then Call PartyWarp(Index, mapnum, x, y) Else Call PlayerWarp(Index, mapnum, x, y) End If Else Call PlayerWarp(Index, mapnum, x, y) End If Moved = YES End If ' Check for a shop, and if so open it If .Type = TILE_TYPE_SHOP Then x = .Data1 If x > 0 Then ' shop exists? If Len(Trim$(Shop(x).Name)) > 0 Then ' name exists? SendOpenShop Index, x TempPlayer(Index).InShop = x ' stops movement and the like End If End If End If ' Check to see if the tile is a bank, and if so send bank If .Type = TILE_TYPE_BANK Then SendBank Index TempPlayer(Index).InBank = True Moved = YES End If ' Check if it's a heal tile If .Type = TILE_TYPE_HEAL Then VitalType = .Data1 Amount = .Data2 If Not GetPlayerVital(Index, VitalType) = GetPlayerMaxVital(Index, VitalType) Then If VitalType = Vitals.HP Then Colour = BrightGreen Else Colour = BrightBlue End If SendActionMsg GetPlayerMap(Index), "+" & Amount, Colour, ACTIONMSG_SCROLL, GetPlayerX(Index) * 32, GetPlayerY(Index) * 32, 1 SetPlayerVital Index, VitalType, GetPlayerVital(Index, VitalType) + Amount SendBattleMsg Index, "You feel rejuvinating forces flowing through your boy.", BrightGreen Call SendVital(Index, VitalType) ' send vitals to party if in one If TempPlayer(Index).inParty > 0 Then SendPartyVitals TempPlayer(Index).inParty, Index End If Moved = YES End If ' Check if it's a trap tile If .Type = TILE_TYPE_TRAP Then Amount = .Data1 SendActionMsg GetPlayerMap(Index), "-" & Amount, BrightRed, ACTIONMSG_SCROLL, GetPlayerX(Index) * 32, GetPlayerY(Index) * 32, 1 If GetPlayerVital(Index, HP) - Amount <= 0 Then KillPlayer Index SendBattleMsg Index, "You're killed by a trap.", BrightRed Else SetPlayerVital Index, HP, GetPlayerVital(Index, HP) - Amount SendBattleMsg Index, "You're injured by a trap.", BrightRed Call SendVital(Index, HP) ' send vitals to party if in one If TempPlayer(Index).inParty > 0 Then SendPartyVitals TempPlayer(Index).inParty, Index End If Moved = YES End If ' Slide If .Type = TILE_TYPE_SLIDE Then ForcePlayerMove Index, MOVING_WALKING, .Data1 Moved = YES End If If .Type = TILE_TYPE_CRAFT Then If .Data1 > 0 Then TempPlayer(Index).Craft(.Data1) = 1 End If Moved = YES Else For i = 1 To 2 TempPlayer(Index).Craft(i) = 0 Next Moved = YES End If 'Event If .Type = TILE_TYPE_EVENT Then If .Data1 > 0 Then If Events(.Data1).Trigger = 0 Then InitEvent Index, .Data1 End If End If Moved = YES End If End With>! ' They tried to hack If Moved = NO Then PlayerWarp Index, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index) End If x = GetPlayerX(Index) y = GetPlayerY(Index)>! End Sub>! ```There is the player-move code. Any thoughts? Link to comment Share on other sites More sharing options...
Stein Posted September 8, 2013 Share Posted September 8, 2013 That doesn't help much as we still don't know where it causes the issue. :P Could you run it through VB6 and paste the line that's causing issues as well as all the values the variables contain? Link to comment Share on other sites More sharing options...
Domino_ Posted September 8, 2013 Share Posted September 8, 2013 Have you messed with MapRec and havent converted old maps maybe? Link to comment Share on other sites More sharing options...
SkywardRiver Posted September 10, 2013 Author Share Posted September 10, 2013 Nope, all new maps, it's weird. I can't replicate the error, just my other players :/ Link to comment Share on other sites More sharing options...
Lavos Posted September 10, 2013 Share Posted September 10, 2013 My guess is that you're missing data on the server side. Double check ingame on what map number you get this error then go over to the server side and check the map directory if it exists. If the source is open you can check the udt and loop from there to match the data for the engine to recognize and save it with the function. Other than that you could try deleting maps that errors and restart the server to create a new blank map. Its up to you.Edit:Another thing is that you could be missing gfx files saved on to that map that doesn't exist in the client directory. Link to comment Share on other sites More sharing options...
SkywardRiver Posted September 10, 2013 Author Share Posted September 10, 2013 Ah, thanks. Will try that :D 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