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

    Pets ataca npc, se for atacado pelo npc primeiro

    lksflorencio
    lksflorencio
    Semi-Experiente
    Semi-Experiente


    Mensagens : 83
    Créditos : 0

    Pets ataca npc, se for atacado pelo npc primeiro Empty Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por lksflorencio Sáb Abr 23, 2016 11:36 am

    Alguém me da uma luz como eu faco para o Pets revida o ataque do Npc que o atacou, pois se o player ataca ele revida mas os Npcs não.
    Profane ~
    Profane ~
    Colaborador
    Colaborador


    Mensagens : 818
    Créditos : 130

    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por Profane ~ Dom Abr 24, 2016 7:12 pm

    Caso use o Sistema do Lightning (Nyal)

    Em seu sub de NpcAttackNpc:

    Código:
        MapNpc(MapNum).NPC(Victim).targetType = 2 'Npc
        MapNpc(MapNum).NPC(Victim).target = attacker


    Att


    _________________
    "Mistress of shattered hopes and forever broken dreams"
    lksflorencio
    lksflorencio
    Semi-Experiente
    Semi-Experiente


    Mensagens : 83
    Créditos : 0

    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por lksflorencio Dom Abr 24, 2016 7:50 pm

    Profane ~ escreveu:Caso use o Sistema do Lightning (Nyal)

    Em seu sub de NpcAttackNpc:

    Código:
        MapNpc(MapNum).NPC(Victim).targetType = 2 'Npc
        MapNpc(MapNum).NPC(Victim).target = attacker


    Att
     E o Eclipse Origins 4.2.2 



    Se pode fala o em que Mod eu boto.
    Kies
    Kies
    Diva
    Diva


    Mensagens : 1154
    Créditos : 124

    Ficha do personagem
    Nível: 1
    Experiência:
    Pets ataca npc, se for atacado pelo npc primeiro Left_bar_bleue0/0Pets ataca npc, se for atacado pelo npc primeiro Empty_bar_bleue  (0/0)
    Vida:
    Pets ataca npc, se for atacado pelo npc primeiro Left_bar_bleue30/30Pets ataca npc, se for atacado pelo npc primeiro Empty_bar_bleue  (30/30)

    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por Kies Dom Abr 24, 2016 8:03 pm

    lksflorencio escreveu:
    Profane ~ escreveu:Caso use o Sistema do Lightning (Nyal)

    Em seu sub de NpcAttackNpc:

    Código:
        MapNpc(MapNum).NPC(Victim).targetType = 2 'Npc
        MapNpc(MapNum).NPC(Victim).target = attacker


    Att
     E o Eclipse Origins 4.2.2 



    Se pode fala o em que Mod eu boto.
    mano pq tu n usa uma engine 2.0 deitada ou a skyware premetive?? Usar a 4.x.x não é muito legal se tu não saber programar e o pior de tudo é que quase ninguem o usa então fica no mesmo . Com a crystal shire
    lksflorencio
    lksflorencio
    Semi-Experiente
    Semi-Experiente


    Mensagens : 83
    Créditos : 0

    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por lksflorencio Dom Abr 24, 2016 8:20 pm

    Digamos que 30 do meu projeto ja esta nele, e é uma boa engine só tenho que conce melhor a Source e logo logo deixo um file, na verdade já ta explicado onde e a localização.
    Profane ~
    Profane ~
    Colaborador
    Colaborador


    Mensagens : 818
    Créditos : 130

    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por Profane ~ Seg Abr 25, 2016 5:28 pm

    Adiciona o que eu falei no teu ModPets, no NpcAttackNpc. 

    e.e


    _________________
    "Mistress of shattered hopes and forever broken dreams"
    lksflorencio
    lksflorencio
    Semi-Experiente
    Semi-Experiente


    Mensagens : 83
    Créditos : 0

    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por lksflorencio Qua Abr 27, 2016 4:06 pm

    Profane ~ escreveu:Adiciona o que eu falei no teu ModPets, no NpcAttackNpc. 

    e.e
     Profane eu achem isso que bem diferente do contexto que você passo. se pode me ajuda eu agradeço.

    Código:
    Public Function CanPetAttackNpc(ByVal Attacker As Long, ByVal mapnpcnum As Long, Optional ByVal IsSpell As Boolean = False) As Boolean
        Dim MapNum As Long
        Dim npcnum As Long
        Dim NpcX As Long
        Dim NpcY As Long
        Dim attackspeed As Long

        ' Check for subscript out of range

      On Error GoTo errorhandler

        If IsPlaying(Attacker) = False Or mapnpcnum <= 0 Or mapnpcnum > MAX_MAP_NPCS Or Player(Attacker).characters(TempPlayer(Attacker).CurChar).Pet.Alive = False Then
            Exit Function
        End If

        ' Check for subscript out of range
        If MapNpc(GetPlayerMap(Attacker)).Npc(mapnpcnum).Num <= 0 Then
            Exit Function
        End If

        MapNum = GetPlayerMap(Attacker)
        npcnum = MapNpc(MapNum).Npc(mapnpcnum).Num
       
        ' Make sure the npc isn't already dead
        If MapNpc(MapNum).Npc(mapnpcnum).Vital(Vitals.HP) <= 0 Then
            Exit Function
        End If


        ' Make sure they are on the same map
        If IsPlaying(Attacker) Then
       
        If TempPlayer(Attacker).PetspellBuffer.Spell > 0 And IsSpell = False Then Exit Function
       
            ' exit out early
            If IsSpell Then
                If npcnum > 0 Then
                    If Npc(npcnum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And Npc(npcnum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER Then
                        CanPetAttackNpc = True
                        Exit Function
                    End If
                End If
            End If

            attackspeed = 1000 'Pet cannot weild a weapon

            If npcnum > 0 And GetTickCount > TempPlayer(Attacker).PetAttackTimer + attackspeed Then
                ' Check if at same coordinates
                Select Case Player(Attacker).characters(TempPlayer(Attacker).CurChar).Pet.Dir
                    Case DIR_UP
                        NpcX = MapNpc(MapNum).Npc(mapnpcnum).x
                        NpcY = MapNpc(MapNum).Npc(mapnpcnum).y + 1
                    Case DIR_DOWN
                        NpcX = MapNpc(MapNum).Npc(mapnpcnum).x
                        NpcY = MapNpc(MapNum).Npc(mapnpcnum).y - 1
                    Case DIR_LEFT
                        NpcX = MapNpc(MapNum).Npc(mapnpcnum).x + 1
                        NpcY = MapNpc(MapNum).Npc(mapnpcnum).y
                    Case DIR_RIGHT
                        NpcX = MapNpc(MapNum).Npc(mapnpcnum).x - 1
                        NpcY = MapNpc(MapNum).Npc(mapnpcnum).y
                End Select

                If NpcX = Player(Attacker).characters(TempPlayer(Attacker).CurChar).Pet.x Then
                    If NpcY = Player(Attacker).characters(TempPlayer(Attacker).CurChar).Pet.y Then
                        If Npc(npcnum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And Npc(npcnum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER Then
                            CanPetAttackNpc = True
                        Else
                            CanPetAttackNpc = False
                        End If
                    End If
                End If
            End If
        End If


      On Error GoTo 0
      Exit Function
    errorhandler:
        HandleError "CanPetAttackNpc", "modPets", Err.Number, Err.Description, Erl
        Err.Clear

    End Function


    Código:
    Public Sub PetAttackNpc(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

        ' Check for subscript out of range

      On Error GoTo errorhandler

        If IsPlaying(Attacker) = False Or mapnpcnum <= 0 Or mapnpcnum > MAX_MAP_NPCS Or Damage < 0 Or Player(Attacker).characters(TempPlayer(Attacker).CurChar).Pet.Alive = False Then
            Exit Sub
        End If

        MapNum = GetPlayerMap(Attacker)
        npcnum = MapNpc(MapNum).Npc(mapnpcnum).Num
        Name = Trim$(Npc(npcnum).Name)
       
        If Spellnum = 0 Then
            ' Enviar este pacote para que possam ver o animal atacar
            Set Buffer = New clsBuffer
            Buffer.WriteLong SAttack
            Buffer.WriteLong Attacker
            Buffer.WriteLong 1
            SendDataToMap MapNum, Buffer.ToArray()
            Set Buffer = Nothing
        End If
       
        ' Verificar a existência de arma
        n = 0 ' nenhuma arma, animal de estimação :P
       
        ' definir o temporizador regen
        TempPlayer(Attacker).PetstopRegen = True
        TempPlayer(Attacker).PetstopRegenTimer = 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

            ' Calculate exp to give attacker
            Exp = Npc(npcnum).Exp

            ' Certifique-se de que não ficam a menos de 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, MapNum
            Else
                ' no party - keep exp for self
                GivePlayerEXP Attacker, Exp
            End If
           
            For n = 1 To 20
                If MapNpc(MapNum).Npc(mapnpcnum).Num > 0 Then
                    SpawnItem MapNpc(MapNum).Npc(mapnpcnum).Inventory(n).Num, MapNpc(MapNum).Npc(mapnpcnum).Inventory(n).Value, MapNum, MapNpc(MapNum).Npc(mapnpcnum).x, MapNpc(MapNum).Npc(mapnpcnum).y
                    MapNpc(MapNum).Npc(mapnpcnum).Inventory(n).Value = 0
                    MapNpc(MapNum).Npc(mapnpcnum).Inventory(n).Num = 0
                End If
            Next

            ' 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
            MapNpc(MapNum).Npc(mapnpcnum).TargetType = 0
            MapNpc(MapNum).Npc(mapnpcnum).Target = 0
            UpdateMapBlock MapNum, MapNpc(MapNum).Npc(mapnpcnum).x, MapNpc(MapNum).Npc(mapnpcnum).y, False
           
            ' 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
            Set Buffer = New clsBuffer
            Buffer.WriteLong SNpcDead
            Buffer.WriteLong 0
            Buffer.WriteLong mapnpcnum
            SendDataToMap MapNum, Buffer.ToArray()
            Set Buffer = Nothing
           
            'Loop através de toda mapa e purgar NPC de targets
            For i = 1 To Player_HighIndex
                If IsPlaying(i) And IsConnected(i) Then
                    If GetPlayerMap(i) = 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
                        If TempPlayer(i).PetTargetType = TARGET_TYPE_NPC Then
                            If TempPlayer(i).PetTarget = mapnpcnum Then
                                TempPlayer(i).PetTarget = 0
                                TempPlayer(i).PetTargetType = TARGET_TYPE_NONE
                            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

            ' Verificar a existência de uma arma e dizer danos
            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

            ' Definir o destino NPC para o jogador
            MapNpc(MapNum).Npc(mapnpcnum).TargetType = TARGET_TYPE_PET ' animal de estimação do jogador
            MapNpc(MapNum).Npc(mapnpcnum).Target = Attacker

            ' Agora verificar guarda ai e se assim ter todos no mapa guardas vêm depois
            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 = TARGET_TYPE_PET ' pet
                    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, 3
                End If
            End If
           
            SendMapNpcVitals MapNum, mapnpcnum
        End If

        If Spellnum = 0 Then
            ' Reset attack timer
            TempPlayer(Attacker).PetAttackTimer = GetTickCount
        End If


      On Error GoTo 0
      Exit Sub
    errorhandler:
        HandleError "PetAttackNpc", "modPets", Err.Number, Err.Description, Erl
        Err.Clear
    End Sub
    Profane ~
    Profane ~
    Colaborador
    Colaborador


    Mensagens : 818
    Créditos : 130

    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por Profane ~ Qua Abr 27, 2016 10:09 pm

    Preciso entender algo direito. Oque realmente ocorre?

     Npc Agressivo ataca o pet, e o pet não revida os golpes do Npc Agressivo?

    eh apenas isso?


    _________________
    "Mistress of shattered hopes and forever broken dreams"
    lksflorencio
    lksflorencio
    Semi-Experiente
    Semi-Experiente


    Mensagens : 83
    Créditos : 0

    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por lksflorencio Qua Abr 27, 2016 10:27 pm

    Profane ~ escreveu:Preciso entender algo direito. Oque realmente ocorre?

     Npc Agressivo ataca o pet, e o pet não revida os golpes do Npc Agressivo?

    eh apenas isso?

     Esse código que eu  mandei ta dizendo isso é? se for eu quero munda para o Pet ataca.
    Profane ~
    Profane ~
    Colaborador
    Colaborador


    Mensagens : 818
    Créditos : 130

    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por Profane ~ Qua Abr 27, 2016 10:42 pm

    Nah, quero entender qual o seu problema uehe.

    Quer que o pet ataque quem atacar ele certo? Se sim.

    Preciso de umas informações adicionais para lhe passar o corretinho: 

    Manda o PlayerRec e o PetRec que estão no seu ModTypes.

    Deixe-me analisar como eh salvo a variavel de pet.


    _________________
    "Mistress of shattered hopes and forever broken dreams"

    Conteúdo patrocinado


    Pets ataca npc, se for atacado pelo npc primeiro Empty Re: Pets ataca npc, se for atacado pelo npc primeiro

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Qui Mar 28, 2024 5:48 pm