Isto é uma pré-visualização de um tema em Hitskin.com
Instalar o tema • Voltar para a ficha do tema
[E.O 2.0] - Tileset Dinâmico (v1.1) + Npc-Objeto Slide
Página 1 de 1
[E.O 2.0] - Tileset Dinâmico (v1.1) + Npc-Objeto Slide
Update final até onde minha criatividade foi em cima disso. Vamos mudar muita coisa!
Função:
Para Player:
- Movimento do PlayerForcado pelo server a cada 0.5s , para não sobrepor leitura do mapnpc(não é viável baixar o tempo de check dos npcs só pra isso);
Para Npc-Objeto:
- Não é destruído quando jogado em cima de outro npc-objeto;
- Agora vai interagir com o Tileset Dinâmico de Slide/Platform;
- Não pode pegar/soltar npc-objeto enquanto gelo/plataforma;
- Npc-Objeto empurrado/chutado segue na direção que o jogador está vendo;
Para Tileset Dinâmico:
- Agora vai existir 2 tipos: Gelo e Plataforma;
- Gelo:
1- vai fazer o jogador/npc-objeto escorregar na direção que estão;
2- Npc-Objeto em cima do Gelo, não se move se Largados em cima;
3- Npc-Objeto empurrado/chutado na direção do gelo, vai seguir na direção que o jogador está vendo;
- Plataforma:
1- Plataforma vai fazer o jogador andar na direção do Editor;
2- Npc-Objeto em cima da Plataforma, se move se Largados em cima, na direção do editor;
3- Npc-Objeto empurrado/chutado na direção da Plataforma, vai seguir na direção do editor;
- Npc-Objeto em cima da plataforma ou gelo, podem ser chutados ou pegos.
Pré Requisitos:
- [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á então, abra seu 'client.vbp', e na parte física da "frmEditor_Map" , dentro do "FraSlide" crie:
1x CheckBox, Nome: chkIcePlat / Caption: (YES)Ice / Platform (NO)
Dê 2x cliques, e dentro da checkbox adicione isso:
Agora, na parte lógica procure por:
E abaixo adicione isso:
Agora, em "ModGlobals" , procure por:
E abaixo adicione isso:
Agora, em "ModGameEditors" , procure por:
E substitua por:
E pronto, a parte do cliente está pronta!
Agora, abra seu "server.vbp" , e em "ModTypes" , em "Private Type MapNpcRec" , declare um TIPO: mais abaixo antes do primeiro "End Type" , declare isso:
Agora, em "Mod ServerLoop" , na "Private Sub UpdateMapLogic()" , procure por:
E abaixo adicione isso:
Agora, no final de "ModPlayer" , adicione isso:
Agora, em "ModCombat" , na "Public Function CanPlayerAttackNpc" , procure por essa parte:
E substitua por essa:
Em "ModHandleData" , substitua toda a sua "Sub HandleCarry" por essa:
Agora, em "ModPlayer", na "Public Sub CheckObject", procure por :
E abaixo adicione isso:
Agora, em "ModGameLogic", na "Public Sub SpawnNpc", procure por:
E abaixo adicione isso:
E por fim, em "ModServerLoop" , procure por isso:
E substitua por isso:
E pronto, agora sim tá lindo: um sistema de Slide interativo bem definido!!!
Função:
Para Player:
- Movimento do PlayerForcado pelo server a cada 0.5s , para não sobrepor leitura do mapnpc(não é viável baixar o tempo de check dos npcs só pra isso);
Para Npc-Objeto:
- Não é destruído quando jogado em cima de outro npc-objeto;
- Agora vai interagir com o Tileset Dinâmico de Slide/Platform;
- Não pode pegar/soltar npc-objeto enquanto gelo/plataforma;
- Npc-Objeto empurrado/chutado segue na direção que o jogador está vendo;
Para Tileset Dinâmico:
- Agora vai existir 2 tipos: Gelo e Plataforma;
- Gelo:
1- vai fazer o jogador/npc-objeto escorregar na direção que estão;
2- Npc-Objeto em cima do Gelo, não se move se Largados em cima;
3- Npc-Objeto empurrado/chutado na direção do gelo, vai seguir na direção que o jogador está vendo;
- Plataforma:
1- Plataforma vai fazer o jogador andar na direção do Editor;
2- Npc-Objeto em cima da Plataforma, se move se Largados em cima, na direção do editor;
3- Npc-Objeto empurrado/chutado na direção da Plataforma, vai seguir na direção do editor;
- Npc-Objeto em cima da plataforma ou gelo, podem ser chutados ou pegos.
Pré Requisitos:
- [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á então, abra seu 'client.vbp', e na parte física da "frmEditor_Map" , dentro do "FraSlide" crie:
1x CheckBox, Nome: chkIcePlat / Caption: (YES)Ice / Platform (NO)
Dê 2x cliques, e dentro da checkbox adicione isso:
- Spoiler:
If chkIcePlat.Value = 0 Then
chkIcePlat.Caption = "(YES)Ice / Platform (NO)"
Else
chkIcePlat.Caption = "(NO) Ice / Platform(YES)"
End If
Agora, na parte lógica procure por:
- Spoiler:
- MapEditorSlideCanMove = chkSlide.Value
E abaixo adicione isso:
- Spoiler:
- MapEditorIcePlat = chkIcePlat.Value
Agora, em "ModGlobals" , procure por:
- Spoiler:
- Public MapEditorSlideCanMove As Long
E abaixo adicione isso:
- Spoiler:
- Public MapEditorIcePlat As Long
Agora, em "ModGameEditors" , procure por:
- Spoiler:
' slide
If frmEditor_Map.optSlide.Value Then
.Type = TILE_TYPE_SLIDE
.Data1 = MapEditorSlideDir
.Data2 = MapEditorSlideCanMove
.Data3 = 0
End If
E substitua por:
- Spoiler:
' slide
If frmEditor_Map.optSlide.Value Then
.Type = TILE_TYPE_SLIDE
.Data1 = MapEditorSlideDir
.Data2 = MapEditorSlideCanMove
.Data3 = MapEditorIcePlat
End If
E pronto, a parte do cliente está pronta!
Agora, abra seu "server.vbp" , e em "ModTypes" , em "Private Type MapNpcRec" , declare um TIPO: mais abaixo antes do primeiro "End Type" , declare isso:
- Spoiler:
IsSliding As Boolean
SlideDir As Long
Agora, em "Mod ServerLoop" , na "Private Sub UpdateMapLogic()" , procure por:
- Spoiler:
If PlayersOnMap(MapNum) = YES Then
TickCount = GetTickCount
For X = 1 To MAX_MAP_NPCS
NpcNum = MapNpc(MapNum).Npc(X).Num
E abaixo adicione isso:
- Spoiler:
' Check walking
If MapNpc(MapNum).Npc(X).IsSliding = True Then
ForceMapNpcMove MapNum, X, MOVING_WALKING, MapNpc(MapNum).Npc(X).SlideDir
End If
Agora, no final de "ModPlayer" , adicione isso:
- Spoiler:
Sub ForceMapNpcMove(ByVal MapNum As Long, ByVal MapNpcNum As Long, ByVal Movement As Long, ByVal Direction As Long)
Dim PObjNum As Long
Dim i As Long, npcX As Long, npcY As Long
Dim NpcNum As Long
'Check for errors
If MapNpcNum <= 0 Or MapNpcNum > MAX_MAP_NPCS Then Exit Sub
If Direction < DIR_UP Or Direction > DIR_RIGHT Then Exit Sub
If Movement < 1 Or Movement > 2 Then Exit Sub
If MapNum <= 0 Or MapNum > MAX_MAPS Then Exit Sub
If MapNpc(MapNum).Npc(MapNpcNum).IsSliding = False Then Exit Sub
If MapNpc(MapNum).Npc(MapNpcNum).SlideDir < DIR_UP Or MapNpc(MapNum).Npc(MapNpcNum).SlideDir > DIR_RIGHT Then Exit Sub
If MapNpc(MapNum).Npc(MapNpcNum).BeingHold > 0 Then Exit Sub
MapNpc(MapNum).Npc(MapNpcNum).Dir = Direction
' Check to see if a npc is already on that tile
For i = 1 To MAX_MAP_NPCS
If i <> MapNpcNum Then
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 MapNpc(MapNum).Npc(MapNpcNum).Dir
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 = MapNpc(MapNum).Npc(MapNpcNum).X Then
If npcY = MapNpc(MapNum).Npc(MapNpcNum).Y 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
ClearMapNpcSliding MapNum, i
Exit Sub
End If
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 MapNpc(MapNum).Npc(MapNpcNum).Y > 0 Then
'Dir Block
If isDirBlocked(Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y).DirBlock, DIR_UP + 1) Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
'Tile Blocked
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y - 1).Type = TILE_TYPE_BLOCKED Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y - 1).Type = TILE_TYPE_RESOURCE Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
' Check to see if the tile is a key and if it is check if its opened
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y - 1).Type = TILE_TYPE_KEY Or (Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y - 1).Type = TILE_TYPE_KEY And TempTile(MapNum).DoorOpen(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y - 1) = NO) Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
'Ok, we can keep sliding
NpcMove MapNum, MapNpcNum, MapNpc(MapNum).Npc(MapNpcNum).SlideDir, Movement
Else
'make them change map? nah maybe later
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
Case DIR_DOWN
' Check to make sure not outside of boundries
If MapNpc(MapNum).Npc(MapNpcNum).Y < Map(MapNum).MaxY Then
' Check to make sure that the tile is walkable
If isDirBlocked(Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y).DirBlock, DIR_DOWN + 1) Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y + 1).Type = TILE_TYPE_BLOCKED Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y + 1).Type = TILE_TYPE_RESOURCE Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
' Check to see if the tile is a key and if it is check if its opened
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y + 1).Type = TILE_TYPE_KEY Or (Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y + 1).Type = TILE_TYPE_KEY And TempTile(MapNum).DoorOpen(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y + 1) = NO) Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
NpcMove MapNum, MapNpcNum, MapNpc(MapNum).Npc(MapNpcNum).SlideDir, Movement
Else
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
Case DIR_LEFT
' Check to make sure not outside of boundries
If MapNpc(MapNum).Npc(MapNpcNum).X > 0 Then
' Check to make sure that the tile is walkable
If isDirBlocked(Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y).DirBlock, DIR_LEFT + 1) Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X - 1, MapNpc(MapNum).Npc(MapNpcNum).Y).Type = TILE_TYPE_BLOCKED Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X - 1, MapNpc(MapNum).Npc(MapNpcNum).Y).Type = TILE_TYPE_RESOURCE Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
' Check to see if the tile is a key and if it is check if its opened
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X - 1, MapNpc(MapNum).Npc(MapNpcNum).Y).Type = TILE_TYPE_KEY Or (Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X - 1, MapNpc(MapNum).Npc(MapNpcNum).Y).Type = TILE_TYPE_KEY And TempTile(MapNum).DoorOpen(MapNpc(MapNum).Npc(MapNpcNum).X - 1, MapNpc(MapNum).Npc(MapNpcNum).Y) = NO) Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
NpcMove MapNum, MapNpcNum, MapNpc(MapNum).Npc(MapNpcNum).SlideDir, Movement
Else
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
Case DIR_RIGHT
' Check to make sure not outside of boundries
If MapNpc(MapNum).Npc(MapNpcNum).X < Map(MapNum).MaxX Then
' Check to make sure that the tile is walkable
If isDirBlocked(Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y).DirBlock, DIR_RIGHT + 1) Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X + 1, MapNpc(MapNum).Npc(MapNpcNum).Y).Type = TILE_TYPE_BLOCKED Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X + 1, MapNpc(MapNum).Npc(MapNpcNum).Y).Type = TILE_TYPE_RESOURCE Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
' Check to see if the tile is a key and if it is check if its opened
If Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X + 1, MapNpc(MapNum).Npc(MapNpcNum).Y).Type = TILE_TYPE_KEY Or (Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X + 1, MapNpc(MapNum).Npc(MapNpcNum).Y).Type = TILE_TYPE_KEY And TempTile(MapNum).DoorOpen(MapNpc(MapNum).Npc(MapNpcNum).X + 1, MapNpc(MapNum).Npc(MapNpcNum).Y) = NO) Then
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
NpcMove MapNum, MapNpcNum, MapNpc(MapNum).Npc(MapNpcNum).SlideDir, Movement
Else
ClearMapNpcSliding MapNum, MapNpcNum
Exit Sub
End If
End Select
'Check for floor
With Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y)
'0=ice / 1=pla
' Slide
If .Type = TILE_TYPE_SLIDE Then
If .Data3 = 0 Then
MapNpc(MapNum).Npc(MapNpcNum).IsSliding = True
MapNpc(MapNum).Npc(MapNpcNum).SlideDir = MapNpc(MapNum).Npc(MapNpcNum).Dir
Else
MapNpc(MapNum).Npc(MapNpcNum).IsSliding = True
MapNpc(MapNum).Npc(MapNpcNum).SlideDir = .Data1
End If
End If
'Quit them from sliding
If .Type <> TILE_TYPE_SLIDE Then
ClearMapNpcSliding MapNum, MapNpcNum
End If
End With
'Update MapNpcs in map
SendMapNpcsToMap MapNum
End Sub
Sub ClearMapNpcSliding(ByVal MapNum As Long, ByVal MapNpcNum As Long)
'Check for errors
If MapNpcNum <= 0 Or MapNpcNum > MAX_MAP_NPCS Then Exit Sub
If MapNum <= 0 Or MapNum > MAX_MAPS Then Exit Sub
MapNpc(MapNum).Npc(MapNpcNum).IsSliding = False
MapNpc(MapNum).Npc(MapNpcNum).SlideDir = 0
SendMapNpcsToMap MapNum
End Sub
Agora, em "ModCombat" , na "Public Function CanPlayerAttackNpc" , procure por essa parte:
- Spoiler:
'Check for objects
If Npc(NpcNum).Behaviour = NPC_BEHAVIOUR_OBJECT And MapNpc(MapNum).Npc(MapNpcNum).BeingHold = 0 Then
'Add the function to change npc direction to get better mechanics
Select Case GetPlayerDir(Attacker)
Case DIR_UP
If MapNpc(MapNum).Npc(MapNpcNum).Y - 1 < 0 Then
CanPlayerAttackNpc = False
Exit Function
End If
MapNpc(MapNum).Npc(MapNpcNum).X = MapNpc(MapNum).Npc(MapNpcNum).X
MapNpc(MapNum).Npc(MapNpcNum).Y = MapNpc(MapNum).Npc(MapNpcNum).Y - 1
'SendMapNpcsTo Attacker, GetPlayerMap(Attacker)
Call SendMapNpcsToMap(MapNum)
Case DIR_DOWN
If MapNpc(MapNum).Npc(MapNpcNum).Y + 1 > Map(MapNum).MaxY Then
CanPlayerAttackNpc = False
Exit Function
End If
MapNpc(MapNum).Npc(MapNpcNum).X = MapNpc(MapNum).Npc(MapNpcNum).X
MapNpc(MapNum).Npc(MapNpcNum).Y = MapNpc(MapNum).Npc(MapNpcNum).Y + 1
'SendMapNpcsTo Attacker, GetPlayerMap(Attacker)
Call SendMapNpcsToMap(MapNum)
Case DIR_LEFT
If MapNpc(MapNum).Npc(MapNpcNum).X - 1 < 0 Then
CanPlayerAttackNpc = False
Exit Function
End If
MapNpc(MapNum).Npc(MapNpcNum).X = MapNpc(MapNum).Npc(MapNpcNum).X - 1
MapNpc(MapNum).Npc(MapNpcNum).Y = MapNpc(MapNum).Npc(MapNpcNum).Y
'SendMapNpcsTo Attacker, GetPlayerMap(Attacker)
Call SendMapNpcsToMap(MapNum)
Case DIR_RIGHT
If MapNpc(MapNum).Npc(MapNpcNum).X + 1 > Map(MapNum).MaxX Then
CanPlayerAttackNpc = False
Exit Function
End If
MapNpc(MapNum).Npc(MapNpcNum).X = MapNpc(MapNum).Npc(MapNpcNum).X + 1
MapNpc(MapNum).Npc(MapNpcNum).Y = MapNpc(MapNum).Npc(MapNpcNum).Y
'SendMapNpcsTo Attacker, GetPlayerMap(Attacker)
Call SendMapNpcsToMap(MapNum)
End Select
CanPlayerAttackNpc = False
Exit Function
End If
E substitua por essa:
- Spoiler:
'Check for: NPC_BEHAVIOUR_OBJECT
If Npc(NpcNum).Behaviour = NPC_BEHAVIOUR_OBJECT And MapNpc(MapNum).Npc(MapNpcNum).BeingHold = 0 Then
'Add the function to change npc direction to get better mechanics
Select Case GetPlayerDir(Attacker)
Case DIR_UP
If MapNpc(MapNum).Npc(MapNpcNum).Y - 1 < 0 Then
CanPlayerAttackNpc = False
Exit Function
End If
MapNpc(MapNum).Npc(MapNpcNum).X = MapNpc(MapNum).Npc(MapNpcNum).X
MapNpc(MapNum).Npc(MapNpcNum).Y = MapNpc(MapNum).Npc(MapNpcNum).Y - 1
MapNpc(MapNum).Npc(MapNpcNum).Dir = GetPlayerDir(Attacker)
Call SendMapNpcsToMap(MapNum)
Case DIR_DOWN
If MapNpc(MapNum).Npc(MapNpcNum).Y + 1 > Map(MapNum).MaxY Then
CanPlayerAttackNpc = False
Exit Function
End If
MapNpc(MapNum).Npc(MapNpcNum).X = MapNpc(MapNum).Npc(MapNpcNum).X
MapNpc(MapNum).Npc(MapNpcNum).Y = MapNpc(MapNum).Npc(MapNpcNum).Y + 1
MapNpc(MapNum).Npc(MapNpcNum).Dir = GetPlayerDir(Attacker)
Call SendMapNpcsToMap(MapNum)
Case DIR_LEFT
If MapNpc(MapNum).Npc(MapNpcNum).X - 1 < 0 Then
CanPlayerAttackNpc = False
Exit Function
End If
MapNpc(MapNum).Npc(MapNpcNum).X = MapNpc(MapNum).Npc(MapNpcNum).X - 1
MapNpc(MapNum).Npc(MapNpcNum).Y = MapNpc(MapNum).Npc(MapNpcNum).Y
MapNpc(MapNum).Npc(MapNpcNum).Dir = GetPlayerDir(Attacker)
Call SendMapNpcsToMap(MapNum)
Case DIR_RIGHT
If MapNpc(MapNum).Npc(MapNpcNum).X + 1 > Map(MapNum).MaxX Then
CanPlayerAttackNpc = False
Exit Function
End If
MapNpc(MapNum).Npc(MapNpcNum).X = MapNpc(MapNum).Npc(MapNpcNum).X + 1
MapNpc(MapNum).Npc(MapNpcNum).Y = MapNpc(MapNum).Npc(MapNpcNum).Y
MapNpc(MapNum).Npc(MapNpcNum).Dir = GetPlayerDir(Attacker)
Call SendMapNpcsToMap(MapNum)
End Select
'Check for floor
With Map(MapNum).Tile(MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y)
'0=ice / 1=pla
' Slide
If .Type = TILE_TYPE_SLIDE Then
If .Data3 = 0 Then
MapNpc(MapNum).Npc(MapNpcNum).IsSliding = True
MapNpc(MapNum).Npc(MapNpcNum).SlideDir = MapNpc(MapNum).Npc(MapNpcNum).Dir
Else
MapNpc(MapNum).Npc(MapNpcNum).IsSliding = True
MapNpc(MapNum).Npc(MapNpcNum).SlideDir = .Data1
End If
End If
'Quit them from sliding
If .Type <> TILE_TYPE_SLIDE Then
If .Data2 = 0 Then
ClearMapNpcSliding MapNum, MapNpcNum
End If
End If
End With
CanPlayerAttackNpc = False
Exit Function
End If
Em "ModHandleData" , substitua toda a sua "Sub HandleCarry" por essa:
- Spoiler:
Sub HandleCarry(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim i As Long
Dim x As Long, y As Long
Dim MapNum As Long
Dim ObjNum As Long
If Index <= 0 Or Index > MAX_PLAYERS Then Exit Sub
If TempPlayer(Index).InGame = False Then Exit Sub
' can't attack whilst casting
If TempPlayer(Index).spellBuffer.Spell > 0 Then Exit Sub
' can't attack whilst stunned
If TempPlayer(Index).StunDuration > 0 Then Exit Sub
'Is Sliding can't take or throw
If TempPlayer(Index).IsSliding = True Then Exit Sub
' Send this packet so they can see the person attacking
SendAttack Index
MapNum = GetPlayerMap(Index)
If TempPlayer(Index).HoldingObj > 0 Then
ObjNum = TempPlayer(Index).HoldingObj
If MapNpc(MapNum).Npc(ObjNum).Num > 0 Then
' Check tradeskills
Select Case GetPlayerDir(Index)
Case DIR_UP
If GetPlayerY(Index) = 0 Then Exit Sub
x = GetPlayerX(Index)
y = GetPlayerY(Index) - 1
MapNpc(MapNum).Npc(ObjNum).x = x
MapNpc(MapNum).Npc(ObjNum).y = y
MapNpc(MapNum).Npc(ObjNum).BeingHold = 0
TempPlayer(Index).HoldingObj = 0
Call SendMapNpcsToMap(MapNum)
SendObjectsHold Index
Case DIR_DOWN
If GetPlayerY(Index) = Map(GetPlayerMap(Index)).MaxY Then Exit Sub
x = GetPlayerX(Index)
y = GetPlayerY(Index) + 1
MapNpc(MapNum).Npc(ObjNum).x = x
MapNpc(MapNum).Npc(ObjNum).y = y
MapNpc(MapNum).Npc(ObjNum).BeingHold = 0
TempPlayer(Index).HoldingObj = 0
Call SendMapNpcsToMap(MapNum)
SendObjectsHold Index
Case DIR_LEFT
If GetPlayerX(Index) = 0 Then Exit Sub
x = GetPlayerX(Index) - 1
y = GetPlayerY(Index)
MapNpc(MapNum).Npc(ObjNum).x = x
MapNpc(MapNum).Npc(ObjNum).y = y
MapNpc(MapNum).Npc(ObjNum).BeingHold = 0
TempPlayer(Index).HoldingObj = 0
Call SendMapNpcsToMap(MapNum)
SendObjectsHold Index
Case DIR_RIGHT
If GetPlayerX(Index) = Map(GetPlayerMap(Index)).MaxX Then Exit Sub
x = GetPlayerX(Index) + 1
y = GetPlayerY(Index)
MapNpc(MapNum).Npc(ObjNum).x = x
MapNpc(MapNum).Npc(ObjNum).y = y
MapNpc(MapNum).Npc(ObjNum).BeingHold = 0
TempPlayer(Index).HoldingObj = 0
Call SendMapNpcsToMap(MapNum)
SendObjectsHold Index
End Select
'Check for floor
With Map(MapNum).Tile(x, y)
'0=ice / 1=pla
' Slide
If .Type = TILE_TYPE_SLIDE Then
If .Data3 > 0 Then
MapNpc(MapNum).Npc(ObjNum).IsSliding = True
MapNpc(MapNum).Npc(ObjNum).SlideDir = .Data1
End If
End If
'Quit them from sliding
If .Type <> TILE_TYPE_SLIDE Then
ClearMapNpcSliding MapNum, ObjNum
End If
End With
End If
Else
For i = 1 To MAX_MAP_NPCS
'it exists
If MapNpc(MapNum).Npc(i).Num > 0 Then
' Check tradeskills
Select Case GetPlayerDir(Index)
Case DIR_UP
If GetPlayerY(Index) = 0 Then Exit Sub
x = GetPlayerX(Index)
y = GetPlayerY(Index) - 1
If MapNpc(MapNum).Npc(i).x = x And MapNpc(MapNum).Npc(i).y = y Then
ObjNum = i
Exit For
End If
Case DIR_DOWN
If GetPlayerY(Index) = Map(GetPlayerMap(Index)).MaxY Then Exit Sub
x = GetPlayerX(Index)
y = GetPlayerY(Index) + 1
If MapNpc(MapNum).Npc(i).x = x And MapNpc(MapNum).Npc(i).y = y Then
ObjNum = i
Exit For
End If
Case DIR_LEFT
If GetPlayerX(Index) = 0 Then Exit Sub
x = GetPlayerX(Index) - 1
y = GetPlayerY(Index)
If MapNpc(MapNum).Npc(i).x = x And MapNpc(MapNum).Npc(i).y = y Then
ObjNum = i
Exit For
End If
Case DIR_RIGHT
If GetPlayerX(Index) = Map(GetPlayerMap(Index)).MaxX Then Exit Sub
x = GetPlayerX(Index) + 1
y = GetPlayerY(Index)
If MapNpc(MapNum).Npc(i).x = x And MapNpc(MapNum).Npc(i).y = y Then
ObjNum = i
Exit For
End If
End Select
End If
Next
CheckObject Index, ObjNum, x, y
End If
End 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 adicione isso:
- Spoiler:
- If TempPlayer(Index).IsSliding Then Exit Sub
Agora, em "ModGameLogic", na "Public Sub SpawnNpc", procure por:
- Spoiler:
- MapNpc(MapNum).Npc(MapNpcNum).Dir = Int(Rnd * 4)
E abaixo adicione isso:
- Spoiler:
MapNpc(MapNum).Npc(MapNpcNum).IsSliding = False
MapNpc(MapNum).Npc(MapNpcNum).SlideDir = 0
E por fim, em "ModServerLoop" , procure por isso:
- Spoiler:
If Tick > tmrSlide Then
If TempPlayer(i).IsSliding = True Then
ForcePlayerMove i, MOVING_WALKING, TempPlayer(i).SlidingDir
End If
tmrSlide = GetTickCount + 150
End If
E substitua por isso:
- Spoiler:
If Tick > tmrSlide Then
If TempPlayer(i).IsSliding = True Then
ForcePlayerMove i, MOVING_WALKING, TempPlayer(i).SlidingDir
End If
tmrSlide = GetTickCount + 500
End If
E pronto, agora sim tá lindo: um sistema de Slide interativo bem definido!!!
~Créditos~
Kotol
Kotol- Moderador Local
- Mensagens : 77
Créditos : 17
Valentine, WillMaiaBR, Uchiha ~, Nando Moura e Kiyoko gostam desta mensagem
Tópicos semelhantes
» [E.O 2.0] - [Add-On]: Slide-Block para Npc-Objeto(v1.1)
» [E.O 2.0] - Npc Objeto (v1.0)
» [E.O 2.0] - TileSlide dinâmico (v1.0)
» ABS mais dinamico
» [E.O 2.0] - Npc Objeto (v1.1) : Carregar
» [E.O 2.0] - Npc Objeto (v1.0)
» [E.O 2.0] - TileSlide dinâmico (v1.0)
» ABS mais dinamico
» [E.O 2.0] - Npc Objeto (v1.1) : Carregar
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|