Im using this code for attack
and it works ok. But on FallenGrunt in a2 (black canyon) the value:Code:Func Attack($range, $monsterList,$timeLimit,$grabit=True) While 1 $begin = TimerInit() $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 DEBUG("Fighting:" & $OBject[$i][2] & " dead?" & $OBject[$i][1] & " Other? " & $OBject[$i][7]) $Coords = FromD3toScreenCoords($OBject[$i][3], $OBject[$i][4], $OBject[$i][5]) MouseMove($Coords[0], $Coords[1], 3) MouseDown("left") ;480414416 $tempvalue = _MemoryRead($OBject[$i][9] + 0x4, $d3, 'ptr') While $tempvalue <> 0xFFFFFFFF Tooltip("ADDRES" & $OBject[$i][9],100,100) $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) Sleep(100) MouseDown("left") if TimerDiff($begin)>$timeLimit*1000 Then Return EndIf ;ToolTip("attacking" & $OBject[$i][2] & " value: " & $tempvalue,100,100) WEnd MouseUp("left") $foundtarget = 1 ExitLoop EndIf Next If $foundtarget = 0 Then if $grabit Then Grabit(75) EndIf ExitLoop EndIf MoveToPos($lastwp_x, $lastwp_y, $lastwp_z, 0, 25) MoveWait() ;exit fight after 60s if TimerDiff($begin)>$timeLimit*1000 Then Return EndIf WEnd EndFunc ;==>Attack
$tempvalue = _MemoryRead($OBject[$i][9] + 0x4, $d3, 'ptr')
will never be 0xFFFFFFFF.
$OBject[$i][9] contains the offset for that object. And if u read offset +0x4 you get the GUID which should be 0xFFFFFFFF if dead.
Or?
The strange thing is that it works on other monsters in the same area :/
Last edited by joxxe87; 08-04-2012 at 06:37 AM.
act 2 is strange some of the mobs run around with 0xFFFFFFFF. Well or u could just check their hitpoints via IterateActorAtribs($OBject[$i][1], $Atrib_Hitpoints_Cur) than if not 0 u can attack.
Btw - anyone knows how to cast on self(player) eg. wizard casting $DiamondSkin or $IceArmor. Is there a function tat can do this?
Thanks.
I'm running into the same problem, but usually there are one or two in the group that will take damage. I added some code to see how many monsters are close by:
; check to see if we have a mob nearby
For $i = 0 To UBound($OBjects, 1) - 1 ;go through each object
If $OBjects[$i][10] And $OBjects[$i][1] <> $isDead And $OBjects[$i][7] <> -1 And $OBjects[$i][8] < $range Then
$monstersInRange = $monstersInRange + 1
EndIf
Next
.
.
.
If $monstersInRange >= 3 Then
KillMonster($OBjects[$i][9], "right")
Else
KillMonster($OBjects[$i][9], "left")
EndIf
I'm using a DH with ball lightning on right click. So basically if there are multiples around a few volleys of ball lightning seems to get most of them. Once in awhile one or two get ignored or whatever, and run after my toon beating on him. I'm testing in nightmare so not an issue right now, but when I run inferno this could be bad news. So if someone finds a good solution please let us know.
I haven't looked into it to much I'm working on navigation stuff right now. But make sure you have some sort of timeout with an "ignore for x seconds" in there somewhere. I've found that once in awhile there is a monster behind a wall and my toon just wants to stand there shooting the wall. I've found a 3 second timout seems about right for my toon to run out of range, although it still does hang and stand there occasionally. I plan to look at it more once I'm happy with navigation.
I figure I'll add something else to handle mobs such as if more than X monsters launch trap, and if range is < X run dropping calitrops, then attack etc. something along those lines.
I got my navigation working pretty good. My looting is also working quite well. But looting is slowing things down quite a bit. I obviously only want to pick up items rare or better. I am using the code provided by Unknowned to get it's rarity. But as Unknowed comments state the loop is pretty slow. but it works great. But using it almost doubles my run times.
Does any one know of a faster way to determine if something is rare or better?
They way I look at it I have 3 options:
1. Use Unknowed's code to get accurate pickups but very slow runs
2. After killing, locate each item and do a pixel check on it's name to see if it's rare or better. (tried this, it's faster than Unknowed's but slow because it requires toon to hold still while checking, and I can see this missing items or getting falses depending on the background.)
3. Pick everything up and after picking up X items go through backpack and toss anything that isn't rare or better. (I haven't tried this but it might be the fastest)
I think my codes pretty efficient, but sometimes I have more than 600 objects in the list and iterating the objects as well as sorting them can get slow. But unfortunately I can't think of another way to find out what the monsters dropped on death, other than to reiterate the the list. For looting I only iterate the list once since everything's close anyway, a little walking inefficiency won't matter, and by doing gold grab last most of it's picked while picking up items.
Any suggestions?
@Diablo3Bot, well u could narrow down the search first i.e check the range of the object so that u dont need to go through every object. Since u just killed a bunch of mobs probably within 50-60 radius, so just limit the first scan to ignore distance > 50 or 60 so u dont iterate through the whole list. Similarly u do the same with mobs.
Good idea, Kizz, i find that its not that slow anyways, but, i guess, it all depends on your perspective.
Pathing is a pain in the arse, imo once, you dont deal with static area's anymore.
Are the random areas really random? Or are they randomed from a set of maps? If they are random selected from a set of maps it is much easier to do some good path finding.
Btw im running almost whole A2, and the only things that are randomised are entrances and wps. Not the whole map. But some dungeons are ranomized :/
Last edited by joxxe87; 08-07-2012 at 12:39 PM.
First of all, thank you UnknOwned, thank you so much for this amazing piece of code.
Here if i can suggest a much cleaner and better method/functions for object iterating.
Code:func startIterateObjectsList() global $_Count=memoryRead($_itrObjectManagerCount,'int') global $_i=0 global $_CurOffset=$_itrObjectManagerD EndFunc func iterateObjectsList() if $_i > $_Count Then return 0 $_i=$_i+1 global $GUID=memoryRead($_CurOffset+0x4,'ptr') global $NAME=memoryRead($_CurOffset+0x8,'char[64]') global $POS_X=memoryRead($_CurOffset+0xB0,'float') global $POS_Y=memoryRead($_CurOffset+0xB4,'float') global $POS_Z=memoryRead($_CurOffset+0xB8,'float') global $DATA1=memoryRead($_CurOffset+0x1FC,'int') global $DATA2=memoryRead($_CurOffset+0x1CC,'int') global $DATA3=memoryRead($_CurOffset+0x1C0,'int') global $DIST=getDistance($POS_X,$POS_Y,$POS_Z) $_CurOffset=$_CurOffset+$_ObjmanagerStrucSize return 1 EndFunc
Usage is very simple and clean (here for example a function to check if its safe around you (although checks only for two mob names :/))
Code:$isSafe=True startIterateObjectsList() while iterateObjectsList() if $GUID<>0xFFFFFFFF And _ ( StringInStr($NAME,'Zombie') or StringInStr($NAME,'Quill') ) And _ getDistance($POS_X,$POS_Y,$POS_Z)<50 _ Then $isSafe=False EndIf WEnd
And here i provide useful function that shows you objects list in nice gui window / list
C:Code:#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListviewConstants.au3> Func showObjectsList() $win=GUICreate("Objects list",820,650,-1,-1) $listview = GUICtrlCreateListView("GUID |POS_X|POS_Y|POS_Z|DISTANCE|DATA1|DATA2|DATA3|NAME ", 10, 10, 800, 600,$LVS_NOSORTHEADER) startIterateObjectsList() while iterateObjectsList() GUICtrlCreateListViewItem( _ StringFormat("%s|%5.2f|%5.5f|%5.5f|%5.5f|%s|%s|%s|%s ", _ $GUID,$POS_X,$POS_Y,$POS_Z,getDistance($POS_X,$POS_Y,$POS_Z),$DATA1,$DATA2,$DATA3,$NAME),$listview) WEnd ;AutoItSetOption("GUIDataSeparatorChar"," ") $input=GUICtrlCreateInput("", 10, 620, 670,20) $exitButton = GUICtrlCreateButton("Close", 690, 620, 120, 20) GUISetState() ;this will set last column to the max width without scrollbar ;based on http://www.autoitscript.com/forum/topic/73307-listview-auto-re-size/ $hLV=$listview If Not IsHWnd($hLV) Then $hLV = ControlGetHandle($win, "", $hLV) Local $hUser32DllOpen = DllOpen("user32.dll") Local $LV_Header = DllCall($hUser32DllOpen, "long", "SendMessage", "hwnd", $hLV, "int", $LVM_GETHEADER, "int", 0, "int", 0) Local $sItmsCnt = DllCall($hUser32DllOpen, "long", "SendMessage", "hwnd", $LV_Header[0], "int", 0x1200, "int", 0, "int", 0) Local $Columns_Count = $sItmsCnt[0] Local $iLV_Width = 0 Local $Columns_Width = 0 Local $GetColumns_Width For $i = 0 To $Columns_Count-2 $GetColumns_Width = DllCall($hUser32DllOpen, "long", "SendMessage", _ "hwnd", $hLV, "int", $LVM_GETCOLUMNWIDTH, "int", $i, "int", 0) $Columns_Width += $GetColumns_Width[0] Next Local $sLV_Width = ControlGetPos($win, "", $hLV) $iLV_Width = $sLV_Width[2]-$Columns_Width-$Columns_Count*3 DllCall($hUser32DllOpen, "long", "SendMessage", "hwnd", $hLV, "int", $LVM_SETCOLUMNWIDTH, "int", $Columns_Count-1, "int", $iLV_Width) DllClose($hUser32DllOpen) local $lastMsg; while 1 $msg=GUIGetMsg() If $msg=$GUI_EVENT_CLOSE Or $msg = $exitButton Then ExitLoop Else $newMsg=GUICtrlRead(GUICtrlRead($listview)) if StringCompare($newMsg,$lastMsg) Then $lastMsg=$newMsg GUICtrlSetData($input,$newMsg) endif EndIf WEnd GUIDelete($win) ;AutoItSetOption("GUIDataSeparatorChar","|") EndFunc
Last edited by j4x85e; 08-08-2012 at 01:59 AM.
This seem nice but why didn't u use the _ArrayDisplay function from autoit to display the objects ?
@j4x85e, Hey thanks alot for sharing your better method. But what is DATA3 that you have iterated?
Thanks again.
@tempo22 Thanks i didnt know about it. My function alters the listview a bit, you can notice that the last column is actually resized to maximum width without scrollbar.
@Kizzarse There were 3 $DATA variables in the first version: pastebin.com/0pQcz0zs (line 270)
Anybody know if this works on BootCamp?
I'm still trying to get it up and running but once I do I'll have stuff to contribute =D