GS-Zone

Inteligencia Artificial (BOTS) Ir al Indice

Moderadores: Moderadores de Argentum, Especialistas de Argentum, Especialistas de Programación

24

Nota » 01 Feb 2012 06:21

Bueno aca les dejo esta mini IA qe arme en un ratito :P

agregan en 1 modulo

  1. Option Explicit
  2.  
  3. 'Numero del npc que hay que clikear.
  4. Public Const IA_NPC     As Integer = 80
  5.  
  6. 'Defensa del bot jeje
  7.  
  8. Private Const IA_MINDEF  As Integer = 10
  9. Private Const IA_MAXDEF  As Integer = 12
  10.  
  11. 'Mapa donde spawnea.
  12. Private Const IA_MAP     As Integer = 16
  13. Private Const IA_X       As Byte = 50
  14. Private Const IA_Y       As Byte = 50
  15.  
  16. 'Posiciones donde cae el user
  17.  
  18. Private Const IA_USERX   As Byte = 44
  19. Private Const IA_USERY   As Byte = 33
  20.  
  21. 'Nombre del char
  22.  
  23. Private Const IA_NAME    As String = "el putisimo dios maTih.-"
  24.  
  25. 'Te da oro al matarlo
  26.  
  27. Private Const IA_PREMIO    As Long = 100000
  28.  
  29. 'Charindex reservado.
  30.  
  31. Private Const IA_CHAR    As Integer = 9999
  32.  
  33. 'STATS
  34.  
  35. Private Const IA_HP      As Integer = 400
  36. Private Const IA_MAN     As Integer = 2000
  37.  
  38. 'Datos del char
  39.  
  40. '/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
  41.  
  42. 'ATENCION : Acá van los números de objetos!!!
  43.  
  44. Private Const IA_HEAD    As Integer = 4
  45. Private Const IA_BODY    As Integer = 485
  46.  
  47. Private Const IA_WEAPON  As Integer = 660
  48. Private Const IA_SHIELD  As Integer = 404
  49. Private Const IA_HELMET  As Integer = 405
  50.  
  51. 'ATENCION : Acá van los números de objetos!!!
  52.  
  53. '/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
  54.  
  55. 'Cantidad de hechizos que lanza
  56.  
  57. Private Const IA_M_SPELL As Byte = 2
  58.  
  59. 'Constantes de intervalos.
  60.  
  61. Private Const IA_SINT   As Integer = 1000  'Intervalo entre hechizo-hechizo.
  62. Private Const IA_SREMO  As Integer = 300    'Intervalo remo.
  63. Private Const IA_MOVINT As Integer = 240    'Intervalo caminta.
  64. Private Const IA_USEOBJ As Integer = 200    'Intervalo usar potas.
  65.  
  66. 'Probabilidades de que te pegue
  67.  
  68. Private Const IA_CASTEO As Byte = 77
  69.  
  70. Type ia_Interval
  71.      SpellCount         As Byte         'Intervalo para tirar hechizos.
  72.      UseItemCount       As Byte         'Intervalo para usar pociones.
  73.      MoveCharCount      As Byte         'Intervalo para mover el char.
  74.      ParalizisCount     As Byte         'Intervalo para removerse.
  75. End Type
  76.  
  77. Type ia_Spells
  78.      DamageMin          As Byte         'Minimo daño que hace.
  79.      DamageMax          As Byte         'Maximo daño que hace.
  80.      spellIndex         As Byte         'Lo usamos para el fx.
  81. End Type
  82.  
  83. Type Bot
  84.      Pos                As WorldPos     'Posicion en el mundo.
  85.      Vida               As Integer      'Vida del bot.
  86.      Mana               As Integer      'Mana del bot.
  87.      Char               As Char         'Apariencia.
  88.      Invocado           As Boolean      'Si existe.
  89.      Paralizado         As Boolean      'Si está inmo.
  90.      UserIndex          As Integer      'Usuario peleando con el bot.
  91.      Intervalos         As ia_Interval  'Intervalos de acciones.
  92. End Type
  93.  
  94. Public ia_Bot                           As Bot
  95. Public ia_spell(1 To IA_M_SPELL)       As ia_Spells
  96.  
  97. Sub ia_CreateChar(ByVal UserIndex As Integer)
  98.  
  99. ' @designer     :  maTih.-
  100. ' @date         :  2012/02/01
  101.  
  102. With ia_Bot.Char
  103.  
  104.     .body = ObjData(IA_BODY).Ropaje
  105.     .Head = IA_HEAD
  106.     .WeaponAnim = ObjData(IA_WEAPON).WeaponAnim
  107.     .ShieldAnim = ObjData(IA_WEAPON).ShieldAnim
  108.     .CascoAnim = ObjData(IA_HELMET).CascoAnim
  109.  
  110.     WriteCharacterCreate UserIndex, .body, .Head, eHeading.NORTH, IA_CHAR, IA_X, IA_Y, .WeaponAnim, .ShieldAnim, 0, 0, .CascoAnim, IA_NAME, 0, 0
  111.      
  112. End With
  113.  
  114. End Sub
  115.  
  116. Sub ia_Spawn(ByVal UserIndex As Integer)
  117.  
  118. ' @designer     :  maTih.-
  119. ' @date         :  2012/02/01
  120.  
  121. With ia_Bot
  122.    
  123.     WarpUserChar UserIndex, IA_MAP, IA_USERX, IA_USERY, True
  124.    
  125.     .Invocado = True
  126.    
  127.     .Mana = IA_MAN
  128.     .Vida = IA_HP
  129.    
  130.     .UserIndex = UserIndex
  131.    
  132.     .Paralizado = False
  133.    
  134.     .Pos.Map = IA_MAP
  135.     .Pos.X = IA_X
  136.     .Pos.Y = IA_Y
  137.    
  138.     ia_CreateChar UserIndex
  139.    
  140.     ia_Action
  141.    
  142.     frmMain.timerIA.Enabled = True
  143.    
  144.     WriteChatOverHead UserIndex, "VENI PUTO VENI ! ejejje", IA_CHAR, vbCyan
  145.    
  146.     .Intervalos.SpellCount = 100
  147.    
  148. End With
  149.  
  150. End Sub
  151.  
  152. Sub ia_Spells()
  153.  
  154. ' @designer     :  maTih.-
  155. ' @date         :  2012/02/01
  156.  
  157. 'Un poco hardcodeado pero bueno :D
  158.  
  159. 'Hechizo 1 : descarga.
  160. ia_spell(1).DamageMax = 120
  161. ia_spell(1).DamageMax = 177
  162. ia_spell(1).spellIndex = 23
  163.  
  164. 'Hechizo 2 : apoca
  165.  
  166. ia_spell(2).DamageMin = 190
  167. ia_spell(2).DamageMax = 220
  168. ia_spell(2).spellIndex = 25
  169.  
  170. End Sub
  171.  
  172. Sub ia_MoveChar(ByRef hError As Boolean)
  173.  
  174. ' @designer     :  maTih.-
  175. ' @date         :  2012/02/01
  176.  
  177. With ia_Bot
  178.  
  179.     Dim nRandom     As Byte
  180.    
  181.     '25% De probabilidades de moverse a
  182.     'cualquiera de las cuatro direcciones.
  183.    
  184.     nRandom = RandomNumber(1, 4)
  185.    
  186.     Select Case nRandom
  187.    
  188.            Case 1
  189.            
  190.            If ia_LegalPos(.Pos.X + 1, .Pos.Y) = False Then hError = True: Exit Sub
  191.            
  192.            .Pos.X = .Pos.X + 1
  193.            
  194.            Case 2
  195.            
  196.            If ia_LegalPos(.Pos.X - 1, .Pos.Y) = False Then hError = True: Exit Sub
  197.            
  198.            .Pos.X = .Pos.X - 1
  199.            
  200.            Case 3
  201.            
  202.            If ia_LegalPos(.Pos.X, .Pos.Y + 1) = False Then hError = True: Exit Sub
  203.            
  204.            .Pos.Y = .Pos.Y + 1
  205.            
  206.            Case 4
  207.            
  208.            If ia_LegalPos(.Pos.X, .Pos.Y - 1) = False Then hError = True: Exit Sub
  209.            
  210.            .Pos.Y = .Pos.Y - 1
  211.    
  212.     End Select
  213.  
  214. End With
  215.  
  216. End Sub
  217.  
  218. Function ia_LegalPos(ByVal X As Byte, ByVal Y As Byte) As Boolean
  219.  
  220. ' @designer     :  maTih.-
  221. ' @date         :  2012/02/01
  222. ' @modificated  :  Esta función ya no trabaja con la pos del npc si no que ahora usa los parámetros.
  223.  
  224. ia_LegalPos = False
  225.  
  226. With MapData(IA_MAP, X, Y)
  227.  
  228.      '¿Es un mapa valido?
  229.     If (IA_MAP <= 0 Or IA_MAP > NumMaps) Or (X < MinXBorder Or X > MaxXBorder Or Y < MinYBorder Or Y > MaxYBorder) Then Exit Function
  230.  
  231.      'Tile bloqueado?
  232.      If .Blocked <> 0 Then Exit Function
  233.    
  234.      'Hay un usuario?
  235.      If .UserIndex > 0 Then
  236.         'Si no es un adminInvisible entonces nos vamos.
  237.         If UserList(.UserIndex).flags.AdminInvisible <> 1 Then Exit Function
  238.     End If
  239.  
  240.     'Hay un NPC?
  241.     if .NpcIndex <> 0 then exit function
  242.    
  243.     'Válido para evitar el rango Y pero no su eje X.
  244.     If Abs(Y - UserList(ia_Bot.UserIndex).Pos.Y) > RANGO_VISION_Y Then Exit Function
  245.    
  246.     If Abs(X - UserList(ia_Bot.UserIndex).Pos.X) > RANGO_VISION_X Then Exit Function
  247.    
  248.      ia_LegalPos = True
  249.    
  250. End With
  251.  
  252. End Function
  253.  
  254. Sub ia_Action()
  255.  
  256. ' @designer     :  maTih.-
  257. ' @date         :  2012/02/01
  258.  
  259. Dim pIndex      As Integer
  260. Dim sRandom     As Byte
  261. Dim rMan        As Integer
  262. Dim foundErr    As Boolean
  263.  
  264. With ia_Bot
  265.  
  266.     pIndex = .UserIndex
  267.        
  268.     'ilógico que pase..
  269.     If pIndex <= 0 Then Exit Sub
  270.  
  271.     'Contadores de intervalo.
  272.     ia_CheckInts
  273.    
  274.     'Si se puede mover AND no está inmo se mueve al azar.
  275.     If .Intervalos.MoveCharCount = 0 And .Paralizado = False Then
  276.        
  277.         ia_MoveChar foundErr
  278.        
  279.         If foundErr Then Exit Sub
  280.        
  281.         'NEW--------
  282.         'Checkeo si es una posición válida.
  283.  
  284.         'Actualizamos solamente el cliente del usuario.
  285.         WriteCharacterMove pIndex, IA_CHAR, .Pos.X, .Pos.Y
  286.        
  287.         'Testeo
  288.        
  289.         .Intervalos.MoveCharCount = (IA_MOVINT / 40)
  290.    
  291.     End If
  292.    
  293.    
  294.     'STATS..
  295.    
  296.         'Prioriza la vida ante todo
  297.        
  298.         If .Vida < IA_HP Then
  299.            
  300.             'Checkeo el intervalo.
  301.             If .Intervalos.UseItemCount > 0 Then Exit Sub
  302.            
  303.             'Recupera 30 cada 200 ms.
  304.             .Vida = .Vida + 30
  305.            
  306.             If .Vida > IA_HP Then .Vida = IA_HP
  307.            
  308.             'Uso la poción, seteo el interval
  309.             .Intervalos.UseItemCount = (IA_USEOBJ / 40)
  310.            
  311.             Exit Sub
  312.         End If
  313.        
  314.         'Si tenia la vida llena usa azules.
  315.        
  316.         If .Mana < IA_MAN Then
  317.        
  318.             'Checkeo el intervalo.
  319.            
  320.             If .Intervalos.UseItemCount = 0 Then
  321.        
  322.                 'Recupera el 3% de la mana.
  323.                 .Mana = .Mana + Porcentaje(IA_MAN, 3)
  324.            
  325.                 If .Mana > IA_MAN Then .Mana = IA_MAN
  326.            
  327.             .Intervalos.UseItemCount = (IA_USEOBJ / 40)
  328.  
  329.             End If
  330.            
  331.             'Hacer una constante después, con esto hacemos un random
  332.             'Para que azulee y combee a la ves.
  333.             If RandomNumber(1, 4) < 4 Then Exit Sub
  334.         End If
  335.    
  336.     'Bueno si está acá es por que tenia la vida y mana llenas.
  337.    
  338.     'Puede castear?
  339.    
  340.     If .Intervalos.SpellCount = 0 Then
  341.        'Feo, aunque digamos que solo hace apoca desc remo
  342.        'Así que va a andar bien.
  343.        
  344.        'Si la mana es < a 300 [gasto del remo] no hacemos nada.
  345.        
  346.        If .Mana < 300 Then Exit Sub
  347.        
  348.        'Si está paralizado prioriza removerse.
  349.        
  350.         If .Paralizado Then
  351.        
  352.             WriteChatOverHead pIndex, Hechizos(10).PalabrasMagicas, IA_CHAR, vbCyan
  353.            
  354.             .Paralizado = False
  355.            
  356.             'Agrego esto por que si no tirarle inmo era al pedo
  357.             'Seguia caminando practicamente :PP
  358.            
  359.             .Intervalos.ParalizisCount = (IA_SREMO / 40)
  360.            
  361.             'Se removió entonces salimos del sub y seteamos el intervalo
  362.            
  363.             .Intervalos.SpellCount = (IA_SINT / 40)
  364.            
  365.             Exit Sub
  366.            
  367.         End If
  368.        
  369.         'No está paralizado entonces castea un hechizo random.
  370.        
  371.         'Si, es un robot, pero puede manquear no?
  372.        
  373.         If RandomNumber(1, 100) > IA_CASTEO Then Exit Sub
  374.        
  375.         sRandom = RandomNumber(1, IA_M_SPELL)
  376.        
  377.         'Si no llega con la mana del hechizo AND la del otro
  378.         'tampoco entonces no hacemos nada
  379.        
  380.         If sRandom = 1 Then
  381.            
  382.             'Si no llega a la mana del spell 1 (descarga)
  383.             'No hacemos nada ya que tampoco llega
  384.             'al apocalipsis.
  385.            
  386.             rMan = Hechizos(ia_spell(1).spellIndex).ManaRequerido
  387.            
  388.             If rMan > .Mana Then Exit Sub
  389.            
  390.         ElseIf sRandom = 2 Then
  391.        
  392.             rMan = Hechizos(ia_spell(2).spellIndex).ManaRequerido
  393.                
  394.             'Pero si es spell 2 (apoca) AND llegamos
  395.             'con la mana para descarga, entonces
  396.             'Seteamos sRandom como 1 y casteamos
  397.             'descarga.
  398.            
  399.             If rMan > .Mana Then
  400.                
  401.                 'Modifico la formula y hago un random
  402.                 'Dado a que una ves que queda en -1000 de mana
  403.                 'Nunca más tira apoca y castea puras descargas.
  404.                
  405.                 If .Mana > 460 And RandomNumber(1, 100) < 50 Then
  406.                
  407.                     sRandom = 1
  408.                
  409.                 Else
  410.                
  411.                     Exit Sub
  412.                    
  413.                 End If
  414.            
  415.             End If
  416.        
  417.         rMan = Hechizos(ia_spell(sRandom).spellIndex).ManaRequerido
  418.        
  419.         'Descontamos la maná y seteamos el intervalo.
  420.        
  421.         .Mana = .Mana - rMan
  422.        
  423.         .Intervalos.SpellCount = (IA_SINT / 20) 'Se chekea cada 40 ms.
  424.        
  425.         'Creamos el fx y le descontamos la vida al usuario.
  426.        
  427.         WriteCreateFX pIndex, UserList(pIndex).Char.CharIndex, Hechizos(ia_spell(sRandom).spellIndex).FXgrh, Hechizos(ia_spell(sRandom).spellIndex).loops
  428.        
  429.         WriteChatOverHead pIndex, Hechizos(ia_spell(sRandom).spellIndex).PalabrasMagicas, IA_CHAR, vbCyan
  430.        
  431.         'Random damage :D
  432.        
  433.         sRandom = RandomNumber(ia_spell(sRandom).DamageMin, ia_spell(sRandom).DamageMax)
  434.        
  435.         'Quitamos daño.
  436.        
  437.         UserList(pIndex).Stats.MinHp = UserList(pIndex).Stats.MinHp - sRandom
  438.        
  439.         'Check si muere.
  440.        
  441.         If UserList(pIndex).Stats.MinHp <= 0 Then
  442.        
  443.             UserDie pIndex
  444.            
  445.             ia_EraseChar
  446.            
  447.         End If
  448.        
  449.         'Actualizamos el cliente.
  450.        
  451.         WriteUpdateHP pIndex
  452.        
  453.     End If
  454.    
  455. End If
  456. End With
  457.  
  458. End Sub
  459.  
  460. Function ia_Check(ByVal UserIndex As Integer, ByVal X As Byte, ByVal Y As Byte) As Boolean
  461.  
  462. ' @designer     :  maTih.-
  463. ' @date         :  2012/02/01
  464.  
  465. With ia_Bot
  466.  
  467. If .Invocado Then
  468.     If .UserIndex = UserIndex Then
  469.         If .Pos.X = X And .Pos.Y = Y Then
  470.             ia_Check = True
  471.             UserList(UserIndex).flags.TargetBOT = True
  472.             WriteConsoleMsg UserIndex, "Ves a " & IA_NAME & " [BOT]", FontTypeNames.FONTTYPE_CITIZEN
  473.             Exit Function
  474.         End If
  475.     End If
  476. End If
  477.  
  478. ia_Check = False
  479.  
  480. End With
  481.  
  482. End Function
  483.  
  484. Sub ia_UserDamage(ByVal Spell As Byte)
  485.  
  486. ' @designer     :  maTih.-
  487. ' @date         :  2012/02/01
  488.  
  489. Dim rMan     As Integer
  490. Dim damage   As Integer
  491. Dim usedFont As FontTypeNames
  492.  
  493. usedFont = FontTypeNames.FONTTYPE_CITIZEN
  494.  
  495. 'Checkeo que el hechizo no sea 0.
  496. If Not Spell <> 0 Then Exit Sub
  497.  
  498. With UserList(ia_Bot.UserIndex)
  499.  
  500.     rMan = Hechizos(Spell).ManaRequerido
  501.    
  502.     'Llega con la mana?
  503.    
  504.     If rMan > .Stats.MinMAN Then
  505.         WriteConsoleMsg ia_Bot.UserIndex, "No tienes suficiente mana!", usedFont
  506.         Exit Sub
  507.     End If
  508.    
  509.     'Energia?
  510.    
  511.     If Hechizos(Spell).StaRequerido > .Stats.MinSta Then
  512.         WriteConsoleMsg ia_Bot.UserIndex, "No tienes suficiente energia!", usedFont
  513.         Exit Sub
  514.     End If
  515.    
  516.     If Hechizos(Spell).Inmoviliza Or Hechizos(Spell).Paraliza Then
  517.        
  518.         'Le pongo el flag en verdadero.
  519.         ia_Bot.Paralizado = True
  520.        
  521.         'Mensaje informando.
  522.         WriteConsoleMsg ia_Bot.UserIndex, "Has paralizado ah " & IA_NAME, usedFont
  523.         'Creo la animacion sobre el char.
  524.         WriteCreateFX ia_Bot.UserIndex, IA_CHAR, Hechizos(Spell).FXgrh, Hechizos(Spell).loops
  525.         'SpellWorlds .
  526.         DecirPalabrasMagicas Hechizos(Spell).PalabrasMagicas, ia_Bot.UserIndex
  527.        
  528.         'Quito mana y energia
  529.         .Stats.MinMAN = .Stats.MinMAN - rMan
  530.         .Stats.MinSta = .Stats.MinSta - Hechizos(Spell).StaRequerido
  531.        
  532.         'le doy intervalo
  533.        
  534.         ia_Bot.Intervalos.ParalizisCount = (IA_SREMO / 2)
  535.        
  536.         WriteUpdateUserStats ia_Bot.UserIndex
  537.        
  538.         Exit Sub
  539.        
  540.     End If
  541.    
  542.     damage = RandomNumber(Hechizos(Spell).MinHp, Hechizos(Spell).MaxHp)
  543.     damage = damage + Porcentaje(damage, 3 * .Stats.ELV)
  544.    
  545.     If Not damage <> 0 Then Exit Sub
  546.    
  547.     'Quitamos vida
  548.    
  549.     ia_Bot.Vida = ia_Bot.Vida - damage
  550.    
  551.     'Aviso al usuario.
  552.     WriteConsoleMsg ia_Bot.UserIndex, "Le has quitado " & damage & " puntos de vida a " & IA_NAME, usedFont
  553.    
  554.     'Tiro las spell worlds
  555.     DecirPalabrasMagicas Hechizos(Spell).PalabrasMagicas, ia_Bot.UserIndex
  556.    
  557.     'Creo el fx.
  558.     WriteCreateFX ia_Bot.UserIndex, IA_CHAR, Hechizos(Spell).FXgrh, Hechizos(Spell).loops
  559.    
  560.     'saco mana y energia y actualizo el cliente
  561.     .Stats.MinMAN = .Stats.MinMAN - rMan
  562.     .Stats.MinSta = .Stats.MinSta - Hechizos(Spell).StaRequerido
  563.        
  564.     WriteUpdateUserStats ia_Bot.UserIndex
  565.    
  566.     If ia_Bot.Vida <= 0 Then
  567.     'Murió?
  568.         ia_EraseChar True
  569.     End If
  570.    
  571. End With
  572.  
  573. End Sub
  574.  
  575. Sub ia_DamageHit()
  576.  
  577. ' @designer     :  maTih.-
  578. ' @date         :  2012/02/01
  579.  
  580. Dim nDamage      As Integer
  581.  
  582. nDamage = CalcularDaño(ia_Bot.UserIndex)
  583.  
  584. nDamage = nDamage - (RandomNumber(IA_MINDEF, IA_MAXDEF))
  585.  
  586. WriteConsoleMsg ia_Bot.UserIndex, "Le has pegado ah " & IA_NAME & " por " & nDamage, FontTypeNames.FONTTYPE_CITIZEN
  587.  
  588. WriteChatOverHead ia_Bot.UserIndex, "-" & nDamage, IA_CHAR, vbCyan
  589.  
  590. ia_Bot.Vida = ia_Bot.Vida - nDamage
  591.  
  592. If ia_Bot.Vida <= 0 Then
  593.     ia_EraseChar True
  594. End If
  595.  
  596. End Sub
  597.  
  598. Sub ia_EraseChar(Optional ByVal killedbyUSER As Boolean = False)
  599.  
  600. ' @designer     :  maTih.-
  601. ' @date         :  2012/02/01
  602.  
  603. With ia_Bot
  604.  
  605.     WriteCharacterRemove .UserIndex, IA_CHAR
  606.    
  607.     WarpUserChar .UserIndex, 1, 50, 50, True
  608.    
  609.     With .Char
  610.          .body = 0
  611.          .CascoAnim = 0
  612.          .FX = 0
  613.          .loops = 0
  614.          .Head = 0
  615.          .heading = 0
  616.          .ShieldAnim = 0
  617.          .WeaponAnim = 0
  618.     End With
  619.    
  620.     .Vida = 0
  621.     .Mana = 0
  622.    
  623.     If killedbyUSER = False Then .UserIndex = 0
  624.    
  625.     With .Pos
  626.          .Map = 0
  627.          .X = 0
  628.          .Y = 0
  629.     End With
  630.    
  631.     .Invocado = False
  632.     .Paralizado = False
  633.    
  634.     With .Intervalos
  635.          .MoveCharCount = 0
  636.          .SpellCount = 0
  637.          .UseItemCount = 0
  638.          .ParalizisCount = 0
  639.     End With
  640.    
  641.     If .UserIndex > 0 Then
  642.        
  643.         WriteConsoleMsg .UserIndex, "Has matado ah " & IA_NAME, FontTypeNames.FONTTYPE_CITIZEN
  644.         UserList(.UserIndex).Stats.GLD = UserList(.UserIndex).Stats.GLD + IA_PREMIO
  645.         WriteUpdateGold .UserIndex
  646.        
  647.         .UserIndex = 0
  648.        
  649.     End If
  650.    
  651.     frmMain.timerIA.Enabled = False
  652.    
  653. End With
  654.  
  655. End Sub
  656.  
  657. Sub ia_CheckInts()
  658.  
  659. ' @designer     :  maTih.-
  660. ' @date         :  2012/02/01
  661.  
  662. With ia_Bot.Intervalos
  663.  
  664.     If .MoveCharCount > 0 Then .MoveCharCount = .MoveCharCount - 1
  665.     If .SpellCount > 0 Then .SpellCount = .SpellCount - 1
  666.     If .UseItemCount > 0 Then .UseItemCount = .UseItemCount - 1
  667.     If .ParalizisCount > 0 Then .ParalizisCount = .ParalizisCount - 1
  668.    
  669. End With
  670.  
  671. End Sub


remplazan el sub usuarioataca por este

  1. Public Sub UsuarioAtaca(ByVal userIndex As Integer)
  2. '***************************************************
  3. 'Author: Unknown
  4. 'Last Modification: -
  5. '
  6. '***************************************************
  7.  
  8.     Dim Index As Integer
  9.     Dim AttackPos As WorldPos
  10.    
  11.     'Check bow's interval
  12.     If Not IntervaloPermiteUsarArcos(userIndex, False) Then Exit Sub
  13.    
  14.     'Check Spell-Magic interval
  15.     If Not IntervaloPermiteMagiaGolpe(userIndex) Then
  16.         'Check Attack interval
  17.         If Not IntervaloPermiteAtacar(userIndex) Then
  18.             Exit Sub
  19.         End If
  20.     End If
  21.    
  22.     With UserList(userIndex)
  23.         'Quitamos stamina
  24.         If .Stats.MinSta >= 10 Then
  25.             Call QuitarSta(userIndex, RandomNumber(1, 10))
  26.         Else
  27.             If .Genero = eGenero.Hombre Then
  28.                 Call WriteConsoleMsg(userIndex, "Estás muy cansado para luchar.", FontTypeNames.FONTTYPE_INFO)
  29.             Else
  30.                 Call WriteConsoleMsg(userIndex, "Estás muy cansada para luchar.", FontTypeNames.FONTTYPE_INFO)
  31.             End If
  32.             Exit Sub
  33.         End If
  34.        
  35.         AttackPos = .Pos
  36.         Call HeadtoPos(.Char.heading, AttackPos)
  37.        
  38.         'Exit if not legal
  39.         If AttackPos.X < XMinMapSize Or AttackPos.X > XMaxMapSize Or AttackPos.Y <= YMinMapSize Or AttackPos.Y > YMaxMapSize Then
  40.             Call SendData(SendTarget.ToPCArea, userIndex, PrepareMessagePlayWave(SND_SWING, .Pos.X, .Pos.Y))
  41.             Exit Sub
  42.         End If
  43.        
  44.         If ia_Bot.Invocado Then
  45.            If ia_Bot.userIndex = userIndex Then
  46.               If ia_Bot.Pos.X = AttackPos.X And ia_Bot.Pos.Y = AttackPos.Y Then
  47.                  ia_DamageHit
  48.               End If
  49.             End If
  50.         End If
  51.        
  52.         Index = MapData(AttackPos.Map, AttackPos.X, AttackPos.Y).userIndex
  53.        
  54.         'Look for user
  55.         If Index > 0 Then
  56.             Call UsuarioAtacaUsuario(userIndex, Index)
  57.             Call WriteUpdateUserStats(userIndex)
  58.             Call WriteUpdateUserStats(Index)
  59.             Exit Sub
  60.         End If
  61.        
  62.         Index = MapData(AttackPos.Map, AttackPos.X, AttackPos.Y).NPCIndex
  63.        
  64.         'Look for NPC
  65.         If Index > 0 Then
  66.             If Npclist(Index).Attackable Then
  67.                 If Npclist(Index).MaestroUser > 0 And MapInfo(Npclist(Index).Pos.Map).Pk = False Then
  68.                     Call WriteConsoleMsg(userIndex, "No puedes atacar mascotas en zona segura.", FontTypeNames.FONTTYPE_FIGHT)
  69.                     Exit Sub
  70.                 End If
  71.                
  72.                 Call UsuarioAtacaNpc(userIndex, Index)
  73.             Else
  74.                 Call WriteConsoleMsg(userIndex, "No puedes atacar a este NPC.", FontTypeNames.FONTTYPE_FIGHT)
  75.             End If
  76.            
  77.             Call WriteUpdateUserStats(userIndex)
  78.            
  79.             Exit Sub
  80.         End If
  81.        
  82.         Call SendData(SendTarget.ToPCArea, userIndex, PrepareMessagePlayWave(SND_SWING, .Pos.X, .Pos.Y))
  83.         Call WriteUpdateUserStats(userIndex)
  84.        
  85.         If .Counters.Trabajando Then .Counters.Trabajando = .Counters.Trabajando - 1
  86.            
  87.         If .Counters.Ocultando Then .Counters.Ocultando = .Counters.Ocultando - 1
  88.     End With
  89. End Sub


agregan al type UserFlags



buscan en el sub handleworkleftclick

  1.                'Check intervals and cast
  2.                 If .flags.Hechizo > 0 Then
  3.                     Call LanzarHechizo(.flags.Hechizo, userIndex)
  4.                     .flags.Hechizo = 0
  5.                 Else
  6.                     Call WriteConsoleMsg(userIndex, "¡Primero selecciona el hechizo que quieres lanzar!", FontTypeNames.FONTTYPE_INFO)
  7.                 End If


arriba ponen

  1.                'Si tiene el bot targeteado AND es el que esta contra
  2.                 'El bot, dañamos.
  3.                
  4.                 If .flags.TargetBOT Then
  5.                     If ia_Bot.userIndex = userIndex Then
  6.                         If .flags.Hechizo > 0 Then
  7.                                 ia_UserDamage .flags.Hechizo
  8.                                 .flags.TargetBOT = False
  9.                                 .flags.Hechizo = 0
  10.                                 Exit Sub
  11.                         End If
  12.                     End If
  13.                 End If


buscan en el sub lookattile

  1.            '¿Es un personaje?


arriba ponen

  1.            If Y + 1 <= YMaxMapSize Then
  2.                 ia_Check userIndex, X, Y + 1
  3.                 ia_Check userIndex, X, Y
  4.             End If


crean un timer en el frmmain y le ponen estas propiedades

Name=timerIA
Interval=40
Enabled=False


le hacen 2 click y leponen esto de codiog



van al sub main() y agregan



bueno ahora buscamos

  1.    Talk                    ';


abajo ponemos

  1.    BotCombat               '/COMBATIR


buscan

  1.        Case ClientPacketID.Talk                    ';
  2.             Call HandleTalk(userIndex)


abajo ponen

  1.        Case ClientPacketID.BotCombat
  2.             Call HandlebotCombat(userIndex)


agregan arriba de



  1. Private Sub handleBotCombat(ByVal userIndex As Integer)
  2.  
  3. ' @designer     :  maTih.-
  4. ' @date         :  2012/02/01
  5.  
  6. With UserList(userIndex)
  7.  
  8. Dim tNpc As Integer
  9. Dim uFnt As FontTypeNames
  10.  
  11. uFnt = FontTypeNames.FONTTYPE_CITIZEN
  12.  
  13. tNpc = .flags.targetNPC
  14.  
  15. .incomingData.ReadByte
  16.  
  17. If .flags.Muerto Then
  18.     WriteConsoleMsg userIndex, "Estas muerto!", uFnt
  19.     Exit Sub
  20. End If
  21.  
  22. If .Counters.Pena > 0 Then
  23.     WriteConsoleMsg userIndex, "Estas preso!", uFnt
  24.     Exit Sub
  25. End If
  26.  
  27. If Not tNpc <> 0 Then
  28.     WriteConsoleMsg userIndex, "Debes seleccionar un npc.", uFnt
  29.     Exit Sub
  30. End If
  31.  
  32. If Npclist(tNpc).Numero <> IA_NPC Then
  33.     WriteConsoleMsg userIndex, "Debes buscar al npc Entrenador de duelos!", uFnt
  34.     Exit Sub
  35. End If
  36.  
  37. If ia_Bot.Invocado Then
  38.     WriteChatOverHead userIndex, "Ya hay un usuario combatiendo, intenta luego.", Npclist(tNpc).Char.CharIndex, vbCyan
  39.     Exit Sub
  40. End If
  41.  
  42. ia_Spawn userIndex
  43.  
  44. End With
  45.  
  46. End Sub


cliente

buscan

  1.    Talk                    ';


abajo

  1.    BotCombat               '/COMBATIR


agregan arriba de



  1. Sub WriteBotCombat()
  2.  
  3. ' @designer     :  maTih.-
  4. ' @date         :  2012/02/01
  5.  
  6. outgoingData.WriteByte ClientPacketID.BotCombat
  7.  
  8. End Sub


buscan



Arriba ponen

  1.            Case "/COMBATIR"
  2.                 WriteBOTCOMBAT


datean un npc con algo asi

  1. [NPCXXX] 'Mercader
  2. Name=Mercader
  3. NpcType=0
  4. Desc=Hola fraksa2,si queres ser humillado por una computadora, clikeame y pone /COMBATIR, No me hago cargo de lo frustrado que podés llegar a qedar
  5. Head=2
  6. Heading=3
  7. Body=3
  8. Movement=1
  9. Attackable=0
  10. ReSpawn=0
  11. Hostile=0
  12. Domable=0
  13. Alineacion=0
  14. Comercia=0


bien con eso estaría, cosas que tienen que cambiar :

'Numero del npc que hay que clikear.
Public Const IA_NPC As Integer = 80


re obvio

'Defensa del bot jeje

Private Const IA_MINDEF As Integer = 10
Private Const IA_MAXDEF As Integer = 12


re obvio

'Mapa donde spawnea.
Private Const IA_MAP As Integer = 16
Private Const IA_X As Byte = 50
Private Const IA_Y As Byte = 50


re obvio

'Posiciones donde cae el user

Private Const IA_USERX As Byte = 44
Private Const IA_USERY As Byte = 33


re obvio

'Nombre del char

Private Const IA_NAME As String = "el putisimo dios maTih.-"


re obvio

'Te da oro al matarlo

Private Const IA_PREMIO As Long = 100000


re obvio

'STATS

Private Const IA_HP As Integer = 400
Private Const IA_MAN As Integer = 2000


re obvio

'Datos del char

'/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*

'ATENCION : Acá van los números de objetos!!!

Private Const IA_HEAD As Integer = 4
Private Const IA_BODY As Integer = 485

Private Const IA_WEAPON As Integer = 660
Private Const IA_SHIELD As Integer = 404
Private Const IA_HELMET As Integer = 405

'ATENCION : Acá van los números de objetos!!!

'/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*


eso es el eqipo , helmet = casco, shield = escudo, weapon = arma, body = armadura y head= cabeza

'Constantes de intervalos.

Private Const IA_SINT As Integer = 1000 'Intervalo entre hechizo-hechizo.
Private Const IA_SREMO As Integer = 300 'Intervalo remo.
Private Const IA_MOVINT As Integer = 240 'Intervalo caminta.
Private Const IA_USEOBJ As Integer = 200 'Intervalo usar potas.


re obvio

'Probabilidades de que te pegue

Private Const IA_CASTEO As Byte = 77


probabilidades de manquear, entre mas dice ahi menos manquea :P

PD: Está hecho así no más y es bastantee básico, pero para los que me lo pidieron/querian saber mas o menos como hacerlo XDD

Video subido por milagrosa :


http://www.youtube.com/watch?v=JbkY1vhTo8Y&feature=youtu.be
Última edición por maTih.- el 01 Feb 2012 14:37, editado 1 vez en total
Este mensaje ha obtenido 6 Monedas de Oro.


LyRan escribió:Buenos Dias amigos y programadores de Gs Zone, Me gustaria pedirle la amabilidad de una ayuda con un cliente editado para mi Ao casero, Osea me explico, yo juego Ao con varios amigos y ellos todos usan cheat y no me gusta eso me gustaria que alguien me ayudara a crear un cliente editado con auto poteo de ambas potas a la ves ya sea que se alla gastado Mana lanzando algun hechis y comienze a potear solo hasta estar completamente el Mana, igual para la salud y poteo rapido para ambos.
mAnco programEr
800 (+1)
Dragon Ancestral [1]
Registrado: Años de membresíaAños de membresía
Ubicación: Bolivia
Mensajes: 2305
Aportes: 109

Nota » 01 Feb 2012 08:57

Fuaw que bueno que está, estaría lindo un videito de como queda :).

Saludos!

Imagen

Imagen

TE AMO SKYFUN SOS MI FANNNNNNNNNNNNNNNNNNNNN
HAO Staff
409
Dragon Ancestral [2]
Registrado: Años de membresía
Ubicación: Buenos Aires
Mensajes: 2745
Aportes: 28
Premios: 1
Embajador (1)

Nota » 01 Feb 2012 11:12

Muy bueno, me gusto.

Saludos ^^

Imagen
Imagen
Staff Zeiked-Games
641
Dragon Ancestral [3]
Registrado: Años de membresíaAños de membresía
Ubicación: Castelar
Mensajes: 3416
Aportes: 66
Premios: 3
Usuario omnipresente (1) Embajador (2)

Nota » 01 Feb 2012 11:17

http://www.youtube.com/watch?v=JbkY1vhT ... e=youtu.be

Ahí está el videito.
Agita bastante bien eh te cola todas y olvidate de darle un inmo, tarda menos de una milesima en removerse.

EDIT: Habría que agregarle un If .NpcIndex > 0 Then Exit Function al AI_LegalPos si no empieza a pisar a los npcs y se vuelve todo re confuso
Última edición por Milagrosa el 01 Feb 2012 11:18, editado 1 vez en total
Unknown Pleasures
277
Newbie [4]
Registrado: Diciembre 2011
Mensajes: 102
Aportes: 6

Nota » 01 Feb 2012 13:08

Hola fraksa2,si queres ser humillado por una computadora, clikeame y pone /COMBATIR, No me hago cargo de lo frustrado que podés llegar a qedar

jajaaj, espectacular matih jaja

a mi fenix ^^



Santty.- escribió:Si, soy hincha de tu padre, el que te gana cada vez que te cruza, el dueño del barrio, el orgullo nacional, rey de copas y el máximo ganador de copa libertadores

PROBLEM?





La gente que cuando camina mueve un poco los labios está practicando respuestas originales para discusiones que ya perdieron hace dos horas.
YPF etatizada: -Hola q carga? -Deme Néstor Súper
686
Dragon Ancestral [4]
Registrado: Años de membresíaAños de membresía
Ubicación: Mendoza
Mensajes: 3545
Aportes: 40

Nota » 01 Feb 2012 13:41

Te falta el flag TargetBOT

type userflags > dim targetbot as boolean
Última edición por ZhtronG el 01 Feb 2012 14:42, editado 1 vez en total

Master123500 escribió:Pero como tendria q buscarlo??? osea..prosediment Font_Create ??

miqueas150 dijo:
Es un sub :lol:


Chateando con LuuQ escribió:Anzhel dice:
franeg95_no_es_igual_a_tkF5-15.html
JAJAJAJAJAJAJAJAJAJAJ
MIRA ESO
' Simplemente Luuq dice:
el q canta
esta ardiente

Imagen
Mystery 8.0 - Anzhetra: The lost imperium
http://www.MysteryAO.tk
MysteryAO Staff
338 (+3)
Destructor de Mentes [6]
Registrado: Años de membresía
Ubicación: En mi casa.
Mensajes: 796
Aportes: 20

Nota » 01 Feb 2012 14:54

Milagrosa escribió:http://www.youtube.com/watch?v=JbkY1vhTo8Y&feature=youtu.be

Ahí está el videito.
Agita bastante bien eh te cola todas y olvidate de darle un inmo, tarda menos de una milesima en removerse.

EDIT: Habría que agregarle un If .NpcIndex > 0 Then Exit Function al AI_LegalPos si no empieza a pisar a los npcs y se vuelve todo re confuso


editado.

Private Const IA_SREMO As Integer = 300 'Intervalo remo.

cambia el 300 para que tarde más en removerse.

arreglado el flag.

LyRan escribió:Buenos Dias amigos y programadores de Gs Zone, Me gustaria pedirle la amabilidad de una ayuda con un cliente editado para mi Ao casero, Osea me explico, yo juego Ao con varios amigos y ellos todos usan cheat y no me gusta eso me gustaria que alguien me ayudara a crear un cliente editado con auto poteo de ambas potas a la ves ya sea que se alla gastado Mana lanzando algun hechis y comienze a potear solo hasta estar completamente el Mana, igual para la salud y poteo rapido para ambos.
mAnco programEr
800 (+1)
Dragon Ancestral [1]
Registrado: Años de membresíaAños de membresía
Ubicación: Bolivia
Mensajes: 2305
Aportes: 109

Nota » 01 Feb 2012 15:17

maTih.- escribió:
Milagrosa escribió:http://www.youtube.com/watch?v=JbkY1vhTo8Y&feature=youtu.be

Ahí está el videito.
Agita bastante bien eh te cola todas y olvidate de darle un inmo, tarda menos de una milesima en removerse.

EDIT: Habría que agregarle un If .NpcIndex > 0 Then Exit Function al AI_LegalPos si no empieza a pisar a los npcs y se vuelve todo re confuso


editado.

Private Const IA_SREMO As Integer = 300 'Intervalo remo.

cambia el 300 para que tarde más en removerse.

arreglado el flag.


chee bldo le puedo meter 600 apocas seguidos que ni cae pero si le cuelo un golpe se muere, creo q tendrias q agregar algo en el sub lanzarhechizo

AH NO DISCULPA, ERA ERROR MIO. GRACIAS JAJA.
Última edición por ZhtronG el 01 Feb 2012 15:46, editado 5 veces en total

Master123500 escribió:Pero como tendria q buscarlo??? osea..prosediment Font_Create ??

miqueas150 dijo:
Es un sub :lol:


Chateando con LuuQ escribió:Anzhel dice:
franeg95_no_es_igual_a_tkF5-15.html
JAJAJAJAJAJAJAJAJAJAJ
MIRA ESO
' Simplemente Luuq dice:
el q canta
esta ardiente

Imagen
Mystery 8.0 - Anzhetra: The lost imperium
http://www.MysteryAO.tk
MysteryAO Staff
338 (+3)
Destructor de Mentes [6]
Registrado: Años de membresía
Ubicación: En mi casa.
Mensajes: 796
Aportes: 20

Nota » 01 Feb 2012 15:42

se puede programar que haya distintos npcs con distintos niveles de jugabilidad?

eso estarçia realmente genial xd

es muy dificil?

excelente aporte
Última edición por Fixed el 01 Feb 2012 15:42, editado 1 vez en total
Usuario Registrado
34
Newbie [5]
Registrado: Años de membresía
Mensajes: 138

Nota » 01 Feb 2012 17:03

no es muy dificil es tocar un poco el módulo lo demás es todo igual

LyRan escribió:Buenos Dias amigos y programadores de Gs Zone, Me gustaria pedirle la amabilidad de una ayuda con un cliente editado para mi Ao casero, Osea me explico, yo juego Ao con varios amigos y ellos todos usan cheat y no me gusta eso me gustaria que alguien me ayudara a crear un cliente editado con auto poteo de ambas potas a la ves ya sea que se alla gastado Mana lanzando algun hechis y comienze a potear solo hasta estar completamente el Mana, igual para la salud y poteo rapido para ambos.
mAnco programEr
800 (+1)
Dragon Ancestral [1]
Registrado: Años de membresíaAños de membresía
Ubicación: Bolivia
Mensajes: 2305
Aportes: 109

Nota » 01 Feb 2012 17:09

Lindo code parecido a el que implementaron en AO Yind 3.0

Imagen
El Cacheton ^^
165
Aprendiz [4]
Registrado: Años de membresía
Ubicación: Las Toninas
Mensajes: 340

Nota » 01 Feb 2012 22:19

Magnum escribió:Lindo code parecido a el que implementaron en AO Yind 3.0


naaa ajjajaj el del yind es muy zarpado XDDD

LyRan escribió:Buenos Dias amigos y programadores de Gs Zone, Me gustaria pedirle la amabilidad de una ayuda con un cliente editado para mi Ao casero, Osea me explico, yo juego Ao con varios amigos y ellos todos usan cheat y no me gusta eso me gustaria que alguien me ayudara a crear un cliente editado con auto poteo de ambas potas a la ves ya sea que se alla gastado Mana lanzando algun hechis y comienze a potear solo hasta estar completamente el Mana, igual para la salud y poteo rapido para ambos.
mAnco programEr
800 (+1)
Dragon Ancestral [1]
Registrado: Años de membresíaAños de membresía
Ubicación: Bolivia
Mensajes: 2305
Aportes: 109

Nota » 02 Feb 2012 01:00

Esta muy bueno matih!

Te felicito!
Aguante River Plate ! ! !
909
Moderador
Registrado: Años de membresíaAños de membresíaAños de membresía
Ubicación: Villa adelina, Vicente Lopez.
Mensajes: 14428
Aportes: 305
Premios: 10
Señor Moderador (3) Señor Reglamento (1) Aportes (2) Embajador (3) Detector de Bugs (1)

Nota » 02 Feb 2012 16:30

Fuah, increible mati, muy bueno.

Imagen


Diseño De Items


Imagen
Grande Martin !
261
Aprendiz [7]
Registrado: Septiembre 2011
Ubicación: En mi casituu
Mensajes: 493
Aportes: 4
Premios: 1
Embajador (1)

Nota » 02 Feb 2012 16:30

Franeg95 escribió:Esta muy bueno matih!

Te felicito!


:D

ahora edito y pongo el modulo un poco tocado y el npc tira inmo :P

LyRan escribió:Buenos Dias amigos y programadores de Gs Zone, Me gustaria pedirle la amabilidad de una ayuda con un cliente editado para mi Ao casero, Osea me explico, yo juego Ao con varios amigos y ellos todos usan cheat y no me gusta eso me gustaria que alguien me ayudara a crear un cliente editado con auto poteo de ambas potas a la ves ya sea que se alla gastado Mana lanzando algun hechis y comienze a potear solo hasta estar completamente el Mana, igual para la salud y poteo rapido para ambos.
mAnco programEr
800 (+1)
Dragon Ancestral [1]
Registrado: Años de membresíaAños de membresía
Ubicación: Bolivia
Mensajes: 2305
Aportes: 109

Siguiente

Volver a AO 0.13.x

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 0 invitados