Feign Death (An addition to pre-existing code)

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Sadistic
orc pawn
orc pawn
Posts: 11
Joined: Mon Jan 19, 2004 1:33 am

Feign Death (An addition to pre-existing code)

Post by Sadistic » Sat Apr 03, 2004 5:19 pm

Right now im using this lovely peice of code:

Code: Select all

| Modified rogue.mac 
| Credits to Jay (rogue.mac) and Lasher et. al. (genbot.mac) 
| 
| Cleaned up some of the code, tossed the xp stuff and fixed events, 
| evade and getbehind. 
| 
| Usage: /macro rogue.mac <Assist> <AssistHealth> 


#Event Enraged "has become ENRAGED" 
#Event Offrage "is no longer enraged" 
#Event Slainby "You have been slain by" 

#include routines.mac 
#turbo @turboamount 

Sub main 

/Declare assisthealth global 
/Declare turboamount global 
/Declare sneakhide global 
/Declare engagedistance global 
/Declare countdown global 
/Declare MyXLoc global 
/Declare MyYLoc global 
/Declare targetname global 
/Declare targetid global 
/Declare tankname global 
/Declare attacktarget global 
/Declare tempvar global 
/Declare behindtarget global | 1 = True, 0 = False 
/Declare targetenrage global | 1 = True, 0 = False 
/Declare mobdetail array2 | Mob details array 

/Varset assisthealth @Param1 | Wait until mob is below this health trigger. 
/Varset turboamount 380 | Turbo Amount, Change at your own risk, was 380. 
/Varset sneakhide 0 | Sneak Hide between kills; 1 = Yes, 0 = No 
/Varset engagedistance 200 | How close mob must be to engage 
/varset tankname @Param0 
/varset tempvar 0 

/echo "Auto Rogue Version 1.07 Starting" 
/echo "@tankname is assist tank." 

/if n @sneakhide==1 { 
/doability "Sneak" 
/delay 5 
/doability "Hide" 
} 

:Wait 
/assist @tankname 
/delay 10 

/if "$target()"=="FALSE" { 
/target @tankname 
/face 
/goto :Wait 
} 

/if "$target(type)"!="NPC" { 
/face 
/goto :Wait 
} 

/if n @tempvar!="$target(hp,pct)" { 
/echo $target(name,clean) targeted at $target(hp,pct)% at distance $target(distance). 
} 

/varset tempvar "$target(hp,pct)" 
/face 

/if n "$target(hp,pct)"<=@assisthealth { 
/if n "$target(distance,noprodict)<@engagedistance" { 
/if n "$target(pet)==0" /goto :Attack 
} 
} 

/Attack off 
/DoEvents 
/goto :Wait 

:Attack 
|/doability "Sneak" 
/echo Fighting $target(name,clean). It is a level $target(level) $target(race). 
/varset mobdetail(8,0) "$target(name,clean)" 
/varset mobdetail(1,1) $target(level) 
/varset mobdetail(1,2) $target(name) 
/varset mobdetail(1,3) $target(id) 
/varset targetname $target(name) 
/varset targetid $target(id) 
/varset attacktarget 1 
/varset behindtarget 0 
/varset targetenrage 0 
/face 
/sendkey down up 

/if n @attacktarget==1 /attack on 

:AttackLoop 
/assist @tankname 
/if "$target()"=="FALSE" /goto :AttackEnd 
/if "$target(id)"!="@targetid" /goto :AttackEnd 

/doevents 

/call GetBehind 

/if n @attacktarget==1 { 
/attack on 

/if n $target(distance)<$target(maxrange) { 
/doability "flying kick"
/attack off 
/delay 1 
/attack on 
} 
} 

/if n @attacktarget==0 /Attack off 

/face fast 
/if n $target(distance)>25 /sendkey down up |If target is farther then 18 move forward 
/if n $target(distance)<8 /sendkey down down |If target is closer then 8 move back 
/if n $target(distance)<20 /sendkey up up |If target is closer then 10 stop moving forward 
/if n $target(distance)>18 /sendkey up down |If target is farther then 9 stop moving back 
/face fast 

/doevents 

/goto :AttackLoop 

:AttackEnd 
/echo "@targetname has died" 
/sendkey up up 
/sendkey up down 
/sendkey up ctrl 
/varset attacktarget 0 
/varset tempvar 0 
/attack off 
/echo "Waiting for @tankname to select a new target..." 

/if n @sneakhide==1 { 
|/doability "Sneak" 
/delay 5 
|/doability "Hide" 
} 

/goto :Wait 

/return 

Sub GetBehind 
/varset countdown 0 
/varset MyXLoc $char(x) 
/varset MyYLoc $char(y) 

/if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))<3 { 
/goto :noneed 
} 

/if $target()==FALSE /return 

/sendkey down up 

:gobehindloop 

/if $target()==FALSE { 
/sendkey up up 
/return 
} 

/if n @countdown>=20 { 
/if n @MyXLoc==$char(x) { 
/if @MyYLoc==$char(y) { 
/sendkey up up 
/return 
} 
} 

/varset MyXLoc $char(x) 
/varset MyYLoc $char(y) 
/varset countdown 0 
} 

/varadd countdown 1 
/doevents 

/if "$char(state)"=="SIT" /stand 
/if "$char(state)"=="FEIGN" /stand
/face nolook fast loc $calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10) 
/if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))>1 /goto :gobehindloop 

/sendkey up up 
/if "$char(state)"=="SIT" /stand 
/if "$char(state)"=="FEIGN" /stand
/face fast 

:noneed 

/return 

| ----- Events called by /DoEvents ----- 

Sub Event_Enraged 
/varset attacktarget 0 
/attack off 
/return 

Sub Event_Offrage 
/varset attacktarget 1 
/attack on 
/return 

Sub Event_Slainby 
/endmacro 
/return
I have augmented it a bit so far for use on a monk as opposed to a rogue which it was intended for. The original burned evade at every opportunity, which is good for keeping rogues alive. However on a monk thats a bit of a waste since theres an animation involved with FD making a contant FD not very practical. My 3 options are:

  • *Make something that periodically does an FD based on some sorta internal timer. Every 10seconds or so.

    *Make something thats watching for anything agro related such as an riposte or attempted swing on my toon and tags FD if its ready.

    *Make something that momentarily halts the auto movebehind this macro uses and checks to see if the mob is facing my toon, if true and and FD is up burn FD. If false turn off autoattack, delay untill FD is ready, burn FD and then resume automove behind activities.

    *Make something thats monitering my life actively, Should I take damage in any way burn FD and reset the variable storing my hp to whatever my current hp is after the hit
Since the macros run in an infinite loop Im having a hard time thinking of how to do FDs on a fixed interval other than how long it takes for the button to repop, unless theres some sorta command to return my system time where I could perform some kinda math calc on it and say if the time is divisible by 10 seconds hit FD.

The second would seem to be a matter of events?

The third requires knowledge which I just dont have, specifically the movement code. I can read through the code and know more or less whats going on but the calculations used in the macro to determine what direction the mob is facing is above my head coding wise.

The fourth would require a global variable to be compared at the start or finish of each major section along with a call to FD if ive been damaged and then setting my new life total equal to my current life total.

The downfalls of the last one that come to mind are casting mobs and heal related events would have to be taken into account.

Im not sure which of these systems to choose from but if I had to guess id say the third is the most advance out of all of them. What do you all recommend?