Galera estou com um bug que nao estou consceguindo conscerta,tipo eu tava testando a engine aqui tal tudo de boa,porem to matando npc de boa,mato outros todos normal,dps de um tempo matando tal o server da subscript ou of range runtime erro 9,o server vai e cai...
Eu ligo pelo vb 6 e o erro marcou este seguinte codigo
Name = Trim$(NPC(npcNum).Name)
tipo,procurei mais e vi q ele tem no client,mas eu n fiz tutorial de npc mostra level e remove este mesmo cod no client,e vi tb que tem uma parte na atacksay do npc,corringo atacksay do npc,eu nao mechi tb.
Este codigo esta na PlayerAttackNpc,meu npc estao tudo certo alias eu amto eles de boa,so depois de um tempo Bum,da nisso e marca esse codigo.
Name = Trim$(NPC(npcNum).Name)
Unica coisa q eu alterei no serve Na parte PlayerAttackNpc foi o Sistema de Premium e o Evento de Exp Do Thales12,Bem este erro acontece depois de um tempo jogando,as vezes demora,as vezes acontece mais rapido,bem n to consceguindo arrumar,pe;o ajuda de vcs,desde de ja Obrigado!
Minha Sub
Eu ligo pelo vb 6 e o erro marcou este seguinte codigo
Name = Trim$(NPC(npcNum).Name)
tipo,procurei mais e vi q ele tem no client,mas eu n fiz tutorial de npc mostra level e remove este mesmo cod no client,e vi tb que tem uma parte na atacksay do npc,corringo atacksay do npc,eu nao mechi tb.
Este codigo esta na PlayerAttackNpc,meu npc estao tudo certo alias eu amto eles de boa,so depois de um tempo Bum,da nisso e marca esse codigo.
Name = Trim$(NPC(npcNum).Name)
Unica coisa q eu alterei no serve Na parte PlayerAttackNpc foi o Sistema de Premium e o Evento de Exp Do Thales12,Bem este erro acontece depois de um tempo jogando,as vezes demora,as vezes acontece mais rapido,bem n to consceguindo arrumar,pe;o ajuda de vcs,desde de ja Obrigado!
Minha Sub
- Código:
Public Sub PlayerAttackNpc(ByVal Attacker As Long, ByVal mapNpcNum As Long, ByVal Damage As Long, Optional ByVal SpellNum As Long, Optional ByVal overTime As Boolean = False)
Dim Name As String
Dim exp As Long
Dim n As Long
Dim i As Long
Dim STR As Long
Dim Def As Long
Dim mapNum As Long
Dim npcNum As Long
Dim Buffer As clsBuffer
Dim r As Long
Dim EXPRATE As Long
' Check for subscript out of range
If IsPlaying(Attacker) = False Or mapNpcNum <= 0 Or mapNpcNum > MAX_MAP_NPCS Or Damage < 0 Then
Exit Sub
End If
mapNum = GetPlayerMap(Attacker)
npcNum = MapNpc(mapNum).NPC(mapNpcNum).Num
Name = Trim$(NPC(npcNum).Name)
' Check for weapon
n = 0
If GetPlayerEquipment(Attacker, Weapon) > 0 Then
n = GetPlayerEquipment(Attacker, Weapon)
End If
' set the regen timer
TempPlayer(Attacker).stopRegen = True
TempPlayer(Attacker).stopRegenTimer = GetTickCount
If Damage >= MapNpc(mapNum).NPC(mapNpcNum).vital(Vitals.HP) Then
SendActionMsg GetPlayerMap(Attacker), "-" & MapNpc(mapNum).NPC(mapNpcNum).vital(Vitals.HP), BrightRed, 1, (MapNpc(mapNum).NPC(mapNpcNum).x * 32), (MapNpc(mapNum).NPC(mapNpcNum).y * 32)
SendBlood GetPlayerMap(Attacker), MapNpc(mapNum).NPC(mapNpcNum).x, MapNpc(mapNum).NPC(mapNpcNum).y
' send the sound
If SpellNum > 0 Then SendMapSound Attacker, MapNpc(mapNum).NPC(mapNpcNum).x, MapNpc(mapNum).NPC(mapNpcNum).y, SoundEntity.seSpell, SpellNum
' send animation
If SpellNum > 0 Then
Call SendAnimation(mapNum, Spell(SpellNum).SpellAnim, MapNpc(mapNum).NPC(mapNpcNum).x, MapNpc(mapNum).NPC(mapNpcNum).y)
SendMapSound Attacker, MapNpc(mapNum).NPC(mapNpcNum).x, MapNpc(mapNum).NPC(mapNpcNum).y, SoundEntity.seSpell, SpellNum
End If
' Check server's experaince rate
EXPRATE = frmServer.scrlExpRate.Value
' Calculate exp to give attacker
exp = (NPC(npcNum).exp * EXPRATE)
' Premium
If GetPlayerPremium(Attacker) = "Sim" Then
exp = exp * 2
End If
' Make sure we dont get less then 0
If exp < 0 Then
exp = 1
End If
' in party?
If TempPlayer(Attacker).inParty > 0 Then
' pass through party sharing function
Party_ShareExp TempPlayer(Attacker).inParty, exp, Attacker, GetPlayerMap(Attacker)
Else
' no party - keep exp for self
GivePlayerEXP Attacker, exp
End If
'Drop the goods if they get it
n = Int(Rnd * NPC(npcNum).DropChance) + 1
r = Int(Rnd * NPC(npcNum).DropItemValue) + 1
If n = 1 Then
Call SpawnItem(NPC(npcNum).DropItem, r, mapNum, MapNpc(mapNum).NPC(mapNpcNum).x, MapNpc(mapNum).NPC(mapNpcNum).y)
End If
' Now set HP to 0 so we know to actually kill them in the server loop (this prevents subscript out of range)
MapNpc(mapNum).NPC(mapNpcNum).Num = 0
MapNpc(mapNum).NPC(mapNpcNum).SpawnWait = GetTickCount
MapNpc(mapNum).NPC(mapNpcNum).vital(Vitals.HP) = 0
' clear DoTs and HoTs
For i = 1 To MAX_DOTS
With MapNpc(mapNum).NPC(mapNpcNum).DoT(i)
.Spell = 0
.Timer = 0
.Caster = 0
.StartTime = 0
.Used = False
End With
With MapNpc(mapNum).NPC(mapNpcNum).HoT(i)
.Spell = 0
.Timer = 0
.Caster = 0
.StartTime = 0
.Used = False
End With
Next
' send death to the map
Call CheckTasks(Attacker, QUEST_TYPE_GOSLAY, npcNum)
Set Buffer = New clsBuffer
Buffer.WriteLong SNpcDead
Buffer.WriteLong mapNpcNum
SendDataToMap mapNum, Buffer.ToArray()
Set Buffer = Nothing
'Loop through entire map and purge NPC from targets
For i = 1 To Player_HighIndex
If IsPlaying(i) And IsConnected(i) Then
If Player(i).Map = mapNum Then
If TempPlayer(i).targetType = TARGET_TYPE_NPC Then
If TempPlayer(i).target = mapNpcNum Then
TempPlayer(i).target = 0
TempPlayer(i).targetType = TARGET_TYPE_NONE
SendTarget i
End If
End If
End If
End If
Next
Else
' NPC not dead, just do the damage
MapNpc(mapNum).NPC(mapNpcNum).vital(Vitals.HP) = MapNpc(mapNum).NPC(mapNpcNum).vital(Vitals.HP) - Damage
' Check for a weapon and say damage
SendActionMsg mapNum, "-" & Damage, BrightRed, 1, (MapNpc(mapNum).NPC(mapNpcNum).x * 32), (MapNpc(mapNum).NPC(mapNpcNum).y * 32)
SendBlood GetPlayerMap(Attacker), MapNpc(mapNum).NPC(mapNpcNum).x, MapNpc(mapNum).NPC(mapNpcNum).y
' send the sound
If SpellNum > 0 Then SendMapSound Attacker, MapNpc(mapNum).NPC(mapNpcNum).x, MapNpc(mapNum).NPC(mapNpcNum).y, SoundEntity.seSpell, SpellNum
' send animation
If n > 0 Then
If Not overTime Then
If SpellNum = 0 Then Call SendAnimation(mapNum, Item(GetPlayerEquipment(Attacker, Weapon)).Animation, 0, 0, TARGET_TYPE_NPC, mapNpcNum)
End If
End If
' Set the NPC target to the player
MapNpc(mapNum).NPC(mapNpcNum).targetType = 1 ' player
MapNpc(mapNum).NPC(mapNpcNum).target = Attacker
' Now check for guard ai and if so have all onmap guards come after'm
If NPC(MapNpc(mapNum).NPC(mapNpcNum).Num).Behaviour = NPC_BEHAVIOUR_GUARD Then
For i = 1 To MAX_MAP_NPCS
If MapNpc(mapNum).NPC(i).Num = MapNpc(mapNum).NPC(mapNpcNum).Num Then
MapNpc(mapNum).NPC(i).target = Attacker
MapNpc(mapNum).NPC(i).targetType = 1 ' player
End If
Next
End If
' set the regen timer
MapNpc(mapNum).NPC(mapNpcNum).stopRegen = True
MapNpc(mapNum).NPC(mapNpcNum).stopRegenTimer = GetTickCount
' if stunning spell, stun the npc
If SpellNum > 0 Then
If Spell(SpellNum).StunDuration > 0 Then StunNPC mapNpcNum, mapNum, SpellNum
' DoT
If Spell(SpellNum).Duration > 0 Then
AddDoT_Npc mapNum, mapNpcNum, SpellNum, Attacker
End If
End If
SendMapNpcVitals mapNum, mapNpcNum
End If
If SpellNum = 0 Then
' Reset attack timer
TempPlayer(Attacker).AttackTimer = GetTickCount
End If
End Sub