Autoit Problème de détection d'ennemi

A

Anonymous

Invité
#1
Bonjour à tous et à toutes :)

Donc comme le signale le sujet, je ne comprends pas pourquoi, mon script, ne détecte pas les monstres près du joueur...

Si quelqu'un pouvait m'éclairer :D

Voici le script :
Code:
$couleur_joueur = '0xFF0000'
$couleur_ennemie = '0x0000FF'

Func pos_mob()

    pos_joueur()
    journal_ecrire("position joueur: " & $pos_joueur[0] & "; " & $pos_joueur[1])

    $ajout_x = 43
    $ajout_y = 20
    $ajout_x2 = 43
    $ajout_y2 = 20
    $trouve = 0
    $b = 1
    Do
        $b = $b + 1

        $pos_mob = PixelSearch($pos_joueur[0] - $ajout_x, $pos_joueur[1] - $ajout_y, $pos_joueur[1] + $ajout_x2, $pos_joueur[0] + $ajout_y2, $couleur_ennemie, 7)

        If Not @error Then

            journal_ecrire('position ennemi: ' & $pos_mob[0] & "; " & $pos_mob[1])
            $trouve = 1
            ExitLoop

        EndIf

        $ajout_x = $ajout_x + 43
        $ajout_y = $ajout_y + 20

        If $pos_joueur[0] - $ajout_x < 0 Then
            $ajout_x = 0
        EndIf
        If $pos_joueur[0] - $ajout_y < 0 Then
            $ajout_y = 0
        EndIf
        If $pos_joueur[0] + $ajout_x2 > 690 Then
            $ajout_x2 = 690
        EndIf
        If $pos_joueur[0] + $ajout_y2 > 505 Then
            $ajout_y2 = 505
        EndIf

    Until $b = $nb_po / 2
    If $trouve <> 1 Then
        journal_ecrire('position monstre non trouvée')
        $pos_mob = PixelSearch(10, 40, 690, 505, $couleur_ennemie, 5)
        if @error Then
            $pos_mob = $pos_0
            EndIf
    EndIf

EndFunc   ;==>pos_mob

Func pos_joueur()

	$pos_joueur = PixelSearch(10, 40, 690, 505, $couleur_joueur, 5)

	If Not @error Then
		journal_ecrire("Position joueur trouvée")
		MouseMove($pos_joueur[0], $pos_joueur[1], 15)
		$position = MouseGetPos()
	Else
		journal_ecrire("Position  non joueur trouvée")
		verif_combat()
		cherche_mob()
	EndIf

EndFunc   ;==>pos_joueur
Nb_po est l'utilisateur qui l'entre

Si vous ne comprenez pas quelque chose signalez le moi :)

Merci d'avance
 
Haut Bas