Esse é um add-on para o npc-objeto.
Função:
- Para o slide quando: tem o npc tipo Npc-Objeto no slide(não para com outros npcs);
- Não poder pegar/largar o npc-objeto enquanto escorrega;
- Não poder chutar/empurrar o npc-objeto enquanto escorrega;
- Se estiver com um npc-objeto, pode escorregar;
Sistemas requeridos:
[E.O 2.0] - Npc Objeto (v1.0)
[E.O 2.0] - Npc Objeto (v1.1) : Carregar
[E.O 2.0] - TileSlide dinâmico (v1.0)
Vamos lá que esse é rapidinho (de verdade agora...).
Abra seu 'server.vbp' , em "ModHandleData" , na "Sub HandleCarry" , procure por :
E abaixo disto, adicione isso:
Agora em "ModPlayer" , na "Public Sub CheckObject" , procure por:
E abaixo disto, adicione isso:
E por fim, em "ModPlayer" procure pela sua "Sub ForcePlayerMove" , e substitua ela toda por essa:
E pronto! Add-On completo!
Função:
- Para o slide quando: tem o npc tipo Npc-Objeto no slide(não para com outros npcs);
- Não poder pegar/largar o npc-objeto enquanto escorrega;
- Não poder chutar/empurrar o npc-objeto enquanto escorrega;
- Se estiver com um npc-objeto, pode escorregar;
Sistemas requeridos:
[E.O 2.0] - Npc Objeto (v1.0)
[E.O 2.0] - Npc Objeto (v1.1) : Carregar
[E.O 2.0] - TileSlide dinâmico (v1.0)
Vamos lá que esse é rapidinho (de verdade agora...).
Abra seu 'server.vbp' , em "ModHandleData" , na "Sub HandleCarry" , procure por :
- Spoiler:
' can't attack whilst stunned
If TempPlayer(Index).StunDuration > 0 Then Exit Sub
E abaixo disto, adicione isso:
- Spoiler:
If TempPlayer(Index).IsSliding = True Then Exit Sub
Agora em "ModPlayer" , na "Public Sub CheckObject" , procure por:
- Spoiler:
'Check for errors
If Index <= 0 Or Index > MAX_PLAYERS Then Exit Sub
If TempPlayer(Index).InGame = False Then Exit Sub
E abaixo disto, adicione isso:
- Spoiler:
- If TempPlayer(Index).IsSliding Then Exit Sub
E por fim, em "ModPlayer" procure pela sua "Sub ForcePlayerMove" , e substitua ela toda por essa:
- Spoiler:
Sub ForcePlayerMove(ByVal Index As Long, ByVal Movement As Long, ByVal Direction As Long)
Dim PObjNum As Long
Dim MapNum As Long
Dim i As Long, npcX As Long, npcY As Long
Dim NpcNum As Long
'Check for errors
If Index <= 0 Or Index > MAX_PLAYERS Then Exit Sub
If TempPlayer(Index).InGame = False Then Exit Sub
If Direction < DIR_UP Or Direction > DIR_RIGHT Then Exit Sub
If Movement < 1 Or Movement > 2 Then Exit Sub
If TempPlayer(Index).IsSliding = False Then Exit Sub
If TempPlayer(Index).SlidingDir < DIR_UP Or TempPlayer(Index).SlidingDir > DIR_RIGHT Then Exit Sub
MapNum = GetPlayerMap(Index)
'Get the object player is holding
PObjNum = TempPlayer(Index).HoldingObj
If PObjNum > 0 Then
'Check if object wasn't broken or don't exist anymore
If MapNpc(MapNum).Npc(PObjNum).Num = 0 Then
MapNpc(MapNum).Npc(PObjNum).BeingHold = 0
TempPlayer(Index).HoldingObj = 0
SendObjectsHold Index
Else
MapNpc(MapNum).Npc(PObjNum).BeingHold = Index
End If
End If
Call SetPlayerDir(Index, Direction)
' Check to see if a npc is already on that tile
For i = 1 To MAX_MAP_NPCS
If MapNpc(MapNum).Npc(i).Num > 0 Then
NpcNum = MapNpc(MapNum).Npc(i).Num
With MapNpc(MapNum).Npc(i)
' Check if at same coordinates
Select Case GetPlayerDir(Index)
Case DIR_UP
npcX = .X
npcY = .Y + 1
Case DIR_DOWN
npcX = .X
npcY = .Y - 1
Case DIR_LEFT
npcX = .X + 1
npcY = .Y
Case DIR_RIGHT
npcX = .X - 1
npcY = .Y
End Select
End With
If npcX = GetPlayerX(Index) Then
If npcY = GetPlayerY(Index) Then
'Check for NPC_BEHAVIOUR_OBJECT
If Npc(NpcNum).Behaviour = NPC_BEHAVIOUR_OBJECT Then
'Object is placed on floor
If MapNpc(MapNum).Npc(i).BeingHold = 0 Then
ClearSliding Index
Exit Sub
End If
End If
End If
End If
End If
Next
Select Case Direction
Case DIR_UP
' Check to make sure not outside of boundries
If GetPlayerY(Index) > 0 Then
'Dir Block
If isDirBlocked(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).DirBlock, DIR_UP + 1) Then
ClearSliding Index
Exit Sub
End If
'Tile Blocked
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_BLOCKED Then
ClearSliding Index
Exit Sub
End If
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_RESOURCE Then
ClearSliding Index
Exit Sub
End If
' 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_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) - 1) = NO) Then
ClearSliding Index
Exit Sub
End If
'Ok, we can keep sliding
Call SetPlayerY(Index, GetPlayerY(Index) - 1)
SendPlayerMove Index, Movement, True
If PObjNum > 0 Then
MapNpc(MapNum).Npc(PObjNum).BeingHold = Index
SendObjectsHold Index
Call SendMapNpcsToMap(MapNum)
End If
Else
'make them change map? nah maybe later
ClearSliding Index
Exit Sub
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 isDirBlocked(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).DirBlock, DIR_DOWN + 1) Then
ClearSliding Index
Exit Sub
End If
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type = TILE_TYPE_BLOCKED Then
ClearSliding Index
Exit Sub
End If
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type = TILE_TYPE_RESOURCE Then
ClearSliding Index
Exit Sub
End If
' 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_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) + 1).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) + 1) = NO) Then
ClearSliding Index
Exit Sub
End If
Call SetPlayerY(Index, GetPlayerY(Index) + 1)
If PObjNum > 0 Then
SendObjectsHold Index
Call SendMapNpcsToMap(MapNum)
End If
SendPlayerMove Index, Movement, True
'Moved = YES
Else
ClearSliding Index
Exit Sub
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 isDirBlocked(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).DirBlock, DIR_LEFT + 1) Then
ClearSliding Index
Exit Sub
End If
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Then
ClearSliding Index
Exit Sub
End If
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type = TILE_TYPE_RESOURCE Then
ClearSliding Index
Exit Sub
End If
' 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_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) - 1, GetPlayerY(Index)).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index) - 1, GetPlayerY(Index)) = NO) Then
ClearSliding Index
Exit Sub
End If
Call SetPlayerX(Index, GetPlayerX(Index) - 1)
If PObjNum > 0 Then
SendObjectsHold Index
Call SendMapNpcsToMap(MapNum)
End If
SendPlayerMove Index, Movement, True
Else
ClearSliding Index
Exit Sub
End If
Case DIR_RIGHT
' Check to make sure not outside of boundries
If GetPlayerX(Index) < Map(MapNum).MaxX Then
' Check to make sure that the tile is walkable
If isDirBlocked(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).DirBlock, DIR_RIGHT + 1) Then
ClearSliding Index
Exit Sub
End If
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Then
ClearSliding Index
Exit Sub
End If
If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type = TILE_TYPE_RESOURCE Then
ClearSliding Index
Exit Sub
End If
' 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_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index) + 1, GetPlayerY(Index)).Type = TILE_TYPE_KEY And TempTile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index) + 1, GetPlayerY(Index)) = NO) Then
ClearSliding Index
Exit Sub
End If
Call SetPlayerX(Index, GetPlayerX(Index) + 1)
If PObjNum > 0 Then
SendObjectsHold Index
Call SendMapNpcsToMap(MapNum)
End If
SendPlayerMove Index, Movement, True
Else
ClearSliding Index
Exit Sub
End If
End Select
'Check for floor
With Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index))
' Slide
If .Type = TILE_TYPE_SLIDE Then
TempPlayer(Index).IsSliding = True
TempPlayer(Index).SlidingDir = .Data1
TempPlayer(Index).SlidingCanMove = .Data2
SendPlayerSlide Index
End If
'Quit them from sliding
If .Type <> TILE_TYPE_SLIDE Then
ClearSliding Index
End If
End With
End Sub
E pronto! Add-On completo!
~Créditos~
Kotol