I revised my macro
Note: when you are avoiding monster, make sure that the monster name is in mon_control.txt!
ex:
Geographer -1 0 0
Code: Select all
automacro monster {
monster Geographer < 7 ###put monster names here
timeout 5
overrideAI 1
exclusive 1
call avoid
}
macro avoid {
[
$monpos = $.lastMonsterPos
$mypos = $.pos
$myx = @arg ("$mypos", 1)
$myy = @arg ("$mypos", 2)
$monx = @arg ("$monpos", 1)
$mony = @arg ("$monpos", 2)
$num = @rand (3, 10)
$angle = @rand (3, 7)
$move = @rand (3, 15)
$sign = @random ("+", "-")
]
do eval warning "[MonsterAvoid] $.lastMonster at ($monx,$mony) is near, avoiding contact...\n";
[
if ($monx <= $myx) goto east
if ($monx >= $myx) goto west
]
[
:east
[
if ($mony >= $myy) goto southeast
if ($mony <= $myy) goto northeast
]
do east $num
stop
[
:southeast
$direction = SouthEast
$x = @eval ($myx $sign $angle)
$y = @eval ($myy - $move)
do eval $::Macro::Data::varStack{walkable} = $::field->isWalkable($x, $y) ? 1 : 0
if ($walkable == 1) goto greatEscape
goto rand
stop
:northeast
$direction = NorthEast
$x = @eval ($myx $sign $angle)
$y = @eval ($myy + $move)
do eval $::Macro::Data::varStack{walkable} = $::field->isWalkable($x, $y) ? 1 : 0
if ($walkable == 1) goto greatEscape
goto rand
stop
]
:west
[
if ($mony >= $myy) goto southwest
if ($mony <= $myy) goto northwest
]
do west $num
stop
[
:southwest
$direction = SouthWest
$x = @eval ($myx $sign $angle)
$y = @eval ($myy - $move)
do eval $::Macro::Data::varStack{walkable} = $::field->isWalkable($x, $y) ? 1 : 0
if ($walkable == 1) goto greatEscape
goto rand
stop
:northwest
$direction = $NorthWest
$x = @eval ($myx $sign $angle)
$y = @eval ($myy + $move)
do eval $::Macro::Data::varStack{walkable} = $::field->isWalkable($x, $y) ? 1 : 0
if ($walkable == 1) goto greatEscape
goto rand
stop
]
[
:rand
do eval AI::clear("move", "route");
]
:greatEscape
do move $x $y
do eval print "[MonsterAvoid] Moving $direction ($x, $y) to avoid $.lastMonster ($monx, $mony)\n";
}
###########################
#####monsters to avoid#####
###########################
Amon Ra, Archangeling, Baphomet, Bacsojin, Dark Illusion, Dark Lord, Detale, Doppelganger, Dracula, Drake, Eddga, Dark Snake Lord, Garm, Egnigem Cenia, Golden Thief Bug, Incantation Samurai, Lady Tany, Lord of Death, Maya, Maya Purple, Mistress, Moonlight, Mutant Dragon, Orc Hero, Orc Lord, Osiris, Pharaoh, Phreeoni, RSX-0806, Stormy Knight, Tao Gunka, Thanatos, Turtle General, Vesper, Howard Alt-Eisen, Seyren Windsor, Eremes Guile, Margaretha Sorin, Cecil Damon, Kathryne Keyron, Lord Knight Seyren, Assassin Cross Eremes, Whitesmith Howard, High Priest Margaretha, Sniper Cecil, High Wizard Kathryne, Morroc's Shadow Angel, Vocal, Morroc's Shadow Human, Abysmal Knight, Thanatos, Memory of Thanatos, Thanatos Despero, Despero of Thanatos, Thanatos Dolor, Dolor of Thanatos, Thanatos Maero, Maero of Thanatos, Thanatos Odium, Odium of Thanatos, Incantation Samurai, Samurai Specter, Incarnation of Morroc, Incarnation of Morroc, Sniper Shecil, Sniper Cecil, Bloody Knight, Knight Guardian, Knight of Abyss, Abysmal Knight, Knight of Windstorm, Stormy Knight, Lord Knight Seyren, Archdam, Archer Guardian, Acidus, Agav Alicel, Aliot, Amon Ra, Ancient Mimic, Ancient Mummy, Ancient Worm, Anolian, Anubis, Apocalypse, Armaia, Armeyer Dinze, Assassin Cross Eremes, Atroce, Aunoe, Bacsojin, White Lady, Baphomet, Banshee, Beelzebub, Bloody Butterfly, Bloody Murderer, Bow Guardian, Bow Master, Byorgue, Cat o' Nine Tails, Chimera, Chung E, Green Maiden, Civil Servant, Mao Guai, Dark Illusion, Dark Lord, Dark Priest, Dark Snake Lord, Evil Snake Lord, Deathword, Death Word, Deleter, Detale, Detarderous, Deviling, Diabolic, Dimik, Doppelganger, Dracula, Drake, Dullahan, Echio, Eddga, Entweihen Crothen, Eremes, Eremes Guile, Erend, Errende Ebecee, Executioner, Fallen Bishop, Fallen Bishop Hibram, Fanat, Ferus, Frus, Garden Watcher, Garden Keeper, Garm, Garm Baby, Gazeti, Gemini-S58, Gloom Under Night, Gremlin, Gryphon, Harpy, Harword, Howard Alt-Eisen, Hell Fly, Hellion Revenant, High Priest Magaleta, High Priest Margaretha, High Wizard Katrinn, High Wizard Kathryne, Hodremlin, Hydro, Hydrolancer, Ice Titan, Ifrit, Imp, Fire Imp, Samurai Specter, Incubus, Isilla, Kasa, Katrinn, Kathryne Keyron, Kavac, Kavach Icarus, Kiel, Kiehl, Knight Guardian, Lady Tanee, Lava Golem, Leib Olmai, Loli Ruri, Lord Knight Seyren, Lord of Death, Lord of the Dead, Magaleta, Margaretha Sorin, Majoruros, Marozka's Guard, Mavka, Maya, Maya Purple, Medusa, Mini Demon, Monemus, Mutant Dragon, Mutant Dragonoid, Mysteltainn, Naght Seiger, Necromancer, Nightmare Terror, Observation, Dame of Sentinel, Owl Baron, Owl Duke, Penomena, Pharaoh, Phendark, Piamette, Ragged Zombie, Rawrel, Laurell Weinder, Retribution, Baroness of Retribution, RSX 0806, RSX-0806, Salamander, Satan Morroc, Seyren, Seyren Windsor, Shecil,Cecil Damon, Shelter, Mistress of Shelter,, Shinobi, Skeggiold, Skogul, Sniper Shecil, Sniper Cecil, Soldier Guardian, Succubus, Sword Guardian, Sword Master, Thanatos, Memory of Thanatos, The Immortal Koshei, Thorn of Magic, Thorn of Purification, Thorn of Recovery, Thorny Skeleton, Tirfing, Ogretooth, Tristan III, Dead King, Ungoliant, Valkyrie, Valkyrie Randgris, Vanberk, Venatu, Vesper, Violy, Whitesmith Harword, Mastersmith Howard, Wicked Nymph, Evil Nymph, Wish Maiden, Wounded Morroc, Ygnizem, Egnigem Cenia, Zombie Slaughter, Rideword, Morroc's Shadow Golem