[code](* + ------------------------------------------------------------- + | Mordak Bot | Dwarf Version. 05/08/2004 | | Edited By SnowFox & Valinor for Dwarf Use. | + ------------------------------------------------------------- +
WHAT THIS BOT DOES:
* Hunts 3 types of mobs if the first is gone it will move onto the second and etc. * Picks up to 4 different items after a mob kill * Can Spoil and Sweep Targets. * Rests if HP or MP falls below ~50% * Drinks potion if HP falls below ~20% * Attempts to move around if stuck or all enemies are exhausted
CHANGELOG: * Changed to Pickup 4 Items, added Sweep and Spoil Support in. *)
Constants /////////////////////////////////////////////////////// ////////////////////CONFIG START/////////////////////// /////////////////////////////////////////////////////// //NOTE: Be sure not to have a space after the equals sign for typed commands. // Do not use {F10} ACTools cannot press it properly. //Change NPCNAME to the Mob(s) of your choice. Target1 ={F7} //leave this as attack nearest target to pick up additional mobs. Target2 =/target [Garum Werewolf] //Seccondary target you want to Attack if the first one is not found. Target3 =/target [Blade Bat] //Third target you want to attack if the first two are not found. Target4 =/target [Magic Weaver] //Change Target 2 and 3 to {NULL} if you dont want yo use them. Attack = {F5} //Key or Command bound to the Attack. Pickup = {F6} //Key or Command bound to pickup. Potion = {null} //Key bound to Small potions. Spoil = {F1} //Key Bound to Spoil. Sweep = {F2} //Key Bound to Sweep. Skill = {null} //Key Bound to a Weapon Skill. (IE: Mortal Blow, Power Strike) /////////////////////////////////////////////////////// ////////////////////CONFIG END///////////////////////// /////////////////////////////////////////////////////// //WARNING:Do not edit below this line unless you know what you are doing. //Places cbar = 50, 557 targetx = 457, 0 fhealth = 125,25 mhealth = 81, 25 lhealth = 40, 25 fmana = 125, 45 mmana = 81, 45 lmana = 40, 45 fthealth = 447, 21 mthealth = 390, 21 lthealth = 326, 21 ftmana = 444, 25 mtmana = 390, 25 ltmana = 321, 25 //Definitions IsAttacking = False IsResting = False Returned = 0 Output = 0 m_health = 0 m_mana = 0 m_battacked = 0 m_thealth = 0 m_thcount = 0 m_thvalue = 0 //Temporary Variables tmpvar1 = 0 tmpvar2 = 0 tmpvar3 = 0 END
//PROGRAM ENTRY POINT SETActiveWindow Lineage II delay 1000
While 1=1 CALL MainLoop Delay 500 TimeStamp CONTINUE() continue END
Procedure MainLoop ////PREP CALL GetHealth SET $m_health = $returned CALL GetMana SET $m_mana = $returned IF $m_health <= 1 CALL DrinkPotion END CALL BeingAttacked SET $m_battacked = $returned ////END PREP IF $IsAttacking = True While 1=1 LoadRGB $targetx delay 50 compute $returned = {RGBRED} + {RGBGREEN} + {RGBBLUE} set $tmpvar1 = $returned LoadRGB $targetx delay 50 compute $returned = {RGBRED} + {RGBGREEN} + {RGBBLUE} set $tmpvar2 = $returned LoadRGB $targetx delay 50 compute $returned = {RGBRED} + {RGBGREEN} + {RGBBLUE} set $tmpvar3 = $returned IF $tmpvar1 = $tmpvar2 AND $tmpvar2 = $tmpvar3 SET $returned = $tmpvar1 BREAK END END IF $returned > 50 Timestamp TBar GONE Resetting CALL Pickup SET IsAttacking = False END CALL GetTargetHealth SET $m_thealth = $returned IF $m_thealth = $m_thvalue compute m_thcount = $m_thcount + 1 ELSE SET m_thcount = 0 SET m_thvalue = $m_thealth END IF $m_thcount >= 4 SET m_thcount = 0 SET m_thvalue = 0 SET IsAttacking = False CALL RandomMove END IF $m_thealth < 1 CALL Pickup SET $IsAttacking = False END delay 300 END//ISATTACKING IF $IsResting = True IF $m_mana > 2 AND $m_health > 2 CALL L2Say /stand delay 1 Sec SET $IsResting = False END END//RESTING IF $IsResting = False AND $IsAttacking = False TimeStamp Starting Next RF&AF IF $m_health >= 2 CALL Attack END IF $m_health < 2 OR $m_mana < 2 TimeStamp Rest Needed! CALL Rest END END//RF&AF END//MAINLOOP
//////////////////////// ////HELPER FUNCTIONS//// //////////////////////// Procedure Pickup TimeStamp PICKUP() CALL L2say $Sweep Delay 400 CALL L2say $pickup delay 300 CALL L2Say $pickup delay 300 CALL L2say $pickup delay 300 CALL L2Say $pickup END
Procedure RandomMove TimeStamp RANDOMMOVE() compute $returned = Random(X) * 10 keydown {RIGHT} $returned sec compute $returned = Random(X) * 15 keydown {UP} $returned sec END
Procedure Attack TimeStamp ATTACK() SET $IsAttacking = True CALL L2Say $target4 CALL L2Say $target3 CALL L2Say $target2 CALL L2Say $target1 Delay 600 CALL L2Say $Spoil Delay 2 sec Call L2Say $Attack Delay 4 Sec CALL L2Say $Attack Delay 3 sec CALL L2Say $Attack CALL Check END
Procedure Check CALL GetTargetHealth SET $m_thealth = $returned IF $m_thealth > 2 CALL Attack Delay 400 END END
Procedure Rest TimeStamp REST() CALL L2Say /sit SET $IsResting = True END
Procedure DrinkPotion TimeStamp DrinkPotion() While $tmpvar1 < 10 IsObject SmallPotion at 146,3 TimeStamp Already Drinking Potion... EXIT Else compute tmpvar1 = $tmpvar1 + 1 delay 100 End END CALL L2Say $potion END
Procedure L2Say using Text TimeStamp L2Say(): $Text keys $Text delay 50 keys {return} END
Procedure BeingAttacked //TODO SET $Returned = False END
Procedure GetHealth while 1=1 CALL GetHealthSub SET $tmpvar1 = $returned CALL GetHealthSub SET $tmpvar2 = $returned CALL GetHealthSub SET $tmpvar3 = $returned IF $tmpvar1 = $tmpvar2 AND $tmpvar2 = $tmpvar3 SET $returned = $tmpvar1 TimeStamp GetHealth(): $returned BREAK END END END
Procedure GetHealthSub Compute output = 0 LoadRGB $lhealth delay 50 IF {RGBRed} > 125 SET $Output = 1 END LoadRGB $mhealth delay 50 IF {RGBRed} > 125 SET $Output = 2 END LoadRGB $fhealth delay 50 IF {RGBRed} > 125 SET $Output = 3 END SET $Returned = $output END
Procedure GetMana while 1=1 CALL GetManaSub SET $tmpvar1 = $returned CALL GetManaSub SET $tmpvar2 = $returned CALL GetManaSub SET $tmpvar3 = $returned IF $tmpvar1 = $tmpvar2 AND $tmpvar2 = $tmpvar3 SET $returned = $tmpvar1 TimeStamp GetMana(): $returned BREAK END END END
Procedure GetManaSub Compute output = 0 LoadRGB $lmana delay 50 IF {RGBBlue} > 200 SET $Output = 1 END LoadRGB $mmana delay 50 IF {RGBBlue} > 200 SET $Output = 2 END LoadRGB $fmana delay 50 IF {RGBBlue} > 200 SET $Output = 3 END SET $Returned = $output END
Procedure GetTargetHealth while 1=1 CALL GetTargetHealthSub SET $tmpvar1 = $returned CALL GetTargetHealthSub SET $tmpvar2 = $returned CALL GetTargetHealthSub SET $tmpvar3 = $returned IF $tmpvar1 = $tmpvar2 AND $tmpvar2 = $tmpvar3 SET $returned = $tmpvar1 TimeStamp GetTargetHealth(): $returned BREAK END END END
Procedure GetTargetHealthSub Compute output = 0 LoadRGB $lthealth delay 50 IF {RGBRed} > 200 SET $Output = 1 END LoadRGB $mthealth delay 50 IF {RGBRed} > 200 SET $Output = 2 END LoadRGB $fthealth delay 50 IF {RGBRed} > 200 SET $Output = 3 END SET $Returned = $output END
Procedure GetTargetMana while 1=1 CALL GetTargetManaSub SET $tmpvar1 = $returned CALL GetTargetManaSub SET $tmpvar2 = $returned CALL GetTargetManaSub SET $tmpvar3 = $returned IF $tmpvar1 = $tmpvar2 AND $tmpvar2 = $tmpvar3 SET $returned = $tmpvar1 TimeStamp GetTargetMana(): $returned BREAK END END END
Procedure GetTargetManaSub Compute output = 0 LoadRGB $ltmana delay 50 IF {RGBBlue} > 100 SET $Output = 1 END LoadRGB $mtmana delay 50 IF {RGBBlue} > 100 SET $Output = 2 END LoadRGB $ftmana delay 50 IF {RGBBlue} > 100 SET $Output = 3 END SET $Returned = $output END
//////////////////////// ////////OBJECTS///////// ////////////////////////
Object SmallPotion // Test at coords 146,3 80=0,0|88=2,0|96=4,0|96=6,0|32=8,0|112=10,0|64=12,0|56=14,0|120=16,0|136=18,0|136=20,0| 72=0,2|80=2,2|88=4,2|80=6,2|40=8,2|168=10,2|72=12,2|40=14,2|104=16,2|128=18,2|136=20,2| 72=0,4|80=2,4|80=4,4|72=6,4|40=8,4|56=10,4|48=12,4|48=14,4|96=16,4|128=18,4|136=20,4| 64=0,6|72=2,6|80=4,6|80=6,6|72=8,6|96=10,6|48=12,6|8=14,6|96=16,6|120=18,6|128=20,6| 56=0,8|64=2,8|72=4,8|64=6,8|92=8,8|196=10,8|104=12,8|8=14,8|88=16,8|120=18,8|128=20,8| 56=0,10|64=2,10|64=4,10|64=6,10|136=8,10|204=10,10|128=12,10|8=14,10|88=16,10|112=18,10|120=20,10| 48=0,12|56=2,12|64=4,12|56=6,12|208=8,12|208=10,12|72=12,12|8=14,12|80=16,12|104=18,12|120=20,12| 48=0,14|48=2,14|56=4,14|64=6,14|200=8,14|200=10,14|112=12,14|4=14,14|80=16,14|104=18,14|112=20,14| 40=0,16|48=2,16|48=4,16|56=6,16|200=8,16|192=10,16|112=12,16|104=14,16|4=16,16|80=18,16|104=20,16| 32=0,18|40=2,18|40=4,18|176=6,18|192=8,18|192=10,18|168=12,18|168=14,18|168=16,18|24=18,18|88=20,18| 24=0,20|32=2,20|40=4,20|48=6,20|40=8,20|64=10,20|64=12,20|72=14,20|16=16,20|48=18,20|88=20,20| End [/code]
Edited Mordok Bot, alot of the Timings so its a bit faster.....
Also on line 227-253 the attack procedure at end I made it call Check...
and Check basically checks to see if the monster is not dead yet... Also it helps incase you run long distances, and are closer to some mobs and will call closest mob..... Also helps picking up add mobs..
w/e it aint much just something im putting down
|