TutoRPG


Participe do fórum, é rápido e fácil

TutoRPG
TutoRPG
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.
Últimos assuntos
» Evil Fantasy BETA
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Set 10, 2013 12:30 pm por lauk

» Sistema de Guild (do Eduardo)
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer maio 14, 2013 8:54 pm por Khaws

» Sistema de Guild
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer maio 14, 2013 6:48 pm por Khaws

» Teco Fabrica
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSáb Mar 23, 2013 8:18 am por ~FullzDied

» Apresentaçao
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSex Mar 01, 2013 6:58 pm por Sweeps

» Editando nick
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSex Mar 01, 2013 6:35 pm por Sweeps

» Sistema De Vila
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSex Fev 01, 2013 4:59 pm por ~FullzDied

» alguns tilesets
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSáb Dez 22, 2012 8:42 pm por Diegoslstuto

» Tilesets de natureza
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSáb Dez 22, 2012 8:40 pm por Diegoslstuto

» Olá, vim para trazer sistemas e muitas outras coisas
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeQui Dez 13, 2012 3:09 pm por ~FullzDied

» [Recrutando] Bleach Online Dark Saga
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSáb Nov 10, 2012 8:23 pm por Hunter™

» Dragon Ball Fox
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeDom Out 28, 2012 7:55 am por NeeTo

» Tutorial Mapper - Como avaliar um mapa
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSáb Out 13, 2012 12:45 pm por NeeTo

» Life RPG Maker 2.0
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeQui Out 11, 2012 4:02 pm por SynysterGates

» Fórum decaido
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeQui Out 11, 2012 2:16 pm por SynysterGates

» Dragon Ball Elite
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeQua Out 10, 2012 3:07 pm por KingSora

» Auto Ataque por checkbox
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Out 09, 2012 7:35 pm por Warrior_Maker

» Pokémon Online - Xstrond Games BETA
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Out 02, 2012 10:29 pm por thales12

» Auto Correr Por CheckBox
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Out 02, 2012 10:03 pm por thales12

» Auto Loot para Eclipse Origins
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Out 02, 2012 10:02 pm por thales12

»  Ganhar Item em Certo Nivel
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Out 02, 2012 9:58 pm por thales12

» SK - Lógica de Programação - Aula 3
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeQua Set 26, 2012 7:05 pm por SameKage

» Distrito Rpg Maker 2.0 no Ar !!
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeDom Set 23, 2012 7:59 pm por SameKage

» Sistemas que preciso
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSex Set 21, 2012 7:28 pm por KingSora

» [ALL] Títulos nos NPC's 1.0
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSex Set 21, 2012 5:38 pm por lucas100vzs

» Vídeo Tutorial Mapper Caverna - MMORPG 2D
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeQui Set 20, 2012 8:16 pm por KingSora

» Sistema de plantar e colher
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Set 18, 2012 10:00 pm por SameKage

» Perfect engine
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Set 18, 2012 9:59 pm por SameKage

» O Seu pirata chegou !
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeDom Set 16, 2012 7:58 pm por SameKage

» Novidades para tutorpg o que acha?
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSáb Set 15, 2012 7:03 pm por Guilherme Azevedo

» [ZIG ZAG GAMES] Age of Dragons
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSáb Set 15, 2012 1:56 pm por Guilherme Azevedo

» Me ajudem Pliss
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSex Set 14, 2012 9:48 am por KingSora

» SK - HTML - Aula 1
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeQui Set 13, 2012 12:35 pm por SameKage

» Forum Decaindo
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Set 11, 2012 1:52 pm por Tayllor

» Meus 3 mapas
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeTer Set 11, 2012 11:26 am por KingSora

» [Apresentação] Okumura-Rin~
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSeg Set 10, 2012 5:43 pm por Warrior_Maker

» 3 primeiras sprites
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSex Set 07, 2012 6:19 pm por KingSora

» [EEB] Comando para Salvar Seu Game
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSex Set 07, 2012 5:06 pm por SynysterGates

» [Off] Olha Suas PM Tayllor
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeSex Set 07, 2012 4:49 pm por Tayllor

» Fabrica da JCG Corp: Technology in designer [Fechada
[Tutorial]NPC Atacando com SPELL EO 2.0 I_icon_minitimeQui Set 06, 2012 6:15 pm por KingSora

Quem está conectado?
1 usuário online :: 0 registrados, 0 invisíveis e 1 visitante

Nenhum

[ Ver toda a lista ]


O recorde de usuários online foi de 13 em Sex Mar 04, 2022 3:18 am
Parceiros
Templo RPG Maker - Onde a magia maker permanece viva! [Tutorial]NPC Atacando com SPELL EO 2.0 4vAJr

[Tutorial]NPC Atacando com SPELL EO 2.0

2 participantes

Ir para baixo

[Tutorial]NPC Atacando com SPELL EO 2.0 Empty [Tutorial]NPC Atacando com SPELL EO 2.0

Mensagem por KingSora Dom Ago 26, 2012 4:02 pm

PARA QUE SERVE ISSO?

Bom Esta lista de códigos fará com que os NPC's do seu jogo utilizem também spell's.
Tanto Spell's de ataque como Spell's de cura. Bom vamos ao que interessa

Lado do SEVER

Abra o seu SERVER.VBP
Em modConstants
Procure por :

Código:
Public Const MAX_PARTY_MEMBERS As Long = 4


Embaixo dele você adciona

Código:
Public Const MAX_NPC_SPELLS As Long = 5

Isso diz quantas spells seu npc terá, no caso 5 mas pode ter mais ou menos.

Agora vá para modTypes
Lá procure por Private Type NpcRec
Adcione isso entre Private Type NpcRec e End Type

Código:
Spell(1 To MAX_NPC_SPELLS) As Long


Ainda em modTypes
Procure Private Type MapNpcRec
(Fica logo abaixo de Private Type NpcRec.)
Entre Private Type MapNpcRec e End Type adcione

Código:
SpellTimer(1 To MAX_NPC_SPELLS) As Long
    Heals As Integer


Vamos para modCombat
Procure por Sub NpcAttackPlayer
No final desse Sub após até do End Sub adcione isto

Código:
Sub NpcSpellPlayer(ByVal MapNpcNum As Long, ByVal Victim As Long, SpellSlotNum As Long)
    Dim mapnum As Long
    Dim i As Long
    Dim n As Long
    Dim SpellNum As Long
    Dim Buffer As clsBuffer
    Dim InitDamage As Long
    Dim Damage As Long
    Dim MaxHeals As Long

    ' Check for subscript out of range
    If MapNpcNum <= 0 Or MapNpcNum > MAX_MAP_NPCS Or IsPlaying(Victim) = False Then
        Exit Sub
    End If

    ' Check for subscript out of range
    If MapNpc(GetPlayerMap(Victim)).Npc(MapNpcNum).Num <= 0 Then
        Exit Sub
    End If
 
    If SpellSlotNum <= 0 Or SpellSlotNum > MAX_NPC_SPELLS Then Exit Sub

    ' The Variables
    mapnum = GetPlayerMap(Victim)
    SpellNum = Npc(MapNpc(mapnum).Npc(MapNpcNum).Num).Spell(SpellSlotNum)
 
    ' Send this packet so they can see the person attacking
    Set Buffer = New clsBuffer
    Buffer.WriteLong SNpcAttack
    Buffer.WriteLong MapNpcNum
    SendDataToMap mapnum, Buffer.ToArray()
    Set Buffer = Nothing
 
    ' CoolDown Time
    If MapNpc(mapnum).Npc(MapNpcNum).SpellTimer(SpellSlotNum) > GetTickCount Then Exit Sub
 
    ' Spell Types
        Select Case Spell(SpellNum).Type
            ' AOE Healing Spells
            Case SPELL_TYPE_HEALHP
            ' Make sure an npc waits for the spell to cooldown
            MaxHeals = 1 + Npc(MapNpc(mapnum).Npc(MapNpcNum).Num).Stat(Stats.intelligence) \ 25
            If MapNpc(mapnum).Npc(MapNpcNum).Heals >= MaxHeals Then Exit Sub
                If MapNpc(mapnum).Npc(MapNpcNum).Vital(Vitals.HP) <= Npc(MapNpc(mapnum).Npc(MapNpcNum).Num).HP * 0.3 Then
                    If Spell(SpellNum).IsAoE Then
                        For i = 1 To MAX_MAP_NPCS
                            If MapNpc(mapnum).Npc(i).Num > 0 Then
                                If MapNpc(mapnum).Npc(i).Vital(Vitals.HP) > 0 Then
                                    If isInRange(Spell(SpellNum).AoE, MapNpc(mapnum).Npc(MapNpcNum).x, MapNpc(mapnum).Npc(MapNpcNum).y, MapNpc(mapnum).Npc(i).x, MapNpc(mapnum).Npc(i).y) Then
                                        InitDamage = Spell(SpellNum).Vital + (Npc(MapNpc(mapnum).Npc(MapNpcNum).Num).Stat(Stats.intelligence) / 2)
                 
                                        MapNpc(mapnum).Npc(i).Vital(Vitals.HP) = MapNpc(mapnum).Npc(i).Vital(Vitals.HP) + InitDamage
                                        SendActionMsg mapnum, "+" & InitDamage, BrightGreen, 1, (MapNpc(mapnum).Npc(i).x * 32), (MapNpc(mapnum).Npc(i).y * 32)
                                        Call SendAnimation(mapnum, Spell(SpellNum).SpellAnim, 0, 0, TARGET_TYPE_NPC, MapNpcNum)
                 
                                        If MapNpc(mapnum).Npc(i).Vital(Vitals.HP) > Npc(MapNpc(mapnum).Npc(i).Num).HP Then
                                            MapNpc(mapnum).Npc(i).Vital(Vitals.HP) = Npc(MapNpc(mapnum).Npc(i).Num).HP
                                        End If
                 
                                        MapNpc(mapnum).Npc(MapNpcNum).Heals = MapNpc(mapnum).Npc(MapNpcNum).Heals + 1
                 
                                        MapNpc(mapnum).Npc(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(SpellNum).CDTime * 1000
                                        Exit Sub
                                    End If
                                End If
                            End If
                        Next
                    Else
                    ' Non AOE Healing Spells
                        InitDamage = Spell(SpellNum).Vital + (Npc(MapNpc(mapnum).Npc(MapNpcNum).Num).Stat(Stats.intelligence) / 2)
                 
                        MapNpc(mapnum).Npc(MapNpcNum).Vital(Vitals.HP) = MapNpc(mapnum).Npc(MapNpcNum).Vital(Vitals.HP) + InitDamage
                        SendActionMsg mapnum, "+" & InitDamage, BrightGreen, 1, (MapNpc(mapnum).Npc(MapNpcNum).x * 32), (MapNpc(mapnum).Npc(MapNpcNum).y * 32)
                        Call SendAnimation(mapnum, Spell(SpellNum).SpellAnim, 0, 0, TARGET_TYPE_NPC, MapNpcNum)
                 
                        If MapNpc(mapnum).Npc(MapNpcNum).Vital(Vitals.HP) > Npc(MapNpc(mapnum).Npc(MapNpcNum).Num).HP Then
                            MapNpc(mapnum).Npc(MapNpcNum).Vital(Vitals.HP) = Npc(MapNpc(mapnum).Npc(MapNpcNum).Num).HP
                        End If
                 
                        MapNpc(mapnum).Npc(MapNpcNum).Heals = MapNpc(mapnum).Npc(MapNpcNum).Heals + 1
                 
                        MapNpc(mapnum).Npc(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(SpellNum).CDTime * 1000
                        Exit Sub
                    End If
                End If
             
            ' AOE Damaging Spells
            Case SPELL_TYPE_DAMAGEHP
            ' Make sure an npc waits for the spell to cooldown
                If Spell(SpellNum).IsAoE Then
                    For i = 1 To Player_HighIndex
                        If IsPlaying(i) Then
                            If GetPlayerMap(i) = mapnum Then
                                If isInRange(Spell(SpellNum).AoE, MapNpc(mapnum).Npc(MapNpcNum).x, MapNpc(mapnum).Npc(MapNpcNum).y, GetPlayerX(i), GetPlayerY(i)) Then
                                    InitDamage = Spell(SpellNum).Vital + (Npc(MapNpc(mapnum).Npc(MapNpcNum).Num).Stat(Stats.intelligence) / 2)
                                    Damage = InitDamage - Player(i).Stat(Stats.willpower)
                                        If Damage <= 0 Then
                                            SendActionMsg GetPlayerMap(i), "RESIST!", Pink, 1, (GetPlayerX(i) * 32), (GetPlayerY(i) * 32)
                                            Exit Sub
                                        Else
                                            NpcAttackPlayer MapNpcNum, i, Damage
                                            SendAnimation mapnum, Spell(SpellNum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, MapNpcNum
                                            MapNpc(mapnum).Npc(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(SpellNum).CDTime * 1000
                                            Exit Sub
                                        End If
                                End If
                            End If
                        End If
                    Next
                ' Non AoE Damaging Spells
                Else
                    If isInRange(Spell(SpellNum).Range, MapNpc(mapnum).Npc(MapNpcNum).x, MapNpc(mapnum).Npc(MapNpcNum).y, GetPlayerX(Victim), GetPlayerY(Victim)) Then
                    InitDamage = Spell(SpellNum).Vital + (Npc(MapNpc(mapnum).Npc(MapNpcNum).Num).Stat(Stats.intelligence) / 2)
                    Damage = InitDamage - Player(Victim).Stat(Stats.willpower)
                        If Damage <= 0 Then
                            SendActionMsg GetPlayerMap(Victim), "RESIST!", Pink, 1, (GetPlayerX(Victim) * 32), (GetPlayerY(Victim) * 32)
                            Exit Sub
                        Else
                            NpcAttackPlayer MapNpcNum, Victim, Damage
                            SendAnimation mapnum, Spell(SpellNum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, Victim
                            MapNpc(mapnum).Npc(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(SpellNum).CDTime * 1000
                            Exit Sub
                        End If
                    End If
                End If
            End Select
End Sub


No modServerLoop
Procure por isso e delete

Código:
Else
                            ' lol no npc combat :(
                        End If


Agora Procure no mesmo mod
Código:

 ' ////////////////////////////////////////////
      ' // This is used for regenerating NPC's HP //
      ' ////////////////////////////////////////////


Acima disso adcione

Código:
' Spell Casting
                                For i = 1 To MAX_NPC_SPELLS
                                    If Npc(npcNum).Spell(i) > 0 Then
                                        If MapNpc(mapnum).Npc(x).SpellTimer(i) + (Spell(Npc(npcNum).Spell(i)).CastTime * 1000) < GetTickCount Then
                                            NpcSpellPlayer x, target, i
                                        End If
                                    End If
                                Next
                            End If


Acabou o Lado do Servidor salve e compile ^.^

Vamos para o Client agora.
Abra o seu CLIENT.VBP

Vá em modConstants
Procure por

Código:
Public Const MAX_PARTY_MEMBERS As Long = 4


Logo abaixo adcione

Código:
Public Const MAX_NPC_SPELLS As Long = 5


Agora vamos para o modTypes
Procure por Private Type NpcRec
Entre o Private Type NpcRec e oEnd TypeAdcione

Código:
Spell(1 To MAX_NPC_SPELLS) As Long


Vá para modGameEditors
Procure por Public Sub NpcEditorInit
Ache esta linha

Código:
.txtDamage.text = Npc(EditorIndex).Damage


Logo abaixo disso adcione

Código:
.scrlSpellNum.Max = MAX_NPC_SPELLS
        .scrlSpellNum.Value = 1


agora baixe esses 2 arquivos e os adcione no seu projeto
[Tens de ter uma conta e sessão iniciada para poderes visualizar este link]

Ai é só vc salvar e compilar.


Creditos:
SkyAway
Eu por postar aqui

ótimo tutorial se gostou de cred ^^

[code]
KingSora
KingSora
Moderador Global
Moderador Global

Mensagens : 102
Cash : 38
Créditos : 11
Data de inscrição : 25/08/2012
Idade : 24
Localização : Itajuba

Ir para o topo Ir para baixo

[Tutorial]NPC Atacando com SPELL EO 2.0 Empty Re: [Tutorial]NPC Atacando com SPELL EO 2.0

Mensagem por ~FullzDied Ter Ago 28, 2012 1:28 pm

Aew ta dando erro na parte spell casting no servidor da ultima parte quando compilo pq?
~FullzDied
~FullzDied
Moderador Local
Moderador Local

Mensagens : 59
Cash : 2
Créditos : 2
Data de inscrição : 26/08/2012
Idade : 23
Localização : Minha Casa - RJ

https://tutorpg.forumeiro.com/

Ir para o topo Ir para baixo

[Tutorial]NPC Atacando com SPELL EO 2.0 Empty Re: [Tutorial]NPC Atacando com SPELL EO 2.0

Mensagem por KingSora Ter Ago 28, 2012 6:26 pm

Tente deletar ou colocar o nome no meio.
KingSora
KingSora
Moderador Global
Moderador Global

Mensagens : 102
Cash : 38
Créditos : 11
Data de inscrição : 25/08/2012
Idade : 24
Localização : Itajuba

Ir para o topo Ir para baixo

[Tutorial]NPC Atacando com SPELL EO 2.0 Empty Re: [Tutorial]NPC Atacando com SPELL EO 2.0

Mensagem por Conteúdo patrocinado


Conteúdo patrocinado


Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

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