ProPixel Fórum
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Seu mundo de criatividade!


Você não está conectado. Conecte-se ou registre-se

[EO] - Silenciar adversário

2 participantes

Ir para baixo  Mensagem [Página 1 de 1]

1[EO] - Silenciar adversário Empty [EO] - Silenciar adversário Qui Ago 18, 2016 9:07 am

Kincy

Kincy
Fundador

Temos aqui um sistema bem simples, com o objetivo de que ao player ser atingido por tal skill, o mesmo fica silenciado, por seja não poderia usar nenhum poder por determinado tempo.(O poder não silencia NPC, só fazer editar de acordo com o sistema de NPC soltar spell, para que funcione também contra NPC.

Abra o client.vbp e na frmEditor_spell crie uma scrollbar, e uma label com as seguintes propriedades:


ScrollBar

Name: scrlSilence

Label

Name: lblSilence

Caption: Silence: Nenhum


Agora de 2 cliques na scrlSilence e adicione:
CÓDIGO:
Código:
' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If scrlSilence.Value > 0 Then
        lblSilence.Caption = "Silence: " & scrlSilence.Value & "s"
    Else
        lblSilence.Caption = "Silence: Nenhum"
    End If
    Spell(EditorIndex).Silence = scrlSilence.Value
    
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "scrlSilence_Change", "frmEditor_Spell", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub


Aperte ctrl+F e agora pesquise na modEnumerations procure por:

CÓDIGO:
Código:
SPartyVitals



Abaixo coloque:

CÓDIGO:
Código:
SSilence


Agora na modGameEditors encontre:

CÓDIGO:
Código:
.scrlStun.Value = Spell(EditorIndex).StunDuration


Adicione abaixo:

CÓDIGO:
Código:
.scrlSilence.Value = Spell(EditorIndex).Silence


Agora na modGameLogic dentro da sub castspell procure:
CÓDIGO:
Código:
If spellslot < 1 Or spellslot > MAX_PLAYER_SPELLS Then
        Exit Sub
    End If


E coloque embaixo:

CÓDIGO:
Código:
If Silence > 0 Then Exit Sub


na Modglobals procure por:

CÓDIGO:
Código:
Public StunDuration As Long


Embaixo coloque:

CÓDIGO:
Código:
Public Silence As Long


na modHandledata procure:

CÓDIGO:
Código:
HandleDataSub(SPartyVitals) = GetAddress(AddressOf HandlePartyVitals)


E adicione embaixo:

CÓDIGO:
Código:
HandleDataSub(SSilence) = GetAddress(AddressOf HandleSilence)


Ainda na modHandledata procure por:
CÓDIGO:
Código:
Private Sub HandleStunned(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
    
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    
    StunDuration = Buffer.ReadLong
    
    Set Buffer = Nothing
    
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "HandleStunned", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub


E abaixo adicione:
CÓDIGO:
Código:
Private Sub HandleSilence(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
    
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    
    Silence = Buffer.ReadLong
    
    Set Buffer = Nothing
    
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "HandleSilence", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub


Na modType, na private type spellrec procure:

CÓDIGO:
Código:
StunDuration As Long


E embaixo coloque:

CÓDIGO:
Código:
Silence As Long



Acabamos no cliente, agora vamos para o Server.vbp


No modCombat procure:
CÓDIGO:

Código:
If spellnum > 0 Then
            If Spell(spellnum).StunDuration > 0 Then StunPlayer victim, spellnum
            ' DoT
            If Spell(spellnum).Duration > 0 Then
                AddDoT_Player victim, spellnum, attacker
            End If
            End If
        End If




SUBSTITUA por:

CÓDIGO:

Código:
If spellnum > 0 Then
            If Spell(spellnum).StunDuration > 0 Then StunPlayer victim, spellnum
            If Spell(spellnum).Silence > 0 Then SilencePlayer victim, spellnum
            ' DoT
            If Spell(spellnum).Duration > 0 Then
                AddDoT_Player victim, spellnum, attacker
            End If
            End If
        End If


Ainda na modCombat procure por:
CÓDIGO:

Código:
Public Sub StunPlayer(ByVal index As Long, ByVal spellnum As Long)
    ' check if it's a stunning spell
    If Spell(spellnum).StunDuration > 0 Then
        ' set the values on index
        TempPlayer(index).StunDuration = Spell(spellnum).StunDuration
        TempPlayer(index).StunTimer = GetTickCount
        ' send it to the index
        SendStunned index
        ' tell him he's stunned
        PlayerMsg index, "You have been stunned.", BrightRed
    End If
End Sub


E coloque embaixo:
CÓDIGO:

Código:
Public Sub SilencePlayer(ByVal index As Long, ByVal spellnum As Long)

    If Spell(spellnum).Silence > 0 Then
        
        TempPlayer(index).Silence = Spell(spellnum).Silence
        TempPlayer(index).SilenceTimer = GetTickCount
        
        SendSilence index
        
        PlayerMsg index, "Você foi silenciado.", BrightRed
    End If
End Sub


Agora na modEnumerations procure por:

CÓDIGO:

Código:
SPartyVitals


E adicione abaixo:

CÓDIGO:

Código:
SSilence


no modServerLoop procure:
CÓDIGO:

Código:
If TempPlayer(i).StunDuration > 0 Then
                        If GetTickCount > TempPlayer(i).StunTimer + (TempPlayer(i).StunDuration * 1000) Then
                            TempPlayer(i).StunDuration = 0
                            TempPlayer(i).StunTimer = 0
                            SendStunned i
                        End If
                    End If


Embaixo coloque:
CÓDIGO:

Código:
If TempPlayer(i).Silence > 0 Then
                        If GetTickCount > TempPlayer(i).SilenceTimer + (TempPlayer(i).Silence * 1000) Then
                            TempPlayer(i).Silence = 0
                            TempPlayer(i).SilenceTimer = 0
                            SendSilence i
                        End If
                    End If


no modServerTCP procure:
CÓDIGO:

Código:
Sub SendStunned(ByVal index As Long)
    Dim Buffer As clsBuffer
    
    Set Buffer = New clsBuffer
    Buffer.WriteLong SStunned
    Buffer.WriteLong TempPlayer(index).StunDuration
    
    SendDataTo index, Buffer.ToArray()
    
    Set Buffer = Nothing
End Sub


E adicione embaixo:
CÓDIGO:

Código:
Sub SendSilence(ByVal index As Long)
    Dim Buffer As clsBuffer
    
    Set Buffer = New clsBuffer
    Buffer.WriteLong SSilence
    Buffer.WriteLong TempPlayer(index).Silence
    
    SendDataTo index, Buffer.ToArray()
    
    Set Buffer = Nothing
End Sub


Agora na modTypes dentro da Public Type TempPlayerRec, procure por:

CÓDIGO:

Código:
StunDuration As Long


E embaixo adicione:
CÓDIGO:

Código:
SilenceTimer As Long
    Silence As Long


Pronto, agora o sistema esta completo, qualquer duvida ou erro poste abaixo...

http://www.propixelforum.com

2[EO] - Silenciar adversário Empty Re: [EO] - Silenciar adversário Qui Ago 18, 2016 9:24 am

Rayner

Rayner
Aprendiz

Esse sistema é bom para incrementar no projeto, porém tem outros mais eficazes

Ir para o topo  Mensagem [Página 1 de 1]

Permissões neste sub-fórum
Não podes responder a tópicos