Page 1 of 1

code for champion spawns

Posted: Fri Mar 13, 2009 12:44 pm
by palaxe
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

Re: code for champion spawns

Posted: Sat Mar 14, 2009 10:25 am
by John Adams
I am not sure what this is. This doesn't look a thing like our LUA scripts. IS this C++ code in luafunctions.cpp or something?

There is NO support for "NPC Groups/Parties" just yet in the Spawn system, which is why our Outpost of the Overlord spawns are still such a mess. Parties being, a group of 6 NPCs spawn + pets, and are a linked encounter.

I think you are talking about something different still. But I cannot understand that LUA up there.

Re: code for champion spawns

Posted: Sat Mar 14, 2009 4:11 pm
by Jabantiz
I think he is refering to a ring event like can be found in Chamber of Immortality. But this would require NPC groups as far as I can tell.

Re: code for champion spawns

Posted: Sat Mar 14, 2009 6:11 pm
by palaxe
Ahh Ok, You answered my question. So there is no support for This type of code. I have read the LUA Functions Sticky. I guess I will need to use the codes in that. Thanks for the Reply. :)
BTW, Chamber of Immortality is the type of thing that I am looking at. :) All in due time.

Re: code for champion spawns

Posted: Sat Mar 14, 2009 9:32 pm
by John Adams
Yeah, it's probably a good plan, if writing scripts you want the emulator to understand, to use the functions developed for the emulator. :wink:

Re: code for champion spawns

Posted: Sun Mar 15, 2009 12:20 am
by Scatman
A lot of the functions I think you tried to do are actually possible (when a mob dies, when a mob is attacked, etc). It would actually be pretty trivial to do the Chamber of Immortality ring event with timers that we have now. If you need some help, I'm almost positive I could help you script this out for ya. Check out how timers and proximities work and let me know if you have any questions.

Re: code for champion spawns

Posted: Sun Mar 15, 2009 8:09 am
by palaxe
Thanks Scatman,
When I get a second, I'll look into it ;)