Attacking problem{Help} menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    mikeyoung's Avatar Private
    Reputation
    1
    Join Date
    Aug 2012
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Attacking problem{Help}

    Hello fellow scrip/botters.
    Dont you just love when little projects turn into big ones or nothing but just problems, Cause I do...

    Im working on something where im using most of the old code over at
    "Diablo 3 Au3 & MemoryRead Tool-Kit for bots"

    My problem is something with attacking, I find my character/toon killing everything
    & then just standing there attacking the ground. Sometimes there nothing but the ground
    other times hes clicking next to some items. Heres my code im sure im reading something wrong.
    btw if i change to SOF my character/toon just runs from one waypoint to the next, with out attacking.
    Thats another problem which im concerned about but dont really care right now.

    - I call this to move -> looks fine....
    Code:
    MoveToPos(1152.68298339844, 701.385498046875 , 4.20062875747681, 1, 25)
    - I call this to attack... -> sure theres something wrong.
    Code:
    ;;--------------------------------------------------------------------------------
    ;;   Attack()
    ;;--------------------------------------------------------------------------------
    Func Attack($range, $monsterList)
       ActDiablo()
       $Once = 0
       While 1
          $OBject = IterateObjectList(0)
          $foundtarget = 0
          For $i = 0 To UBound($OBject, 1) - 1
             _ArraySort($OBject, 0, 0, 0, 8)
             If checkFromList($monsterList, $OBject[$i][2]) And $OBject[$i][1] <> 0xFFFFFFFF And $OBject[$i][7] <> -1 And $OBject[$i][8] < $range Then  ;<-- Could be this???
    		   $Coords = FromD3toScreenCoords($OBject[$i][3], $OBject[$i][4], $OBject[$i][5])
                MouseMove($Coords[0], $Coords[1], 3)
    If $Once = 0 Then AttackHydra()
                $tempvalue = _MemoryRead($OBject[$i][9] + 0x4, $d3, 'ptr')
                While $tempvalue <> 0xFFFFFFFF
                   $tempvalue = _MemoryRead($OBject[$i][9] + 0x4, $d3, 'ptr')
                   $Coords = FromD3toScreenCoords(_MemoryRead($OBject[$i][9] + 0xB0, $d3, 'float'), _MemoryRead($OBject[$i][9] + 0xB4, $d3, 'float'), _MemoryRead($OBject[$i][9] + 0xB8, $d3, 'float'))
                   MouseMove($Coords[0], $Coords[1], 3)			   
    				  OffsetList()
    			      $CurrentLoc = GetCurrentPos()
    				  $xd = $CurrentLoc[0] - $Coords[1]
    				  $yd = $Coords[0] - $CurrentLoc[1] 
    				 $Distance = $xd+$yd
    			     $Distance = Sqrt($Distance)
    				 GetLifep24()
    				 If $LIFE = 0 Then
    					;$DeathCount = 1
    					LeaveGame()
    					Sleep(20000)
    					Start()
    					Exit
    				 EndIf
    				  If $Distance > 15 Then 
    					 MouseClick("Right",$Coords[0],$Coords[1])
    				  Else
    					 MouseClick("Left",$Coords[0],$Coords[1])
    				  EndIf
    				
                WEnd
                $foundtarget = 0
                ExitLoop
             EndIf
          Next  
          If $foundtarget = 0 Then
             Grabit(30)
             ExitLoop
          EndIf
          MoveToPos($lastwp_x, $lastwp_y, $lastwp_z, 0, 25)
       WEnd
    EndFunc   ;==>Attack
    Once again im sure im reading something wrong,
    & thanks for looking at all this.

    Attacking problem{Help}
  2. #2
    DarkAngelBGE's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey there,

    I have a similar problem, will post my code afterwards. What I noticed in your code is:

    $xd = $CurrentLoc[0] - $Coords[1]
    $yd = $Coords[0] - $CurrentLoc[1]
    $Distance = $xd+$yd
    $Distance = Sqrt($Distance)
    That's not correcto. You want to use the Pythagoras here. Also you are substracting the wrong values to get the differences. It should be like this:

    $xd = $CurrentLoc[0] - $Coords[0]
    $yd = $CurrentLoc[1] - $Coords[1]
    $Distance = Sqrt($xd*$xd + $yd*$yd)
    One thing I am looking at to better detect monsters is to use the code from the sticky framework thread, which actually examines the number of hitpoints of the actor:

    If $OBject[$i][8] < $range And $OBject[$i][1] <> 0xFFFFFFFF And $OBject[$i][7] <> -1 And checkFromList($monsterList, $OBject[$i][2]) And IterateActorAtribs($OBject[$i][1], $Atrib_Hitpoints_Cur) > 0 Then
    The IterateActorAtribs function takes quite long to execute, though, so it might not be very practical to use it. But currently my bot also sometimes shoots on the ground, or runs past monsters not attacking them. : /

    Does anybody have this solved really well?
    Last edited by DarkAngelBGE; 02-24-2013 at 08:44 AM.

  3. #3
    mikeyoung's Avatar Private
    Reputation
    1
    Join Date
    Aug 2012
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That Distance is for my (Enemy) I'm sure its
    changed cause the other way wasn't reading correct,
    I'll double check this now and thank you if It's incorrect.

    Btw $tempvalue sometimes = random numbers like 0xFF68...
    Like Wizzards-Hydra & sometimes the Firebreathing things..
    it picks up as "Enemy"... Maybe some sort of safelist would fix this?
    Im really not up 2 testing right now.

  4. #4
    g4b51l's Avatar Corporal
    Reputation
    2
    Join Date
    Nov 2012
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    About the attack....
    Calling OffsetList() in the middle of a fight is somehow a bad idea...should not be necessary
    This "$OBject[$i][7] <> -1" will make you miss some monster...listed below
    $monsterListVirtual = "TerrorDemon|shadowVermin|Siege_wallMonster|DuneDervish|Brickhouse|treasureGobli n|ghost|woodwraith|SkeletonSummoner"
    Below some code for getDistance which tries to handle enemies on high ground...
    PHP Code:
    Func GetDistanceTo($x$y$z$cx ""$cy ""$cz "")
        If 
    Not (IsNumber($cx)) Then
            $CurrentLoc 
    GetCurrentPos()
            
    $cx $CurrentLoc[0]
            
    $cy $CurrentLoc[1]
            
    $cz $CurrentLoc[2]
        EndIf
        
    $xd $x $cx
        $yd 
    $y $cy
        $zd 
    $z $cz
        
    want this to be more critical
        
    If $zd 20 Then
            $zd 
    *= 3
        
    EndIf
        Return 
    Sqrt($xd $xd $yd $yd $zd $zd)
    EndFunc   ;==>GetDistanceTo 
    You will need to check on the monster hitpoints..if you add this as the most neested condiition its not too bad performance wise...i hope you got the find attribute fast function,,,,the other stuff from the condition is more or less what I used to check and was working fine....
    You should consider building in toons of timeouts....eg.
    PHP Code:
    If TimerDiff($begin) > $timeLimit 1000 Then
                    _ArrayAdd
    ($badlist$actorid)
                    
    DEBUG("attack - inner time is over"2)
                    Return 
    False
                
    EndIf
    </
    code
    Last edited by g4b51l; 02-24-2013 at 07:50 PM. Reason: added code quites

  5. #5
    DarkAngelBGE's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by g4b51l View Post
    About the attack....
    Calling OffsetList() in the middle of a fight is somehow a bad idea...should not be necessary
    This "$OBject[$i][7] <> -1" will make you miss some monster...listed below
    $monsterListVirtual = "TerrorDemon|shadowVermin|Siege_wallMonster|DuneDervish|Brickhouse|treasureGobli n|ghost|woodwraith|SkeletonSummoner"
    Below some code for getDistance which tries to handle enemies on high ground...
    PHP Code:
    Func GetDistanceTo($x$y$z$cx ""$cy ""$cz "")
        If 
    Not (IsNumber($cx)) Then
            $CurrentLoc 
    GetCurrentPos()
            
    $cx $CurrentLoc[0]
            
    $cy $CurrentLoc[1]
            
    $cz $CurrentLoc[2]
        EndIf
        
    $xd $x $cx
        $yd 
    $y $cy
        $zd 
    $z $cz
        
    want this to be more critical
        
    If $zd 20 Then
            $zd 
    *= 3
        
    EndIf
        Return 
    Sqrt($xd $xd $yd $yd $zd $zd)
    EndFunc   ;==>GetDistanceTo 
    You will need to check on the monster hitpoints..if you add this as the most neested condiition its not too bad performance wise...i hope you got the find attribute fast function,,,,the other stuff from the condition is more or less what I used to check and was working fine....
    You should consider building in toons of timeouts....eg.
    PHP Code:
    If TimerDiff($begin) > $timeLimit 1000 Then
                    _ArrayAdd
    ($badlist$actorid)
                    
    DEBUG("attack - inner time is over"2)
                    Return 
    False
                
    EndIf
    </
    code

    Thanks for your reply g4b51l. I added my hp checking back. It should work fine, but in my

    local $hitpoints = IterateActorAtribs($guid, $Atrib_Hitpoints_Cur)
    the

    Local $actor = IterateLocalActor()
    always returns false. So

    Func IterateLocalActor()
    $_Count = _MemoryRead($_LocalActor_Count, $d3, 'int')
    If $_Count <= 0 Then
    return false
    EndIf
    is firing (verified). It seems some offsets are wrong. Do you mind checking the following list and compare it with yours? Thanks in advance for your time.

    ;need this for hitpoints checking
    Global $Atrib_Hitpoints_Cur[2] = [0x067, "float"]

    Global $ofs_ActorAtrib_Count = 0x108 ; 0x0 0x0
    Global $ofs_ActorAtrib_Base = 0x15A1EA4;0x015A2EA4;0x015A1EA4
    Global $ofs_LocalActor_ofs1 = 0x378 ;instead of $ofs_ActorAtrib_ofs2
    Global $ofs_LocalActor_ofs2 = 0x148

    Global $ofs_ActorAtrib_ofs1 = 0x390
    Global $ofs_ActorAtrib_ofs2 = 0x2E8
    Global $ofs_ActorAtrib_ofs3 = 0x148

    Global $ofs_LocalActor_Count = 0x108

    Global $_ActorAtrib_Base = _MemoryRead($ofs_ActorAtrib_Base, $d3, 'ptr')
    Global $_ActorAtrib_1 = _MemoryRead($_ActorAtrib_Base + $ofs_ActorAtrib_ofs1, $d3, 'ptr')
    Global $_ActorAtrib_2 = _MemoryRead($_ActorAtrib_1 + $ofs_ActorAtrib_ofs2, $d3, 'ptr')
    Global $_ActorAtrib_3 = _MemoryRead($_ActorAtrib_2 + $ofs_ActorAtrib_ofs3, $d3, 'ptr')
    Global $_ActorAtrib_4 = _MemoryRead($_ActorAtrib_3, $d3, 'ptr')

    Global $_LocalActor_1 = _MemoryRead($_ActorAtrib_1 + $ofs_LocalActor_ofs1, $d3, 'ptr')
    Global $_LocalActor_2 = _MemoryRead($_LocalActor_1 + $ofs_LocalActor_ofs2, $d3, 'ptr')
    Global $_LocalActor_3 = _MemoryRead($_LocalActor_2, $d3, 'ptr')
    Global $_LocalActor_Count = $_LocalActor_1 + $ofs_LocalActor_Count

    Global $ofs_LocalActor_atribGUID = 0x120
    Global $ofs_LocalActor_StrucSize = 0x2D0 ; 0x0 0x0

  6. #6
    g4b51l's Avatar Corporal
    Reputation
    2
    Join Date
    Nov 2012
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you use a loop over some array or some bit shit and hash acces in your attribute function?

    About the offsets...I used to work with yout code but replaced it because some posts mentioned its better to go relative to objmain...see below...have a try...no warranty....

    PHP Code:
    global $Atrib_Hitpoints_Cur[2] = [0x75"float"]

        global 
    $AttribContainerBase _MemoryRead($ofs_ObjectManager$d3'ptr')
        global 
    $ObjManAtribGrpContainerOffset 0x85C//0x844;
        
    global $ObjManAtribContainerOffset 0x70;

        ;
    //GET ACTORATRIB
        
    Global $ofs_ActorAtrib_Base 0x1544E54;0x15A1EA4;0x015A2EA4;0x015A1EA4
        
    Global $ofs_ActorAtrib_ofs1 0x390
        
    Global $ofs_ActorAtrib_ofs2 0x2E8
        
    Global $ofs_ActorAtrib_ofs3 0x148
        
    Global $ofs_ActorAtrib_Count 0x108 0x0 0x0

        
    global $_ObjectManager_Base  _MemoryRead($ofs_ObjectManager$d3'ptr')
        global 
    $_ActorAtrib_1 _MemoryRead($_ObjectManager_Base $ObjManAtribGrpContainerOffset$d3'ptr')
        global 
    $_ActorAtrib_2 _MemoryRead($_ActorAtrib_1 $ObjManAtribContainerOffset$d3'ptr')

        global 
    $_ActorAtrib_Count  $_ActorAtrib_2+$ofs_ActorAtrib_Count;important
        
    global $_ActorAtrib_3  _MemoryRead($_ActorAtrib_2+$ofs_ActorAtrib_ofs3$d3'ptr')
        global 
    $_ActorAtrib_4  _MemoryRead($_ActorAtrib_3$d3'ptr'
    Last edited by g4b51l; 02-25-2013 at 08:30 AM. Reason: offsets added

  7. #7
    DarkAngelBGE's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply. How do you calculate $_LocalActor_Count though?

    Still getting actor_counts of 0, see below code:

    Func IterateLocalActor()
    $_Count = _MemoryRead($_LocalActor_Count, $d3, 'int')
    If $_Count <= 0 Then
    ;this is firing every time, verified
    return false
    EndIf
    $CurrentOffset = $_LocalActor_3

    Local $__ACTOR[$_Count + 1][5]
    For $i = 0 To $_Count
    $__ACTOR[$i][1] = _MemoryRead($CurrentOffset, $d3, 'ptr')
    $__ACTOR[$i][2] = _MemoryRead($CurrentOffset + 0x4, $d3, 'char[64]')
    $__ACTOR[$i][3] = _MemoryRead($CurrentOffset + $ofs_LocalActor_atribGUID, $d3, 'ptr')
    $__ACTOR[$i][4] = _MemoryRead($CurrentOffset + 0xB4, $d3, 'int')
    $CurrentOffset = $CurrentOffset + $ofs_LocalActor_StrucSize
    Next
    return $__ACTOR
    EndFunc
    Thanks for your time.

  8. #8
    g4b51l's Avatar Corporal
    Reputation
    2
    Join Date
    Nov 2012
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry...got confused between attrib and local actor....see below
    PHP Code:
        Global $ObjManACDOffset =  0x868//0x850;
        
    Global $ofs_LocalActor_ofs1 0x378 ;instead of $ofs_ActorAtrib_ofs2
        
    Global $ofs_LocalActor_ofs2 0x148
        
    Global $ofs_LocalActor_Count 0x108
            
        
    ;ACD(Actor Common Data)
        
    $_ObjectManager_Base  _MemoryRead($ofs_ObjectManager$d3'ptr')
        global 
    $_LocalActor_Base  _MemoryRead($_ObjectManager_Base+$ObjManACDOffset$d3'ptr')
        global 
    $_LocalActor_1 _MemoryRead($_LocalActor_Base$d3'ptr')

        global 
    $_LocalActor_Count  $_LocalActor_1+$ofs_LocalActor_Count;important
        
    global $_LocalActor_2  _MemoryRead($_LocalActor_1+$ofs_LocalActor_ofs2$d3'ptr')
        global 
    $_LocalActor_3  _MemoryRead($_LocalActor_2$d3'ptr') ;important 

  9. #9
    DarkAngelBGE's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hm, still no luck. Still getting zero for the count.

    Do you mind posting your IterateLocalActor function?

  10. #10
    DarkAngelBGE's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got the hp actor count working now, nice. Now, on to making the actual hp finding work ...

  11. #11
    DarkAngelBGE's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay got it all working fine now with the hp.

    However, it still reports some monsters in a specific location to have hp, even though there are no monsters there at all. : / So it didn't help much after all, or I have a bug in my code.

  12. #12
    g4b51l's Avatar Corporal
    Reputation
    2
    Join Date
    Nov 2012
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check Hp > 0.01 not 0 and maybe add a bad list like the example

  13. #13
    DarkAngelBGE's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, didn't help. Continueing the debugging hunt. Bot just attacked the ground again. IterateActorList shows:

    5 : 661663920 2014249043 : 49177144 5 297.826446533203 258.764923095703 -5.51931190490723 Wizard_Female-104 4.11215884611792
    6 : 661666056 -1 : 0 5 290.877288818359 258.134124755859 -8.22682094573975 Skeleton_B-573 7.28721433139776
    9 : 661669260 -1 : 0 5 298.396026611328 202.847290039063 -7.24944400787354 Skeleton_B-565 56.2397434160504
    30 : 661691688 -1 : 0 5 297.958190917969 268.808319091797 -11.644006729126 Skeleton_B-589 9.98027112886017
    48 : 661710912 -1 : 0 5 297.006652832031 277.465362548828 -13.4418830871582 Skeleton_B-572 18.8468163572269
    37 : 661699164 -1 : 0 5 286.884094238281 268.447631835938 -10.080771446228 Skeleton_B-525 14.5522163093167
    One entire monster mob just next to me, but it hasn't spawned, and all mob members have a guid of -1. So I think a check for guid -1 should definitely be there as well.

  14. #14
    boredevil's Avatar Active Member
    Reputation
    46
    Join Date
    Feb 2008
    Posts
    166
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you will have to check if the guid is valid. Invalid/killed mobs just stay in the list with a guid of -1 till their entry is replaced with something new or the client thinks it is time to cleanup the list.
    But anyway. Finding out, what mob is actually attackable is pretty nasty. These checks gave pretty good results for me:
    PHP Code:
        if(    acd->getActorType()                                       == D3::eActorType::Unit
            
    && acd->getInteger(D3::eGameAttributes::Is_NPC )             == false
            
    && acd->getInteger(D3::eGameAttributes::Invulnerable )       == false
            
    && acd->getInteger(D3::eGameAttributes::Untargetable)        == false
            
    && acd->getFloat(D3::eGameAttributes::Hitpoints_Cur)         > 0
            
    && acd->getFloat(D3::eGameAttributes::Hitpoints_Max_Total)   > 1
            
    && acd->getMonsterSno()->getType()                           != D3::eMonsterType::Ally
        

    But even after all these checks there are areas where you will have to blacklist some actors based on snoId or modelname.

    Maybe it´s just easier to maintain a whitelist for the area you are running + guid and hp checks

  15. #15
    DarkAngelBGE's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2013
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah that's what I am doing now. And it works good enough for most parts.

    Also fixed a bug that I had, where the wrong offset would be read (the actor after the one that should be read). Substracting objManagerStructSize before reading fixed it.

    Thanks for all your help!

Page 1 of 2 12 LastLast

Similar Threads

  1. Making my server public.PROBLEM!help
    By Fuynuns93 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 09-25-2007, 12:28 AM
  2. Recovery problems, help really needed!
    By stradivuckos in forum Community Chat
    Replies: 4
    Last Post: 08-08-2007, 07:41 AM
  3. Problem :-/ help
    By shdw in forum World of Warcraft General
    Replies: 9
    Last Post: 07-27-2007, 09:22 AM
  4. Fixing the Helm problem. Help please!
    By slasher.098 in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 06-30-2007, 04:34 AM
All times are GMT -5. The time now is 06:42 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search