code for champion spawns
Posted: Fri Mar 13, 2009 12:44 pm
I'm working on a code for Champion Spawns.
What a Champion Spawn is.. is a group of npc that spawn... like snakes that are easy to kill and keep spawning big amounts at a time, after killing them for a while the spawn changes into lets say lizards. They are harder to kill and more and more of them keep spawning . Then it changes again to the next level lets say drakes. They are even harder to kill. Then in the end you will get the Champion who will spawn. This time only the single Champion spawns not tons of other stuff. So he is the final guy to take down.
So I'm not sure if I am going about this right. I looked in Spawn groups but I don't think it will cover the repop. So I tryed to write a script here it is.
****************************************************************
function SpawnChampionAntonica_OnCombat(Unit, Event)
Unit:RegisterEvent("Spawn_Snake",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("Spawn_Snake",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("_",1000,0)
end
function Snakes_Spawn(pUnit, Event)
pUnit:SpawnCreature(12051, 0, 0, 0, 0, , 100000)
end
function Serpent_Spawn2(pUnit, Event)
pUnit:SpawnCreature(12052, 0, 0, 0, 0, , 1000000)
end
function Lizard_Spawn3(pUnit, Event)
pUnit:SpawnCreature(12053, 0, 0, 0, 0, , 100000)
end
function Drake_Spawn4(pUnit, Event)
pUnit:SpawnCreature(12054, 0, 0, 0, 0, , 1000000)
end
function Spawn_Snake(pUnit, Event)
if pUnit:GetHealthPct() < 100 then
pUnit:RemoveEvents();
pUnit:FullCastSpell(0)
pUnit:RegisterEvent("Snakes_Spawn",1000,10)
end
end
function _(pUnit, Event)
if pUnit:GetHealthPct() < 0 then
pUnit:RemoveEvents();
pUnit:FullCastSpell(0)
pUnit:RegisterEvent("Serpent_Spawn2",1000,10)
end
end
function _(pUnit, Event)
if pUnit:GetHealthPct() < 0 then
pUnit:RemoveEvents();
pUnit:FullCastSpell(0)
pUnit:RegisterEvent("Lizard_Spawn3",1000,10)
end
end
function _(pUnit, Event)
if pUnit:GetHealthPct() < 0 then
pUnit:RemoveEvents();
pUnit:FullCastSpell(0)
pUnit:RegisterEvent("Drake_Spawn4",1000,1)
end
end
function SpawnChampionAntonica_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end
function SpawnChampionAntonica_OnDied(Unit, Event)
Unit:RemoveEvents()
end
function SpawnChampionAntonica_OnKilledTarget(Unit, Event)
end
RegisterUnitEvent(ChampSpawnReptile, 1, "SpawnChampionAntonica_OnCombat")
RegisterUnitEvent(ChampSpawnReptile, 2, "SpawnChampionAntonica_OnLeaveCombat")
RegisterUnitEvent(ChampSpawnReptile, 3, "SpawnChampionAntonica_OnKilledTarget")
RegisterUnitEvent(ChampSpawnReptile, 4, "SpawnChampionAntonica_OnDied")
****************************************************************************************************************************
I really haven't done as much with Lua. The o,o,o,o, is the x,y,z, facing. the 100000 is how long in mil sec it will spawn for
-- pUnit:SpawnCreature(12051, 0, 0, 0, 0, , 100000)
The script failed, So the question is do we need to add in a code in the core that says if we use a code for champion spawns here it is. Or will any LUA code or comand work? And how would I write the code?
I do like how Lua is on the fly VM. and really dosnt need to recompile.
Then the next thing is spells. So lets say I want to take a Crystal Dragon and add spells that the Dragon can cast.
Will I write this up as a Lua script and add this to the dragon? This method makes a lot of sence to me.
Sorry if my questions sound lame, I'm learning.
Thanks for your help. Palaxe
What a Champion Spawn is.. is a group of npc that spawn... like snakes that are easy to kill and keep spawning big amounts at a time, after killing them for a while the spawn changes into lets say lizards. They are harder to kill and more and more of them keep spawning . Then it changes again to the next level lets say drakes. They are even harder to kill. Then in the end you will get the Champion who will spawn. This time only the single Champion spawns not tons of other stuff. So he is the final guy to take down.
So I'm not sure if I am going about this right. I looked in Spawn groups but I don't think it will cover the repop. So I tryed to write a script here it is.
****************************************************************
function SpawnChampionAntonica_OnCombat(Unit, Event)
Unit:RegisterEvent("Spawn_Snake",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("Spawn_Snake",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("_",1000,0)
Unit:RegisterEvent("_",1000,0)
end
function Snakes_Spawn(pUnit, Event)
pUnit:SpawnCreature(12051, 0, 0, 0, 0, , 100000)
end
function Serpent_Spawn2(pUnit, Event)
pUnit:SpawnCreature(12052, 0, 0, 0, 0, , 1000000)
end
function Lizard_Spawn3(pUnit, Event)
pUnit:SpawnCreature(12053, 0, 0, 0, 0, , 100000)
end
function Drake_Spawn4(pUnit, Event)
pUnit:SpawnCreature(12054, 0, 0, 0, 0, , 1000000)
end
function Spawn_Snake(pUnit, Event)
if pUnit:GetHealthPct() < 100 then
pUnit:RemoveEvents();
pUnit:FullCastSpell(0)
pUnit:RegisterEvent("Snakes_Spawn",1000,10)
end
end
function _(pUnit, Event)
if pUnit:GetHealthPct() < 0 then
pUnit:RemoveEvents();
pUnit:FullCastSpell(0)
pUnit:RegisterEvent("Serpent_Spawn2",1000,10)
end
end
function _(pUnit, Event)
if pUnit:GetHealthPct() < 0 then
pUnit:RemoveEvents();
pUnit:FullCastSpell(0)
pUnit:RegisterEvent("Lizard_Spawn3",1000,10)
end
end
function _(pUnit, Event)
if pUnit:GetHealthPct() < 0 then
pUnit:RemoveEvents();
pUnit:FullCastSpell(0)
pUnit:RegisterEvent("Drake_Spawn4",1000,1)
end
end
function SpawnChampionAntonica_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end
function SpawnChampionAntonica_OnDied(Unit, Event)
Unit:RemoveEvents()
end
function SpawnChampionAntonica_OnKilledTarget(Unit, Event)
end
RegisterUnitEvent(ChampSpawnReptile, 1, "SpawnChampionAntonica_OnCombat")
RegisterUnitEvent(ChampSpawnReptile, 2, "SpawnChampionAntonica_OnLeaveCombat")
RegisterUnitEvent(ChampSpawnReptile, 3, "SpawnChampionAntonica_OnKilledTarget")
RegisterUnitEvent(ChampSpawnReptile, 4, "SpawnChampionAntonica_OnDied")
****************************************************************************************************************************
I really haven't done as much with Lua. The o,o,o,o, is the x,y,z, facing. the 100000 is how long in mil sec it will spawn for
-- pUnit:SpawnCreature(12051, 0, 0, 0, 0, , 100000)
The script failed, So the question is do we need to add in a code in the core that says if we use a code for champion spawns here it is. Or will any LUA code or comand work? And how would I write the code?
I do like how Lua is on the fly VM. and really dosnt need to recompile.
Then the next thing is spells. So lets say I want to take a Crystal Dragon and add spells that the Dragon can cast.
Will I write this up as a Lua script and add this to the dragon? This method makes a lot of sence to me.
Sorry if my questions sound lame, I'm learning.
Thanks for your help. Palaxe