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


2 participantes

    Trabalhando com Auto-Ataque

    Valentine
    Valentine
    Administrador
    Administrador


    Medalhas : Trabalhando com Auto-Ataque ZgLkiRU
    Mensagens : 5336
    Créditos : 1163

    Trabalhando com Auto-Ataque Empty Trabalhando com Auto-Ataque

    Mensagem por Valentine Dom Ago 26, 2012 3:18 pm

    Valentine
    Eu vi este tutorial postado originalmente no touchofdeath, ele tinha alguns bugs, estava incompleto e só funcionava com npcs, então eu o completei.

    Deathbeam
    Este tutorial vai fazer o seguinte: Se você tem alvo e está de frente para o mesmo, o jogador irá atacá-lo automaticamente até matar.

    LADO CLIENTE

    Em frmMain, na picOptions criar
    Checkbox
    Name: chkAutoAttack
    Caption: Auto Ataque

    Então, em modGameLogic encontre isto:
    Código:
    Dim tmr10000 As Long

    Embaixo adicione:
    Código:
    Dim x As Long, y As Long

    Agora procure por:
    Código:
                If CanMoveNow Then
                    Call CheckMovement ' Check if player is trying to move
                    Call CheckAttack  ' Check to see if player is trying to attack
                End If

    Substitua por isto:
    Código:
                If frmMain.chkAutoAttack.Value = YES Then
                    If CanMoveNow Then
                        Select Case Player(MyIndex).Dir
                            Case DIR_UP
                                X = GetPlayerX(MyIndex)
                                y = GetPlayerY(MyIndex) - 1
                            Case DIR_DOWN
                                X = GetPlayerX(MyIndex)
                                y = GetPlayerY(MyIndex) + 1
                            Case DIR_LEFT
                                X = GetPlayerX(MyIndex) - 1
                                y = GetPlayerY(MyIndex)
                            Case DIR_RIGHT
                                X = GetPlayerX(MyIndex) + 1
                                y = GetPlayerY(MyIndex)
                        End Select
                        If myTargetType = TARGET_TYPE_NPC Then
                            If X = MapNpc(myTarget).X And y = MapNpc(myTarget).y Then ControlDown = True
                        ElseIf myTargetType = TARGET_TYPE_PLAYER Then
                            If X = Player(myTarget).X And y = Player(myTarget).y Then ControlDown = True
                        End If
                        Call CheckMovement ' Check if player is trying to move
                        Call CheckAttack  ' Check to see if player is trying to attack
                    End If
                Else
                    If CanMoveNow Then
                        Call CheckMovement ' Check if player is trying to move
                        Call CheckAttack  ' Check to see if player is trying to attack
                    End If
                End If

    Créditos:
    Deathbeam (Por ser o criador original do tutorial)
    Valentine (Por corrigir alguns erros do tutorial, traduzir e postar aqui)
    avatar
    FFogomax
    Experiente
    Experiente


    Mensagens : 557
    Créditos : 37

    Trabalhando com Auto-Ataque Empty Re: Trabalhando com Auto-Ataque

    Mensagem por FFogomax Dom Ago 26, 2012 3:52 pm

    Olha quem voltou. Razz
    Ótimo tutorial. Posso te chamar de Marlos? Não acostumei com o Valentine.
    Eu que estou entrando na área de EO preciso de uns tutoriais assim. +Credit Razz

      Data/hora atual: Qua maio 15, 2024 7:12 pm