/declare healTimer_@spawnID timer

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

Ogre_Luvr
a lesser mummy
a lesser mummy
Posts: 52
Joined: Thu Dec 18, 2003 10:11 pm
Location: DC

/declare healTimer_@spawnID timer

Post by Ogre_Luvr » Fri Apr 23, 2004 4:50 pm

should this work? I was doing this before and it worked..

Code: Select all

                /if (!${Defined[healTimer_@spawnID]}) {
                	/declare healTimer_@spawnID timer
                	/varset healTimer_@spawnID 0
                } 
                
                |||	Cast the duration heal and set the timer
                /if (${Math.Calc[@healTimer_@spawnID<1]}) {
                	/call cast "@durationHeal"
                	/varset healTimer_@spawnID $calc($spell("@durationHeal",duration)*10)				
                }

Code: Select all

|************************************|
|* nClericGroup.mac 				*|
|* by Ogre_Luvr						*|
|* Usage: /mac clericgroup Soandso	*|
|* A work in progress             	*|
|************************************|


#include nSpellCast.inc 

Sub main
	/zapvars

	/declare mainHeal global
		/varset mainHeal "Remedy"
	/declare durationHeal global
		/varset durationHeal "Celestial Healing"
	/declare bigHeal global
		/varset bigHeal "Complete Healing"		
	/declare tankID global
		/if (${Spawn[@Param0].ID}) {
			/varset tankID ${Spawn[@Param0].ID}
		} else {
			/varset tankID 0		
		}
	:mainLoop
		/call checkHP
	/goto :mainLoop
/return

Sub checkHP
	/declare lowHP local
		|||	set the baseline for the hp check to me so i get checked (since i am not a member of the group)
		/varset lowHP ${Me.ID}
	/declare i local
	|||	iterate through the group
    /for i 1 to ${Group}
    	|||	If the group member's HP is lower than the stored member set the ner member as low
		/if (${Math.Calc[${Group[@i].PctHPs}<${Spawn[@lowHP].PctHPs}]}) {
			/varset lowHP ${Group[@i].ID}
		}
		|||	if the group member is a pet class check thier pet's HP
		|||	and they have a pet up
		|||	and the pet is lower than the stored member
    	/if (${String[@petClasses].Find[${Group[@i].Class}]} && ${Group[@i].Pet.ID} && ${Math.Calc[${Group[@i].Pet.PctHPs}<${Spawn[@lowHP].PctHPs}]}) {
				/varset lowHP ${Group[@i].Pet.ID}
    	} 
    /next i
    
    ||| if the low member is below the threshold .. heal them
    /if (${Math.Calc[${Spawn[@lowHP].PctHPs}<70]}) {
    	/call heal @lowHP
    }
/return

Sub heal(spawnID)
	/target id @spawnID
	|||	if @spawnID isn't the tank do a normal heal
	/if (${Math.Calc[@spawnID!=@tankID]}) {
		|||  if the spawn in question is less than 45% health and in range of the heal spell
    	/if (${Math.Calc[${Spawn[@spawnID].PctHPs}<45]} && ${Math.Calc[${Spawn[@spawnID].Distance}<=${Spell["@mainHeal"].Range}]}) {
    		/call cast "@mainHeal"
    	} else {
			|||	if the spawn in question is less than 70% health and in range of the duration heal spell
    		/if (${Math.Calc[${Spawn[@spawnID].PctHPs}<70]} && ${Math.Calc[${Spawn[@spawnID].Distance}<=${Spell["@durationHeal"].Range}]}) {
				|||	If the spawn in question does not have a heal timer defined for him/her make one
                /echo ${Defined[healTimer_@spawnID]}
                /if (!${Defined[healTimer_@spawnID]}) {
                	/declare healTimer_@spawnID timer
                	/varset healTimer_@spawnID 0
                } 
                
                |||	Cast the duration heal and set the timer
                /if (${Math.Calc[@healTimer_@spawnID<1]}) {
                	/call cast "@durationHeal"
                	/varset healTimer_@spawnID $calc($spell("@durationHeal",duration)*10)				
                }
    		}
    	}
    } else { |||	its the tank
    	|||  If the tank has less than 45% hp 
    	|||		and in range of the big heal spell 
    	|||		and you have enough mana ... announce and heal him
    	/if (${Math.Calc[${Spawn[@spawnID].PctHPs}<=45]} && ${Math.Calc[${Spawn[@spawnID].Distance}<=${Spell["@bigHeal"].Range}]} && ${Math.Calc[${Me.CurrentMana}>=${Spell[@bigHeal].Mana}]}) {
			/g inc @bigHeal to ${Spawn[@spawnID].Name}
			/call cast "@bigHeal"
    	}
    }
/return