Anime Dreams
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

[Script] Ataque avanzado

Ir abajo

[Script] Ataque avanzado Empty [Script] Ataque avanzado

Mensaje por oty5198 Dom Dic 13, 2009 6:22 pm

Autor: ryono
Adaptado por: Stream
Descripción: Con este script el
ataque cuerpo a cuerpo ya sea con armas o sin ellas será mas dinamico,
pudiendo configurarlo. Obtendras estas funcionalidades:

- 3 Diferentes efectos de sonido para las animaciones de "golpear", "fallar" y "critico".
- Daño aleatorio, no siempre se hara el mismo daño.
- Golpes Criticos.
- Posibilidad de que el jugador falle el golpe.
- El objetivo que recibe el daño se defendera en ocasiones.


Instalación:

Abrir vuestro main.txt y abajo del todo añadir el siguiente SUB:


Código:

Sub damagecommand(index, high, low, hitrate, critrate, hitanimation,
missanimation, critanimation, hitsound, misssound, critsound)
  Dim Str
  Dim dmg
  Dim playerdef
  Dim npcdef
  Dim critdmg
  Dim hitchance
  Dim critchance
  Dim target
  Dim npcnum
  Dim playerx
  Dim playery
  Dim npcx
  Dim npcy
  Dim dir
  Dim targettype
  Dim playertargetx
  Dim playertargety

  Str = GetPlayerSTR(index)
 
  If low < 0 Then
      low = 0
  End If
 
  If hitrate < 0 Then
      hitrate = 0
  End If
  If hitrate > 100 Then
      hitrate = 100
  End If
 
  critdmg = high / 4
 
  If critrate > 100 Then
      critrate = 100
  End If
  If critrate < 0 Then
      critrate = 0
  End If
 
  critchance = Rand(0, 100)
  hitchance = Rand(0, 100)
 
  If int(GetPlayerTarget(index)) > 0 Then
      target = GetPlayerTarget(index)
      targettype = 1
      playertargetx = GetPlayerX(target)
      playertargety = GetPlayerY(target)
      If hitchance <= hitrate Then
        playerdef = GetPlayerDEF(target)
        dmg = (Rand(low, high) + (Str * 2)) - (playerdef * 5)
      Else
        dmg = 0
        playertargetx = GetPlayerX(target)
        playertargety = GetPlayerY(target)
      End If
  ElseIf int(GetPlayerTarget(index)) = 0 Then
      dmg = 0
      npcx = 0
      npcy = 0
      npcnum = 0
      npcdef = 0
      playertargetx = 0
      playertargety = 0
  Else
      target = GetPlayerTargetNpc(index)
      targettype = 0
      If hitchance <= hitrate Then
        npcnum = GetPlayerTargetNpc(index)
        npcdef = GetNpcDefense(npcnum)
        dmg = (Rand(low, high) + (Str * 2)) - (npcdef * 5)
        npcx = GetNpcX(GetPlayerMap(index), npcnum)
        npcy = GetNpcY(GetPlayerMap(index), npcnum)
      Else
        dmg = 0
        npcnum = GetPlayerTargetNpc(index)
        npcx = GetNpcX(GetPlayerMap(index), npcnum)
        npcy = GetNpcY(GetPlayerMap(index), npcnum)
        npcdef = GetNpcDefense(npcnum)
      End If
  End If
 
  playerx = GetPlayerX(index)
  playery = GetPlayerY(index)
  dir = GetPlayerDir(index)
 
 
 
  If dir = 0 Then
      If playerx = npcx Or playerx = playertargetx Then
        If playery = npcy + 1 Or playery = playertargety + 1 Then
            If critchance <= critrate Then
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "2")
              dmg = high + Rand(0, critdmg)
            Else
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "1")
            End If
            If targettype = 1 Then
              Call DamagePlayer(index, target, dmg)
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "1")
            Else
              Call DamageNPC(index, target, dmg)
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "1")
            End If
        End If
      End If
  ElseIf dir = 1 Then
      If playerx = npcx Or playerx = playertargetx Then
        If playery = npcy - 1 Or playery = playertargety - 1 Then
            If critchance <= critrate Then
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "2")
              dmg = high + Rand(0, critdmg)
            Else
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "1")
            End If
            If targettype = 1 Then
              Call DamagePlayer(index, target, dmg)
            Else
              Call DamageNPC(index, target, dmg)
            End If
        End If
      End If
  ElseIf dir = 2 Then
      If playerx = npcx + 1 Or playerx = playertargetx + 1 Then
        If playery = npcy Or playery = playertargety Then
            If critchance <= critrate Then
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "2")
              dmg = high + Rand(0, critdmg)
            Else
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "1")
            End If
            If targettype = 1 Then
              Call DamagePlayer(index, target, dmg)
            Else
              Call DamageNPC(index, target, dmg)
            End If
        End If
      End If
  Else
      If playerx = npcx - 1 Or playerx = playertargetx - 1 Then
        If playery = npcy Or playery = playertargety Then
            If critchance <= critrate Then
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "2")
              dmg = high + Rand(0, critdmg)
            Else
              Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "1")
            End If
            If targettype = 1 Then
              Call DamagePlayer(index, target, dmg)
            Else
              Call DamageNPC(index, target, dmg)
            End If
        End If
      End If
  End If
 
  If dmg = 0 Then
      Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "0")
  End If

  If GetVar("Daño.ini", "DAÑO", GetPlayerName(index)) = "2" Then
      Call attackanimation(index, critanimation)
      Call PlaySound(index, critsound)
  ElseIf GetVar("Daño.ini", "DAÑO", GetPlayerName(index)) = "1" Then
      Call attackanimation(index, hitanimation)
      Call PlaySound(index, hitsound)
  Else
      Call attackanimation(index, missanimation)
      Call PlaySound(index, misssound)
  End If
 
  Call PutVar("Daño.ini", "DAÑO", GetPlayerName(index), "0")
End Sub

Sub attackanimation(index, animation)
  Dim map
  Dim playerx
  Dim playery
  Dim dir

  map = GetPlayerMap(index)
  playerx = GetPlayerX(index)
  playery = GetPlayerY(index)
  dir = GetPlayerDir(index)

  If dir = 0 Then
      Call SpellAnim(animation, map, playerx, playery - 1)
  ElseIf dir = 1 Then
      Call SpellAnim(animation, map, playerx, playery + 1)
  ElseIf dir = 2 Then
      Call SpellAnim(animation, map, playerx - 1, playery)
  Else
      Call SpellAnim(animation, map, playerx + 1, playery)
  End If
End Sub


Ahora en la misma carpeta que vuestro main.txt (siempre dentro de scripts) crea el archivo Daño.ini, ahora abrelo y pega esto en la primera linea:

Código:

[DAÑO]

Ahora guardalo y cierralo. Ya está todo.

Ahora para llamar a el sub, normalmente se suele añadir lo siguiente en el Sub OnAttack:

Código:

call damagecommand(index, high, low, hitrate, critrate, hitanimation,
missanimation, critanimation, hitsound, misssound, critsound)

Menos el Index todo debe ser modificado por números.

Significado:

index = el indice del jugador.
high = maxima cantidad de daño que puedes hacer(sin la redución de defensa)
low = minima cantidad de daño que puedes hacer(sin la redución de defensa)
hitrate = posibilidad de golpear a tu objetivo (maximo 100)
critrate = posibilidad de realizar un critico a tu objetivo (maximo 100)
hitanimation = animación que se usara cuando golpees.
missanimation = animación que se usara cuando falles tu golpe.
critanimation = animación cuando golpees con un critico.
hitsound = sonido para cuando golpeas.
misssound = sonido para cuando fallas.
critsound = sonido para critico.

Un saludo.
oty5198
oty5198
Administrador
Administrador

Mensajes : 117
Puntos : 441
Reputación : 38
Fecha de inscripción : 29/03/2009
Advertencia :
[Script] Ataque avanzado Left_bar_bleue0 / 1000 / 100[Script] Ataque avanzado Right_bar_bleue



Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.