This is a learning experience for me, and so far I have been pretty successful with writing some quests, but for some reason I cannot figure out what is wrong with this one.
I thought a trained eye might be able to help

.
Code:
#Script for Mob
sub EVENT_SPAWN
{
quest::shout("Defilers of the Temple beware - You shall not be tolerated!");
quest::setnexthpevent(76);
quest::setnexthpevent(26);
quest::setnexthpevent(11);
}
sub EVENT_HP
{
if ($hpevent <= 76)
{
quest::shout("Intolerable!");
quest::castspell($userid,2821); #Harm Touch
}
sub EVENT_HP
{
if ($hpevent <= 26)
{
quest::emote("Xarendyr's eyes take on a deathly allure!");
quest::settimer(1,10)
}
sub EVENT_TIMER
{
if ($timer == 1)
{
quest::shout("Heretic! Feel the Embrace of Fear!");
quest::castspell($userid,7477); #Death Touch
quest::stoptimer (1);
}
}
sub EVENT_HP
{
if ($hpevent <= 11)
{
quest::depop;
}
sub EVENT_ATTACK
{
quest::shout("Fool! You dare challenge the might of Cazic Thule?");
}
}
The mob shouts on spawn and also shouts when attacked, but none of the events activate.
I read in the wiki that quest::castspell(id,spell) could cause bugs, but even the shouts and emote do not go off.
Thanks for any suggestions in advance

.