Bear T.O.E. 63 Posted June 10, 2014 Share Posted June 10, 2014 Remember Im a novice at LUA. So please give me a detailed explanation so I can learn more. See Im still not sure how to through code together. So im finding other code and editing it to see if I can make it work for what im wanting to do. This is going to be a Disease Manager for DKs. Once the Disease get to 3 sec left of its target debuff then the DK will recast the move according to the disease to reapply it. if not (UnitIsDead("target")) and not (IsFlying("player")) and not (IsResting("player")) and not (UnitIsAFK("player")) then --[[ refresh the Diseases on the target if there are less then 3 sec left (to be sure that it dont run out while a fight ]] local timeLeftToCastAgain = 3; local idDiseases={59879,59921} --[[ Blood Plague,Frost Fever ]] idDiseases[1]={59879,59921} --[[ Outbreak,Plague Strike ]] idDiseases[2]={77575,45462} --[[ Outbreak,Icy Touch ]] idDiseases[3]={77575,45477} local now=GetTime(); for i=("1,2"),#idDiseases do local spell=""; local DiseaseFound=() for j=1,#idDiseases do spellname=GetSpellInfo(idDiseases[j]) local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitBuff("target",spellname); if (name==spellname) then local expireTimeLeft = expirationTime-now; DiseasesFound=idDiseases[j] if (expireTimeLeft < timeLeftToCastAgain) then if (IsUsableSpell(spellname)) then local start, duration, enable = GetSpellCooldown(spellname) if (duration==3) then CastSpellByName(spellname); spell=spellname; end end end break; end end if (DiseasesFound==0) then for j=("1,2"),#idDeases do local spellname=GetSpellInfo(idDeases[j]) if (IsUsableSpell(spellname)) then local start, duration, enable = GetSpellCooldown(spellname) if (duration==0) then CastSpellByName(spellname); spell=spellname; break; end end end end if not (spell=="") then print("Diseases: "..spell) result=true break; end end end result=(diseased>0) Link to comment https://wrobot.eu/forums/topic/1435-can-you-tell-me-why-this-isnt-working/ Share on other sites More sharing options...
Droidz 2738 Posted June 11, 2014 Share Posted June 11, 2014 local DiseasesFound = 0; if not (UnitIsDead("target")) and not (IsFlying("player")) and not (IsResting("player")) and not (UnitIsAFK("player")) then --[[ refresh the Diseases on the target if there are less then 3 sec left (to be sure that it dont run out while a fight ]] local timeLeftToCastAgain = 3; local idDiseases={59879,59921} --[[ Blood Plague,Frost Fever ]] idDiseases[1]={59879,59921} --[[ Outbreak,Plague Strike ]] idDiseases[2]={77575,45462} --[[ Outbreak,Icy Touch ]] idDiseases[3]={77575,45477} local now=GetTime(); for i=1,3,1 do local spell=""; --[[local DiseaseFound=() NOT USED ]] for j=1,2,1 do spellname=GetSpellInfo(idDiseases[i][j]) local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitBuff("target",spellname); if (name==spellname) then local expireTimeLeft = expirationTime-now; DiseasesFound=idDiseases[i][j] if (expireTimeLeft < timeLeftToCastAgain) then if (IsUsableSpell(spellname)) then local start, duration, enable = GetSpellCooldown(spellname) if (duration==3) then CastSpellByName(spellname); spell=spellname; end end end break; end end if (DiseasesFound==0) then for j=1,2,1 do local spellname=GetSpellInfo(idDiseases[i][j]) if (IsUsableSpell(spellname)) then local start, duration, enable = GetSpellCooldown(spellname) if (duration==0) then CastSpellByName(spellname); spell=spellname; break; end end end end if not (spell=="") then print("Diseases: "..spell) result=true break; end end end result=(DiseasesFound>0) --[[ replace result=(diseased>0)]] Try it Bear T.O.E. 1 Link to comment https://wrobot.eu/forums/topic/1435-can-you-tell-me-why-this-isnt-working/#findComment-7534 Share on other sites More sharing options...
Bear T.O.E. 63 Posted June 12, 2014 Author Share Posted June 12, 2014 Im going to try this today. And TY for the help. Ill edit this post to let you know if it is working. Droidz 1 Link to comment https://wrobot.eu/forums/topic/1435-can-you-tell-me-why-this-isnt-working/#findComment-7539 Share on other sites More sharing options...
Bear T.O.E. 63 Posted June 19, 2014 Author Share Posted June 19, 2014 Well it seems to work right Im doing some extended teasting. So I will be bck again if I find out it isnt working in the manner Im needing it to. Link to comment https://wrobot.eu/forums/topic/1435-can-you-tell-me-why-this-isnt-working/#findComment-7583 Share on other sites More sharing options...
Bear T.O.E. 63 Posted June 25, 2014 Author Share Posted June 25, 2014 OK Driodz is not casting Plague Strike to put Blood Plague on the target. Its not doing (1,2,1 do) meaning that --[[ Outbreak,Plague Strike ]]idDiseases[2]={77575,45462} Isnt being used for some reason or kept up on the target. But --[[ Outbreak,Icy Touch ]]idDiseases[3]={77575,45477} Is being kept up on the target. is there a reason why bot spells aren't being fires consecutively??? to keep the debuffs up on the target? Link to comment https://wrobot.eu/forums/topic/1435-can-you-tell-me-why-this-isnt-working/#findComment-7612 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now