Simple snare bot assistance

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Kannkor
a lesser mummy
a lesser mummy
Posts: 70
Joined: Sat Sep 02, 2006 2:30 pm

Simple snare bot assistance

Post by Kannkor » Wed Sep 06, 2006 9:55 pm

I'm new to MQ, and this is what I have come up with, and it works. However, I'm quite confident there are many better ways of doing it.

I'm not at the point where I can understand all of Genbot and raiddruid and some of the other macros to use/modify to fit my needs.

Currently, I have it check to see if it's snared since based upon if it is an NPC, % of health (for testing I used lower than 99%...) and checking the variable. When any mob dies, it resets the variable and only when a mob dies (or it wears off, which is extremely rare).

Which creates a few problems. If a mob elsewhere dies within notify range, it will resnare - not too big of a deal.. doesn't hurt to have a mob snared twice...
Bigger problem: If I pull 2 mobs, first one gets snared, then I switch. The second one won't get snared unless first one dies.

I'm looking for some education and possibly some example code with comments.

Here is the working code I currently have for this:

Code: Select all

#include spell_routines.inc

#Event EnsnareWornOff "#*#ensnare spell has worn off#*#" 
#Event Exp "#*#party experience!#*#" 
#Event Exp "#*#gain experience!#*#"
#Event Exp "#*#slain#*#"


Sub Main
	/echo 1...
	/declare Ensnared bool outer FALSE
	:loop
	|Snare check
	|/assist <<<<tank name>>>>
	/if (${Target.ID} && ${Target.PctHPs}<99 && !${Ensnared}) /call Ensnare 
	/doevents
	/delay 1s
	/goto :loop
/return

Sub Ensnare
	/call Cast "Ensnare" gem3 10s
	/if (${Macro.Return.Equal[CAST_SUCCESS]} || ${Macro.Return.Equal[CAST_IMMUNE]}) /varset Ensnared TRUE 
/return

Sub Event_Exp 
   /varset Ensnared FALSE 
/return 

Sub Event_EnsnareWornOff 
   /varset Ensnared FALSE 
/return 
Wiki updated http://www.macroquest2.com/wiki/index.php/Snare

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Wed Sep 06, 2006 10:17 pm

you might not want to wait for snare to ware all the way off so you can also put a timer in. can just modify alittle.

Code: Select all

/declare SnareTimer timer outer


/if (${Target.ID} && ${Target.PctHPs}<99 && !${Ensnared} && !${SnareTimer}) /call Ensnare 



Sub Ensnare
   /call Cast "Ensnare" gem3 10s
   /if (${Macro.Return.Equal[CAST_SUCCESS]} || ${Macro.Return.Equal[CAST_IMMUNE]}) {
 /varset Ensnared TRUE
/varset SnareTimer 3m
/return 
[/code]

Kannkor
a lesser mummy
a lesser mummy
Posts: 70
Joined: Sat Sep 02, 2006 2:30 pm

Post by Kannkor » Wed Sep 06, 2006 11:56 pm

Is there anything missing in that?

The If statement is now checking if Ensnared is false and Snaretimer is 0.
Ensnared won't be false unless it wears.. I assume need something that resets ensnared when snaretimer hits 0?

I've never used timers before.. sorry about the questions.

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Thu Sep 07, 2006 12:10 am

your event for wears off only fires if it wears off. With adding a timer you can recast snare (or any debuff really) before it wears off fully. Its nice to have the the WoreOff Event incase it gets dispelled tho you might want to do (!${Ensnared} || !${SnareTimer}) because as you said it wouldnt fire unless it wore off and snaretimer was up.

This should be correct I was half asleep when I replied earlier and not much better now.

If (HasTarget + TargetHPs lessthen 99 + (Snare=False OR SnareTimer=0)) dowhatever

Not sure if that makes sense or not

Code: Select all

/if (${Target.ID} && ${Target.PctHPs}<99 && (!${Ensnared} || !${SnareTimer})) /call Ensare

zanomo
a hill giant
a hill giant
Posts: 285
Joined: Thu Jun 24, 2004 11:21 pm

Post by zanomo » Thu Sep 07, 2006 1:44 am

Your basic logic is OK and based on your description, the logic should be:
Wait until a <NEW> assist target is acquired, Snare it once, If snared successful, go back to wait.

What's missing in your old logic is the check for new target. The resulting codes (removing the unecessary lines) would be:

Code: Select all

#include spell_routines.inc 


Sub Main 
   /echo 1... 
  [color=red]  /declare MOBID     int outer 0 [/color]   
:loop 
   |Snare check 
   /assist <<<<tank name>>>> 
   /if ([color=red]${Target.ID}!=${MOBID}[/color] && ${Target.PctHPs}<99 ) /call Ensnare
   /delay 1s 
   /goto :loop 
/return 

Sub Ensnare 
   /call Cast "Ensnare" gem3 10s 
   /if (${Macro.Return.Equal[CAST_SUCCESS]} || ${Macro.Return.Equal[CAST_IMMUNE]})  /varset MOBID ${Target.ID}
/return 
Once you got it working properly, you might want to add target checking such as, checking if the target is a NPC, if it is within range, if it is a corpse, etc.

Kannkor
a lesser mummy
a lesser mummy
Posts: 70
Joined: Sat Sep 02, 2006 2:30 pm

Post by Kannkor » Sat Sep 09, 2006 2:03 pm

I'd like to add to this a simple check for a group members health.

Is there any way to check a group members health without /targeting them then checking target.PctsHP?

Kannkor
a lesser mummy
a lesser mummy
Posts: 70
Joined: Sat Sep 02, 2006 2:30 pm

Post by Kannkor » Sat Sep 09, 2006 2:39 pm

I answered my own question... Thought I would post the response as I couldn't find anything on the boards. Found some information that helped me with this in Wiki.

I have my tank name set real time... for ease of use. Include this in the main sub

Code: Select all

/declare MainTank string outer Tank_Name_Here
In your loop.. add in the code below...
Change the "<100" to when you want the heal to start at, and change "Healing" to what ever spell you want to use.

Code: Select all

/if (${Group.Member[${Group.Member[${MainTank}]}].PctHPs}<100) {
/target ${Group.Member[${Group.Member[${MainTank}]}]}
/call Cast "Healing" gem1 5s
}

Kannkor
a lesser mummy
a lesser mummy
Posts: 70
Joined: Sat Sep 02, 2006 2:30 pm

Post by Kannkor » Sat Sep 09, 2006 3:43 pm

Is there a way to check a someone else's target's health without targeting them?

I tried Group.Member[1].Target but that doesn't exist.

Basically - I only want to target the NPC if I'm going to do something. I don't want to have to /assist <tank name> then check PctHP of target.

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Sun Sep 10, 2006 12:40 pm

only way to check the health of someones target is with Health Of Healths Target but you need the LeaderAA.

eddashmatt

Post by eddashmatt » Mon Jun 04, 2007 9:13 am

/deletevar TargetHealth
/deletevar Assist

/declare TargetHealth int global
/declare Assist string global

/varset TargetHealth ${Param0}
/varset Assist ${Param1}

you can also add the above to it so that you can set the tank name and health at which you want to snare. This way its easier to pick a new tank and snare the mob at a different health if needed

/mac <mac name> <target health> <tank name>

Code: Select all

 
#include spell_routines.inc 

#Event EnsnareWornOff "#*#ensnare spell has worn off#*#" 
#Event Exp "#*#party experience!#*#" 
#Event Exp "#*#gain experience!#*#" 
#Event Exp "#*#slain#*#" 


Sub Main 

/deletevar TargetHealth 
/deletevar Assist 

/declare TargetHealth int global 
/declare Assist string global 

/varset TargetHealth ${Param0} 
/varset Assist ${Param1} 


   /echo 1... 
   /declare Ensnared bool outer FALSE 
   :loop 
   |Snare check 
   |/assist ${Assist}
   /if (${Target.ID} && ${Target.PctHPs}<=${Targetheath} && !${Ensnared}) /call Ensnare 
   /doevents 
   /delay 1s 
   /goto :loop 
/return 

Sub Ensnare 
   /call Cast "Ensnare" gem3 10s 
   /if (${Macro.Return.Equal[CAST_SUCCESS]} || ${Macro.Return.Equal[CAST_IMMUNE]}) /varset Ensnared TRUE 
/return 

Sub Event_Exp 
   /varset Ensnared FALSE 
/return 

Sub Event_EnsnareWornOff 
   /varset Ensnared FALSE 
/return 

[/code]

georgesilver
orc pawn
orc pawn
Posts: 16
Joined: Tue May 25, 2004 9:10 am

chatparse.inc snare

Post by georgesilver » Sun Jul 01, 2007 1:06 pm

Added this to Chatparse.inc of the AFcleric chatparse..

just have to tell the toon "snare"

Code: Select all

 }
   /if (${ChatText.Equal[snare]}) {
      /call FindExactPC ${Sender}
      /assist ${Sender}
      /delay 1s
      /if (${Macro.Return.NotEqual[TARGET_SUCCESS]}) /return
      /call Cast "Ensnare" gem9 15s

xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Simple snare bot assistance

Post by xyilla » Mon Jul 28, 2025 11:35 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Simple snare bot assistance

Post by xyilla » Mon Jul 28, 2025 11:36 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Simple snare bot assistance

Post by xyilla » Mon Jul 28, 2025 11:37 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Simple snare bot assistance

Post by xyilla » Mon Jul 28, 2025 11:38 am