Aldeia RPG

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

Suporte ao desenvolvimento de jogos


3 participantes

    Bug Name = Trim$(NPC(npcNum).Name)

    avatar
    gui408
    Ocasional
    Ocasional


    Mensagens : 227
    Créditos : 10

    Bug Name = Trim$(NPC(npcNum).Name) Empty Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por gui408 Qua Jan 14, 2015 2:18 pm

    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 

    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
    Dooolly
    Dooolly
    Colaborador
    Colaborador


    Medalhas : Bug Name = Trim$(NPC(npcNum).Name) Trophy12
    Mensagens : 1227
    Créditos : 153

    Ficha do personagem
    Nível: 1
    Experiência:
    Bug Name = Trim$(NPC(npcNum).Name) Left_bar_bleue0/0Bug Name = Trim$(NPC(npcNum).Name) Empty_bar_bleue  (0/0)
    Vida:
    Bug Name = Trim$(NPC(npcNum).Name) Left_bar_bleue30/30Bug Name = Trim$(NPC(npcNum).Name) Empty_bar_bleue  (30/30)

    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por Dooolly Seg Jan 19, 2015 8:06 pm

    Apague a linha do codigo, ela está sem nenhuma utilidade...

    apaga tb a variavel dela

    vou passar qual a linha da variavel dele:
    Código:
    Dim Name As String
    avatar
    gui408
    Ocasional
    Ocasional


    Mensagens : 227
    Créditos : 10

    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por gui408 Qua Jan 21, 2015 12:02 pm

    Dolly Fiz tudo isso que vc falou,porem agora esta bugando esta parte.
     ' Calculate exp to give attacker
            exp = NPC(npcNum).exp

    Tipo,to matando os npc de boa,mas chega uma certa hora,to matando ai quando o hp deles ta baixo ai vo e mato o npc e bum marca agr ai.
    Parece ateh que o npc nao existe sei la....
    avatar
    gui408
    Ocasional
    Ocasional


    Mensagens : 227
    Créditos : 10

    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por gui408 Qua Jan 21, 2015 12:05 pm

    gui408 escreveu:Dolly Fiz tudo isso que vc falou,porem agora esta bugando esta parte.
     ' Calculate exp to give attacker
            exp = NPC(npcNum).exp

    Tipo,to matando os npc de boa,mas chega uma certa hora,to matando ai quando o hp deles ta baixo ai vo e mato o npc e bum marca agr ai.
    Parece ateh que o npc nao existe sei la....
    Edit:Eu removi o sistema de Rate q tinha antes se era ele,mas continua o mesmo bug e marca esta linha ai agr,removendo as variaveis e oq vc flo...
    se tiver alguma ideia para ajuda...
    Dooolly
    Dooolly
    Colaborador
    Colaborador


    Medalhas : Bug Name = Trim$(NPC(npcNum).Name) Trophy12
    Mensagens : 1227
    Créditos : 153

    Ficha do personagem
    Nível: 1
    Experiência:
    Bug Name = Trim$(NPC(npcNum).Name) Left_bar_bleue0/0Bug Name = Trim$(NPC(npcNum).Name) Empty_bar_bleue  (0/0)
    Vida:
    Bug Name = Trim$(NPC(npcNum).Name) Left_bar_bleue30/30Bug Name = Trim$(NPC(npcNum).Name) Empty_bar_bleue  (30/30)

    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por Dooolly Qua Jan 21, 2015 12:35 pm

    @Cuidado com o Double Post amigo!

    Sobre seu problema, faça que nem eu te falei teste em uma EO 2.0 limpa, e veja se esse erro acontece, se não acontecer foi alguma sistema que você está utitlizando... O erro verdadeiro pode nem ser nessa sub e sim algo que ative ela... reveja isso...
    avatar
    gui408
    Ocasional
    Ocasional


    Mensagens : 227
    Créditos : 10

    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por gui408 Qua Jan 21, 2015 3:59 pm

    Double Post Foi Lag Mals,Obrigado Pela Dica E Pela Atencao Vlw Aew
    Dooolly
    Dooolly
    Colaborador
    Colaborador


    Medalhas : Bug Name = Trim$(NPC(npcNum).Name) Trophy12
    Mensagens : 1227
    Créditos : 153

    Ficha do personagem
    Nível: 1
    Experiência:
    Bug Name = Trim$(NPC(npcNum).Name) Left_bar_bleue0/0Bug Name = Trim$(NPC(npcNum).Name) Empty_bar_bleue  (0/0)
    Vida:
    Bug Name = Trim$(NPC(npcNum).Name) Left_bar_bleue30/30Bug Name = Trim$(NPC(npcNum).Name) Empty_bar_bleue  (30/30)

    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por Dooolly Seg Jan 26, 2015 10:33 pm

    Na sub onde está o erro, procure por:
    Código:
    npcNum = MapNpc(mapnum).Npc(mapNpcNum).Num

    Abaixo coloque:
    Código:
    If npcNum <= 0 or npcnum > MAX_MAP_NPCS Then Exit Sub
    Motodark
    Motodark
    Ocasional
    Ocasional


    Mensagens : 169
    Créditos : 5

    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por Motodark Sex Jan 13, 2017 11:34 pm

    Como coloca a mensagem do quando mata um boss?
    avatar
    gui408
    Ocasional
    Ocasional


    Mensagens : 227
    Créditos : 10

    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por gui408 Sáb Jan 14, 2017 10:25 am

    Local super errado rsrs, mas respondendo, vc tem q por no modcombat, sa sub onde o npc da exp esqueci a sub, ai vc poe playeratack, mas tem esse tuto aqui so pesquisar, mas isso nada ver kkkkk
    Motodark
    Motodark
    Ocasional
    Ocasional


    Mensagens : 169
    Créditos : 5

    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por Motodark Dom Jan 15, 2017 8:34 pm

    no PlayerAtackNPC? o meu tá dando erro na sub exp = NPC(npcNum).exp

    Conteúdo patrocinado


    Bug Name = Trim$(NPC(npcNum).Name) Empty Re: Bug Name = Trim$(NPC(npcNum).Name)

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Sex Abr 26, 2024 10:27 am