Hello all,
I'm making a tutorial about mobs who cast a spell on a mob. Most people got trouble with this because they didn't know how to let a NPC cast a spell on a NPC. Well, I'm going to show you how to do that and it is very simple if you read the things good. I am not explaining the basic things about what is function etc. because you should know that before reading this tutorial.
Ok, the plan what I want to do is to let a NPC channel a spell on another NPC. How to do that? Simple.
First of all, I'm going to define the bosses name to "Unit".
Now I defined that BossName = Unit. Meaning with "function BossName_Define", you can simple way remove define, because it is actually OnSpawned. I just did define to make it look easier. 18 is the number of the registering event "OnSpawned".function BossName_Define(Unit, Event)
BossName = Unit
end
RegisterUnitEvent(EntryID, 18, "BossName_Define")
Now, we should define the mob who casts a spell on the BossName. You must do this in one script
Now we defined that BossName = Unit and MobName = Unit. I'm going to show now how to let the mob cast a spell on the boss.function BossName_Define(Unit, Event)
BossName = Unit
end
RegisterUnitEvent(EntryID, 18, "BossName_Define")
function MobName_Define(Unit, Event)
MobName = Unit
end
RegisterUnitEvent(EntryID, 18, "MobName_Define")
As you can see, I'm using "MobName:RegisterEvent("MobName_Channel", 10, 1)" Instead of "Unit:RegisterEvent("MobName_Channel", 10, 1)". Why? Because we just defined that MobName = Unit, so we are not using Unit anymore, only at the start of functions with "function MobName_Channel(Unit, Event).function BossName_Define(Unit, Event)
BossName = Unit
end
RegisterUnitEvent(EntryID, 18, "BossName_Define")
function MobName_Define(Unit, Event)
MobName = Unit
MobName:RegisterEvent("MobName_Channel", 10, 1)
end
function MobName_Channel(Unit, Event)
MobName:FullCastSpellOnTarget(30402, BossName)
end
RegisterUnitEvent(EntryID, 18, "MobName_Define)
Well, this is all what you should know to make a mob cast a spell on a mob. I hope you enjoined this tutorial and if you have further questions, don't be afraid to ask