ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: The Ghost on March 25, 2016, 04:40:56 AM
-
Hello
I'm trying to make a sub that will find a monster attack him and wait for it to die or change form. I have the first part of the sub to work. Where I'm having issue is in the repeat loop. Can't seen to get it right. Can someone point me to the right direction.
I have try a few Until xxxxx . My knowledge is limited on those
set %attack IS
Sub attack_A
Finditem %attack G_10
if ( #FindID <> #CharID && #FindRep notin %noattack )
{
set #ltargetid #findid
set #ltargetkind 1
set %attack #ltargetid
if #findcnt <> 0
{
event macro 1 0 all kill
target
event macro 22 0 ; last target
wait 40
ignoreitem %attack
}
repeat
Finditem %attack G_10 < ------ this is to scan until the ID change.
until #findkind = -1 < ------ when it ID chance it will exit Need to try until #FALSE
ignoreitem reset
}
return
-
Here is what I use. May not be pretty coding, but it works.
;===========================
; Kill Monsters
;===========================
sub kllmnstr
finditem %mnster G_5
if #findkind = -1
return
set %mnsterID #findid
finditem %mnsterID
set #ltargetid %mnsterID
set #ltargetkind = 1
event macro 3 0 all kill
target
event macro 22
wait 20
gosub checkifdead
wait 20
return
;===========================
; Death Check
;===========================
sub checkifdead
set %klltm 1
scan:
finditem %fanID
if #findkind = -1
{
return
}
set %klltm %klltm + 1
if %klltm > 200
return
goto scan
-
Hello
I'm trying to make a sub that will find a monster attack him and wait for it to die or change form. I have the first part of the sub to work. Where I'm having issue is in the repeat loop. Can't seen to get it right. Can someone point me to the right direction.
I have try a few Until xxxxx . My knowledge is limited on those
set %attack IS
Sub attack_A
Finditem %attack G_10
if ( #FindID <> #CharID && #FindRep notin %noattack )
{
set #ltargetid #findid
set #ltargetkind 1
set %attack #ltargetid
if #findcnt <> 0
{
event macro 1 0 all kill
target
event macro 22 0 ; last target
wait 40
ignoreitem %attack
}
repeat
Finditem %attack G_10 < ------ this is to scan until the ID change.
until #findkind = -1 < ------ when it ID chance it will exit Need to try until #FALSE
ignoreitem reset
}
return
while #findkind <> -1
Finditem %attack G_10
-
Thx, I got new option to try love it.
-
This is look so simple , but I still having issue I have try Tidus Idea and the loop at the bottom still getting stuck.
set %monsterstop ED
set %attack IS
sub StopAttack
Finditem %monsterstop G_10
set #ltargetid #findid
set #ltargetkind 1 ; 1= Object 2= Ground 3= Resource (tree)
set %monsterstop #ltargetid
if #findcnt <> 0
{
event macro 1 0 all stop
wait 20
event macro 1 0 all stay
wait 20
ignoreitem %monsterstop
}
while #findkind <> -1
Finditem %attack G_10
ignoreitem reset
Return
-
I use this for melee in champ spawns... afk away! (this is just a snipper, but I think its along the lines of what you're looking for)
one word of caution... I freaking HATE ignoreitem. much like event property 9 times out of 10, there is a better way.
repeat
event macro 52 5 ;target nearest
set #lpc 1
finditem #ltargetid * g
set #lpc 20
until #finddist < 2
event macro 53
while #ltargetid = #enemyid && #enemyhits > 0 && #finddist < 2
{
if g notin #charstatus
event macro 6 0 ;war toggle
;event macro 53 0 ;attack
wait 5
set #lpc 1
finditem #ltargetid * g
set #lpc 20
}
modified for pets:
repeat
event macro 50 5 ;target next
set #lpc 1
finditem #ltargetid * g
set #lpc 20
until #finddist < 10 && #findid notin #charid , %aListOfYourPetIdsSeperatedWithUnderscores
event macro 1 0 All kill
target
event macro 22 0 ;no need to set ltargetid or kind because 50 5 does it for you
event macro 53 0 ;attack selected - populates #enemyinfo
while #enemyhits > 0 && #finddist < 10
wait 0
event macro All guard me ;or whatever...
you may want to use something other than #finddist, but maybe not. target next/last runs into issues with not being able to pick up things a certain amount of tiles away. not really sure where the break is, but 10 seems to work ok (minor issues) so just make sure to stay within 10 tiles of the target.
MAKE SURE TO ADD OUR PETIDS to the do not kill list...