Jump to content

Totem manager??


Bear T.O.E.

Recommended Posts

Ok I just through this together Im not sure if it will work can someone look at this code and tell if there is something wrong with it. I need it to check for Fire Elemental totem and Not cast if this totem is up. Im not sure how to do that. Then I can edit it to do the same thing for Magma totem.

I also need this one to recast after it have run for almost a minute, say at 10 second left on the timer.

 

 

 

 

 

if (GetUnitSpeed("player") == 0) and not (UnitCastingInfo("player")) and not (UnitChannelInfo("player")) and not (UnitAffectingCombat("player")) and not (IsMounted())  and not (IsFlying())  and not (IsFalling())  and not (IsResting())  and not (UnitIsAFK("player")) then
    local timeLeftToCastAgain = 10*60;
    local idTotem={3599}
--[[             Searing Totem ]]
    idTotem[1]={3599}
    local now=GetTime(10);
    for i=1,#idTotem do
        local TotemFound=0
        spellname=GetSpellInfo(idTotem)
            local haveTotem, totemName, startTime, duration = GetTotemInfo(1);
            if (haveTotem) then
                local expireTimeLeft = expirationTime-now;
                TotemFound=idTotem
                if (expireTimeLeft < timeLeftToCastAgain) then
                    if (IsUsableSpell(spellname)) then
                        local start, duration, enable = GetSpellCooldown(spellname)
                        if (duration==0) then
                            CastSpellByName(spellname);
                            spell=spellname;
                        end
                    end
                    
                end
                break;
            end
        end

Link to comment
Share on other sites

  • 2 weeks later...

Hi, I cannot test but try this code I have correct some errors.

if (GetUnitSpeed("player") == 0) and not (UnitCastingInfo("player")) and not (UnitChannelInfo("player")) and not (UnitAffectingCombat("player")) and not (IsMounted())  and not (IsFlying())  and not (IsFalling())  and not (IsResting())  and not (UnitIsAFK("player")) then
    local timeLeftToCastAgain = 10*60;
--[[             Searing Totem ]]
    local idTotem={3599}
    for i=1,#idTotem do
        local spellname=GetSpellInfo(idTotem[i])
		for totemIndex=1,4 do
			local haveTotem, totemName, startTime, duration = GetTotemInfo(totemIndex);
			if (haveTotem and spellname == totemName) then
				local timeLeft = startTime+duration-GetTime();
				if (timeLeft < timeLeftToCastAgain) then
					if (IsUsableSpell(spellname)) then
						local start, duration, enable = GetSpellCooldown(spellname)
						if (duration==0) then
							CastSpellByName(spellname);
						end
					end
					
				end
				break;
			end
		end
    end
end	
Link to comment
Share on other sites

Ok so is this how I get it to fire??? with the research needed?

if (GetUnitSpeed("player") == 0) and not (UnitCastingInfo("player")) and not (UnitChannelInfo("player")) and not (UnitAffectingCombat("player")) and not (IsMounted()) and not (IsFlying()) and not (IsFalling()) and not (IsResting()) and not (UnitIsAFK("player")) then
local timeLeftToCastAgain = 10*60;
--[[ Searing Totem ]]
local idTotem={3599}
for i=1,#idTotem do
local spellname=GetSpellInfo(idTotem[i])
        for totemIndex=1,4 do
            local haveTotem, totemName, startTime, duration = GetTotemInfo(totemIndex);
            if (haveTotem and spellname == totemName) then
                local timeLeft = startTime+duration-GetTime();
                if (timeLeft < timeLeftToCastAgain) then
                    if (IsUsableSpell(spellname)) then
                        local start, duration, enable = GetSpellCooldown(spellname)
                        if (duration==0) then
                            CastSpellByName(spellname);
                        end
                    end
                    
                end
                break;
            end
        end
end
end

result = (HaveTotem = 0)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...