sistema de copiar sprite seja ela de Npc's ou Players com Tempo escolhido pelo editor de magias.....
abra o seu "client.vbp" ,e na "FrmEditor_Spell" crie:
- Citação :
-1x Scrolls
Nome: scrlCopy
-1x Label
Nome: lblCopy
Caption: Copy Duration: 0
-1x CheckBox
Nome: chkCSprite
Muito bem, dentro da "chkCSprite" adicione este seguinte código:
- Código:
-
If ChkCSprite.value = 0 Then
Spell(EditorIndex).CSprite = False
Else
Spell(EditorIndex).CSprite = True
End If
Agora dentro da "scrlCopy" adicione este código:
- Código:
-
Spell(EditorIndex).CopyDuration = scrlCopy.value
lblCopy.Caption = "Copy Duration:" & scrlCopy.value & "s"
Agora, em "modGameEditors", na "Public Sub SpellEditorInit()" , procure por:
- Código:
-
.scrlInterval.value = Spell(EditorIndex).Interval
E abaixo disto, adicione isto:
- Código:
-
If Spell(EditorIndex).CSprite Then
.ChkCSprite.value = 1
Else
.ChkCSprite.value = 0
End If
.scrlCopy.value = Spell(EditorIndex).CopyDuration
Agora, em "ModTypes" , procure pela "Type":
- Código:
-
Private Type SpellRec
E nesta "Type" , procure por:
- Código:
-
StunDuration As Long
E abaixo disto, adicione isto:
- Código:
-
CopyDuration as Long
E ainda nesta "Type" mais abaixo, acima de "End Type", adicione isto:
- Código:
-
CSprite As Boolean
Agora em "ModGlobals" , procure por:
- Código:
-
Public StunDuration As Long
E abaixo disto, adicione isto:
- Código:
-
Public CopyDuration As Long
Agora na "ModEnumerations" na "Public Enum ServerPackets" , procure por:
- Código:
-
SStunned
E abaixo disto, adicione isto:
- Código:
-
SCopy
E agora, na "ModHandleData" em "InitMessages", procure por:
- Código:
-
HandleDataSub(SStunned) = GetAddress(AddressOf HandleStunned)
E abaixo disto, adicione isto:
- Código:
-
HandleDataSub(SCopy) = GetAddress(AddressOf HandleCopy)
E agora, procure por esta Sub:
- Código:
-
Private Sub HandleStunned(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
E abaixo desta SUB , depois da "End Sub" desta "Sub HandleStunned", adicione isto:
- Código:
-
Private Sub HandleCopy(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()
CopyDuration = Buffer.ReadLong
Set Buffer = Nothing
' Error handler
Exit Sub
errorhandler:
HandleError "HandleCopy", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
- Citação :
- Agora vamos pro que eu gosto, o server
Abra seu "server.vbp", e em "ModEnumerations", procure por:
- Código:
-
SStunned
E abaixo disto adicione isto:
- Código:
-
SCopy
E agora em "ModServerTCP" procure pela sub:
- Código:
-
Sub SendStunned(ByVal index As Long)
E abaixo desta SUB, depois da "End Sub" adicione isto:
- Código:
-
Sub SendCopy(ByVal index As Long)
Dim Buffer As clsBuffer
Set Buffer = New clsBuffer
Buffer.WriteLong SCopy
Buffer.WriteLong TempPlayer(index).CopyDuration
SendDataTo index, Buffer.ToArray()
Set Buffer = Nothing
End Sub
Depois, em "ModCombat" na "Sub CastSpell" procure por:
- Código:
-
' find out what kind of spell it is! self cast, target or AOE
E acima disto, adicione isto:
- Código:
-
' Copy Sprite
If Spell(SpellNum).CSprite = True Then
If targetType = TARGET_TYPE_PLAYER Then
Call SetPlayerSprite(index, Player(TempPlayer(index).Target).Sprite)
Call SendPlayerData(index)
TempPlayer(index).CopyDuration = Spell(SpellNum).CopyDuration
TempPlayer(index).CopyTimer = GetTickCount
Exit Sub
ElseIf targetType = TARGET_TYPE_NPC Then
Call SetPlayerSprite(index, NPC(TempPlayer(index).Target).Sprite)
Call SendPlayerData(index)
TempPlayer(index).CopyDuration = Spell(SpellNum).CopyDuration
TempPlayer(index).CopyTimer = GetTickCount
Exit Sub
End If
End If
Ainda em "ModCombat" procure por esta sub:
- Código:
-
Public Sub StunPlayer(ByVal index As Long, ByVal SpellNum As Long)
E depois desta "Sub" abaixo do "End Sub" adicione isto:
- Código:
-
Public Sub CopyPlayer(ByVal index As Long, ByVal SpellNum As Long)
' check if it's a copy spell and duration higher than "0"
If Spell(SpellNum).CopyDuration > 0 Then
' set the values on index
TempPlayer(index).CopyDuration = Spell(SpellNum).CopyDuration
TempPlayer(index).CopyTimer = GetTickCount
' send it to the index
SendCopy index
' tell him he's under copy effect for a "x" time
PlayerMsg index, "Copia ativa por: " & TempPlayer(index).CopyDuration & " segundos.", BrightRed
End If
End Sub
Depois em "modServerLoop" depois desta parte:
- Código:
-
' check if need to turn off stunned
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
Adicione isto:
- Código:
-
' check if need to turn off copy state
If TempPlayer(i).copyDuration > 0 Then
If GetTickCount > TempPlayer(i).CopyTimer + (TempPlayer(i).CopyDuration * 1000) Then
TempPlayer(i).CopyDuration = 0
TempPlayer(i).CopyTimer = 0
SendCopy i
PlayerMsg i, "Cópia terminada...", White
Call OldSprite(i)
End If
End If
Agora em "ModTypes" na "Type" : "Public Type TempPlayerRec", procure por:
- Código:
-
StunTimer As Long
StunDuration As Long
E abaixo disto adicione isto:
- Código:
-
CopyTimer As Long
CopyDuration As Long
E na "Type" : "Public Type SpellRec" , depois de :
- Código:
-
StunDuration as Long
Adicione isto:
- Código:
-
CopyDuration As Long
E nesta "Type" antes de "End Type" , adicione isto:
- Código:
-
CSprite as Boolean
E no final da "ModPlayer" , adicione esta "Sub":
- Código:
-
Sub OldSprite(ByVal index As Long)
'Cada Case é o número de cada classe, e é a Sprite que a classe indicada voltará quando o tempo da cópia acabar
Select Case GetPlayerClass(index)
Case 0
Player(index).Sprite = 1
Call SendPlayerData(index)
Case 1
Player(index).Sprite = 2
Call SendPlayerData(index)
Case 2
Player(index).Sprite = 3
Call SendPlayerData(index)
Case 3
Player(index).Sprite = 4
Call SendPlayerData(index)
Case 4
Player(index).Sprite = 5
Call SendPlayerData(index)
Case 5
Player(index).Sprite = 6
Call SendPlayerData(index)
Case 6
Player(index).Sprite = 7
Call SendPlayerData(index)
Case Else
Player(index).Sprite = 10
Call SendPlayerData(index)
End Select
End Sub
Agora em "ModPlayer", na "Sub JoinGame" , procure por:
- Código:
-
' Send the flag so they know they can start doing stuff
SendInGame index
E acima disto, adicione isto:
- Código:
-
Call OldSprite(index)
E agora, na "Sub LeftGame", procure por:
- Código:
-
Call ClearPlayer(index)
E acima disto, adicione isto:
- Código:
-
Call OldSprite(index)
E pronto, agora você tem o tutorial de cópia de sprite por tempo e retorno à sprite original...lembrem de editar a "Sub OldSprite" com as respectivas sprites que você quer que as classes voltem na hora que acabar o tempo da cópia da sprite...
Créditos
lucas100vzs
Alenaldo
- Código:
-