"Attack" in the GUI is the same as 0 when hand editing the files.
However, that alone will not do what you want.
If it's casting it on your feet, you've hijacked completely the wrong set of logic - the "cast an AoE skill on owner's feet" is the auto-buff handling (we treat that as a buff, since it's a skill that needs to be cast on the owner periodically) - that's a totally different part of the code than the part where we're using attack skills on monsters.
If you want it to use Volcanic Ash on monsters it's attacking, you need a totally different approach!
The first thing you should do is start with a clean copy of AzzyAI 1.52, and DO NOT MODIFY ANY FILES other than the config files and H_Extra, that way you can upgrade to 1.53 when it comes out and not lose all your work. If you need to replace a function, just put your new function definition in H_Extra - it's loaded last, and will replace the original functoin.
As i see it, there are three ways you could do this (all of these start with a CLEAN 1.52 install):
Method 1:
Replace Lava Slide with Volcanic Ash by overriding GetMobSkill(); you would put this into H_Extra of clean install. Differences from stock are highlighted:
function GetMobSkill(myid)
local skill = 0
local level = 0
if (IsHomun(myid)==1) then
htype=GetV(V_HOMUNTYPE,MyID)
if htype <17 then
skill=0
else -- it's a homun s
if htype==EIRA and UseEiraXenoSlasher==1 then
skill=MH_XENO_SLASHER
if EiraXenoSlasherLevel==nil then
level=4
else
level=EiraXenoSlasherLevel
end
elseif htype==BAYERI and UseBayeriHailegeStar==1 then
skill=MH_HEILIGE_STANGE
if BayeriHailegeStarLevel==nil then
level=5
else
level=BayeriHailegeStarLevel
end
elseif htype==SERA and UseSeraPoisonMist==1 and PoisonMistMode==0 then
skill=MH_POISON_MIST
if SeraPoisonMistLevel==nil then
level=5
else
level=SeraPoisonMistLevel
end
elseif htype==DIETER and (UseDieterVolcanicAsh==1 or (UseDieterLavaSlide==1 and LavaSlideMode==0)) then
if UseDieterVolcanicAsh==1 then
skill=MH_VOLCANIC_ASH
level=5
else
skill=MH_LAVA_SLIDE
if DieterLavaSlideLevel==nil then
level=5
else
level=DieterLavaSlideLevel
end
end
end
if AutoSkillCooldown[skill]~=nil then
if GetTick() < AutoSkillCooldown[skill] then -- in cooldown
level=0
skill=0
end
end
end
return skill,level
else -- SO MUCH EASIER WHEN LEVEL ISN'T SELECTABLE!!!!
for i,v in ipairs(MobSkillList) do
level = SkillList[MercType][v]
if level ~= nil then
skill=v
return skill,level
end
end
end
return 0,0
end
UseDieterVolcanicAsh=1
SkillInfo[MH_VOLCANIC_ASH ]={"Volcanic Ash",{7,7,7,7,7},{60,65,70,75,80},{1000,1000,1000,1000,1000},{4000,3500,3000,2500,2000},{700,700,700,700,700},2,{6000,7000,8000,9000,10000}}
I shortened the listed cooldown on volcanic ash so it will keep two of them up at any given time. It will use it as an AoE skill, and never use lava slide to attack (unless you turn off UseDieterVolcanicAsh), though it will still be able to use lava slide on owner's feet if set to do so via LavaSlideMode
Method 2: Make it a debuff by overriding GetDebuffSkill, and set tactics to use "any" debuff on the monster in question (I'm not sure if this will keep ash up, or just cast it once):
function GetDebuffSkill(myid)
if (IsHomun(myid)==1) then
if GetV(V_HOMUNTYPE,MyID)==EIRA and UseEiraSilentBreeze==1 then
skill=MH_SILENT_BREEZE
if EiraSilentBreezeLevel==nil then
level=5
else
level=EiraSilentBreezeLevel
end
return skill,level
elseif GetV(V_HOMUNTYPE,MyID)==DIETER and UseDieterVolcanicAsh==1 then
skill=MH_VOLCANIC_ASH
if DieterVolcanicAshLevel==nil then
level=5
else
level=DieterVolcanicAshLevel
end
return skill,level
end
else
for i,v in ipairs(DebuffSkillList) do
level = SkillList[MercType][v]
if level ~= nil then
skill=v
return skill,level
end
end
end
return 0,0
end
UseDieterVolcanicAsh=1
SkillInfo[MH_VOLCANIC_ASH ]={"Volcanic Ash",{7,7,7,7,7},{60,65,70,75,80},{1000,1000,1000,1000,1000},{4000,3500,3000,2500,2000},{700,700,700,700,700},2,{6000,7000,8000,9000,10000}}
Pretty self-explainatory - tactics must be set to use debuffs.
Method 3 - which i think is what you want:
This is the messiest - but it will work even if homun is set SuperPassive. Here, we define a new buff for casting volcanic ash on the owner's target's feet by overriding the OnAutoBuffs() callback (note that we back up the current one and then call it at the end; that way it will be compatible with another plugin that also adds a buff. My new OnAutoBuffs function is based on the section of DoAutoBuffs() that handles casting mist/slide on the owner, only here, we're first checking that the owner currently has a target, and then make sure it's a monster and it's actually there (can't trust GetV(V_TARGET) to not return targets that are dead or off screen). Then we use the same code as we do for casting slide/VA, only on the enemy.
function OnAutoBuffs(buffmode)
if AshTimeout ~=-1 then
TraceAI("tick:"..GetTick().."AshTimeout"..AshTimeout)
if (GetTick() > AshTimeout) then
local skill,level,opt = GetVolcanicAsh(MyID)
if (skill <= 0) then
AshTimeout = -1
elseif level==0 or opt~=buffmode then
-- skill in cooldown
elseif (GetSkillInfo(skill,3,level) <= GetV(V_SP,MyID)) then
local t = GetV(V_TARGET,GetV(V_OWNER,MyID) --Get owner's target
if IsMonster(t)==1 and IsOutOfSight(t,MyID)==0 then --Make sure it's a monster and on screen
if MyASAPBuffs[3]==skill and buffmode==3 then
AshTimeout = GetTick()+20000 --We're stuck in an ASAP loop!
logappend("AAI_ERROR","ASAP buff attempt canceled, we were just trying to do this and it didnt work, delaying 20 seconds "..FormatSkill(skill,level))
else
MyPState = MyState
MyState = PROVOKE_ST
MyPEnemy = t
MyPSkill = skill
MyPSkillLevel = level
MyPMode = 7
TraceAI("Using AoE skill as buff"..MyPState.." "..MyState.." "..MyPEnemy.." "..MyPSkill.." "..MyPSkillLevel)
return OnPROVOKE_ST()
end
end
end
end
return 1
end
function GetVolcanicAsh(myid)
local level = 0
local skill = 0
local skillopt = 0
if (IsHomun(myid)==1) then
htype=GetV(V_HOMUNTYPE,myid)
if (htype==DIETER and UseDieterVolcanicAsh==1 and VolcanicAshMode~=0) then
skill=MH_VOLCANIC_ASH
level = 5
skillopt=VolcanicAshMode
end
end
if AutoSkillCooldown[skill]~=nil then
if GetTick() < AutoSkillCooldown[skill] then -- in cooldown
level=0
skill=skill
end
end
return skill,level,skillopt
end
UseDieterVolcanicAsh=1
VolcanicAshMode=1
SkillInfo[MH_VOLCANIC_ASH ]={"Volcanic Ash",{7,7,7,7,7},{60,65,70,75,80},{1000,1000,1000,1000,1000},{4000,3500,3000,2500,2000},{700,700,700,700,700},2,{6000,7000,8000,9000,10000}}
--Some globals we'll need:
AshTimeout=0
AutoSkillCooldown[MH_VOLCANIC_ASH]=0
Use only one of these three methods.
In all cases, this code goes into H_Extra (or into it's own .lua file, called from H_Extra with dofile() )
This code hasn't been tested, and will probably need a few fixes to work correctly.
Sorry they look so awful - the forums mangle formatting.
Edited by DrAzzy, 31 October 2013 - 09:45 AM.