Explicando:
Segurando a tecla "C" do teclado, o personagem irá ficar em forma de defesa, assim tendo novos frames nas sprites. Enquanto defende, todo dano recebido é reduzido pela sua proteção.
Se quiser trocar a tecla C por outra qualquer, será preciso alterações no sistema, então se quiser comente a tecla que quiser em baixo que farei as alterações pra você!
Lembrem-se de fazer um backup antes de implantar um sistema.
Cliente Side~
Procure por:
Abaixo adicione:
Procure:
Abaixo adicione:
Procure:
Abaixo coloque:
Procure:
Abaixo ponha:
Procure:
Abaixo coloque:
Procure na sub BltPlayer:
Abaixo ponha:
Ainda na sub BltPlayer procure:
Abaixo coloque:
Procure por:
Mude a sub toda para:
Procure:
Abaixo ponha:
Procure:
Abaixo ponha:
Procure por:
Em cima ponha:
Na Type PlayerRec procure:
Abaixo coloca:
SERVER SIDE~
Procure:
Abaixo coloque:
Na Type AccountRec abaixo de:
Coloque:
Na sub AttackPlayer abaixo de:
Coloque:
Na Sub NpcAttackPlayer abaixo de :
Coloque:
Agora serão preciso novos estilos de sprites na sua engine. Segue abaixo um exemplo de uma sprite!
Foram adicionados 4 frames no final, essas foram as frames adicionadas:
Fim!
Se não esqueci de nada, claro, deve dar certo. kk.
Segurando a tecla "C" do teclado, o personagem irá ficar em forma de defesa, assim tendo novos frames nas sprites. Enquanto defende, todo dano recebido é reduzido pela sua proteção.
Se quiser trocar a tecla C por outra qualquer, será preciso alterações no sistema, então se quiser comente a tecla que quiser em baixo que farei as alterações pra você!
Lembrem-se de fazer um backup antes de implantar um sistema.
Cliente Side~
Procure por:
- Código:
' The Guild Creator
If KeyCode = vbKeyF4 Then
If Player(MyIndex).Access > 0 Then
frmGuild.Show vbModeless, frmMirage
End If
End If
Abaixo adicione:
- Código:
If KeyCode = vbKeyC Then
If Player(MyIndex).Attacking = 0 Then
Player(MyIndex).Defendendo = 1
Else
Call AddText("Impossível defender e atacar ao mesmo tempo!", Red)
Player(MyIndex).Defendendo = 0
End If
End If
Procure:
- Código:
If KeyCode = vbKeyControl Then
ControlDown = True
End If
Abaixo adicione:
- Código:
If KeyCode = vbKeyC Then
Defender = True
End If
Procure:
- Código:
If KeyCode = vbKeyControl Then ControlDown = False
Abaixo coloque:
- Código:
If KeyCode = vbKeyC Then Defender = False
Procure:
- Código:
Public ControlDown As Boolean
Abaixo ponha:
- Código:
Public Defender As Boolean
Procure:
- Código:
If GetAsyncKeyState(VK_SHIFT) >= 0 And ShiftDown = True Then ShiftDown = False
Abaixo coloque:
- Código:
If GetAsyncKeyState(VK_CKEY) >= 0 And Defender = True Then Defender = False
Procure na sub BltPlayer:
- Código:
If Player(Index).AttackTimer + Int(AttackSpeed / 2) > GetTickCount Then
Anim = 2
End If
End If
Abaixo ponha:
- Código:
If Player(Index).Defendendo = 1 Then
Select Case GetPlayerDir(Index)
Case DIR_UP
Anim = 12
Case DIR_DOWN
Anim = 10
Case DIR_LEFT
Anim = 8
Case DIR_RIGHT
Anim = 6
End Select
End If
Ainda na sub BltPlayer procure:
- Código:
' Check to see if we want to stop making him attack
If Player(Index).AttackTimer + AttackSpeed < GetTickCount Then
Player(Index).Attacking = 0
Player(Index).AttackTimer = 0
End If
Abaixo coloque:
- Código:
If Defender = False Then
Player(Index).Defendendo = 0
End If
Procure por:
- Código:
Sub CheckAttack()
Mude a sub toda para:
- Código:
Sub CheckAttack()
Dim AttackSpeed As Long
Dim I As Long
If GetPlayerWeaponSlot(MyIndex) > 0 Then
AttackSpeed = Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AttackSpeed
Else
AttackSpeed = 1000
End If
If ControlDown = True And Defender = False And Player(MyIndex).AttackTimer + AttackSpeed < GetTickCount And Player(MyIndex).Attacking = 0 Then
Player(MyIndex).Attacking = 1
Player(MyIndex).AttackTimer = GetTickCount
Call SendData("attack" & END_CHAR)
End If
If Defender = True And ControlDown = False And Player(MyIndex).Defendendo = 0 Then
Player(MyIndex).Defendendo = 1
End If
End Sub
Procure:
- Código:
If GetKeyState(VK_CONTROL) < 0 Then
ControlDown = True
Else
ControlDown = False
End If
Abaixo ponha:
- Código:
If GetKeyState(VK_CKEY) < 0 Then
Defender = True
Else
Defender = False
End If
Procure:
- Código:
Public Const VK_CONTROL = &H11
Abaixo ponha:
- Código:
Public Const VK_CKEY = &H43
Procure por:
- Código:
' Check if we are getting a map, and if we are tell them so
If GettingMap = True Then
Call DrawText(TexthDC, 36, 36, "Recebendo mapa...", QBColor(BrightCyan))
End If
Em cima ponha:
- Código:
For I = 1 To MAX_PLAYERS
Select Case Player(I).Defendendo
Case 0
Call SendData("defendendo" & SEP_CHAR & I & SEP_CHAR & 0 & END_CHAR)
Case 1
Call SendData("defendendo" & SEP_CHAR & I & SEP_CHAR & 1 & END_CHAR)
End Select
Next
Na Type PlayerRec procure:
- Código:
CastedSpell As Byte
Abaixo coloca:
- Código:
Defendendo As Byte
SERVER SIDE~
Procure:
- Código:
' Online e Jogando
If IsPlaying(Index) = False Then Exit Sub
If IsConnected(Index) = False Then Exit Sub
Select Case LCase$(Parse(0))
Abaixo coloque:
- Código:
Case "defendendo"
If Parse(2) = 0 Then
Player(Parse(1)).Defendendo = False
ElseIf Parse(2) = 1 Then
Player(Parse(1)).Defendendo = True
End If
Exit Sub
Na Type AccountRec abaixo de:
- Código:
Pet As PetRec
Coloque:
- Código:
Defendendo As Boolean
Na sub AttackPlayer abaixo de:
- Código:
' Checar por arma
If GetPlayerWeaponSlot(Attacker) > 0 Then
N = GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))
Else
N = 0
End If
Coloque:
- Código:
' Diminuir damage no caso do jogador estar defendendo.
If Player(Victim).Defendendo = True Then
Damage = Damage - GetPlayerProtection(Victim) / 2
End If
' Verificar se com a defesa o dano foi a 0
If Damage <= 0 Then
Call BattleMsg(Victim, GetPlayerName(Attacker) & " não pôde ferir-lo!!", BrightBlue, 1)
Call BattleMsg(Attacker, GetPlayerName(Victim) & " defendeu seu ataque!", BrightRed, 0)
Exit Sub
End If
Na Sub NpcAttackPlayer abaixo de :
- Código:
' Checar por subscript out of range
If MapNpc(GetPlayerMap(Victim), MapNpcNum).num <= 0 Then
Exit Sub
End If
Coloque:
- Código:
' Diminuir damage no caso do jogador estar defendendo.
If Player(Victim).Defendendo = True Then
Damage = Damage - GetPlayerProtection(Victim) / 2
End If
' Verificar se com a defesa o dano foi a 0
If Damage <= 0 Then
Call BattleMsg(Victim, Trim$(Npc(MapNpc(MapNum, MapNpcNum).num).Name) & " não pôde ferir-lo!!", BrightBlue, 1)
Exit Sub
End If
Agora serão preciso novos estilos de sprites na sua engine. Segue abaixo um exemplo de uma sprite!
Foram adicionados 4 frames no final, essas foram as frames adicionadas:
Fim!
Se não esqueci de nada, claro, deve dar certo. kk.
Créditos:
Renan