Heres a list of what we need to do:
1. On combat the egg dies
2. When the egg dies it spawns an npc
Here is the end product.
Code:
function Egg_Combat(Unit, Event)
Unit:CastSpell(5)
local faction = 1827
x = Unit:GetX();
y = Unit:GetY();
z = Unit:GetZ();
o = Unit:GetO();
Unit:SpawnCreature(98911, x, y, z, o, faction, 999999999999999999999999)
end
RegisterUnitEvent(98909, 1, "Egg_Combat")
Now to break this down (You should already know whats happening)
On Combat the Egg kills itself using "Death Touch". (Instantly kills a Target, if there is no Target, kills the user.) After destroying itself, it spawns an NPC directly ontop of it (by using x = Unit:GetX/Y/Z/O). The NPC lasts as probably a month without resetting the instance (all the 9s) because of the duration.