I dereferenced as Andrew said. I googled it and from what I found all you need to do is add an extra $. So here is my new code:
Code:
sub EVENT_ATTACK{
quest::shout("rawr");
quest::settimer(1, 10);
}
sub EVENT_TIMER{
if ($timer == 1){
my $hate_target = $npc->GetHateRandom();
quest::shout("My hate target is $$hate_target");
$npc->CastSpell(1588, $$hate_target);
quest::level(1);
quest::shout("k");
}
}
The npc now returns:
Code:
My hate target is 122026464
No zone crash, but the npc will not cast the spell on me, the number is not directing to me. The NPC casts the spell, but is then interrupted, I assume because it has no valid target. Is the GetHateRandom function not working?
Also, the only way the script will get to my "k" shout, is if the level(1) line is a quest::, it will not progress to the shout if it is a $client->level or $npc->level. It also does not actually level me to 1.