View Single Post
  #1  
Old 12-07-2013, 05:06 PM
Nydosa's Avatar
Nydosa
Sarnak
 
Join Date: Jan 2013
Posts: 61
Default Simple Christmas NPC

Made Santa Troll for my server. Cookies and eggnog are global drops. Hand them to him and he gives you a random reward. He's a big red troll NPC for the way I set it up.

Code:
sub EVENT_SPAWN	{ 
my $one = $x - 40;
my $two = $x + 40;
my $thr = $y - 40;
my $fou = $y + 40;
my $fiv = $z - 40;
my $six = $z + 40;
quest::set_proximity($one,$two,$thr,$fou,$fiv,$six );
quest::settimer("Spawn",1);
quest::settimer("Shout", 600);
quest::snow(1);
} 


sub EVENT_ENTER {
quest::say("Ho! Ho! Ho! Merry Chri...Hap-*hick*-Holidays!");
quest::doanim("29");
}


 
sub EVENT_SAY { 
if($text=~/Hail/i){
      quest::say("a gust of spiked-eggnog breath hits your face as he turns 'Well hello there, $name, have you found any cookies or eggnog for me?"); 
}

if($text=~/naughty/i){
if (defined($qglobals{santa})) {
if ($qglobals{santa} > 1) {
quest::say("Oh-boy, oh-boy! How naught*hick*y you were indeed...Take and think about what you've done."); 
quest::doanim("28");
quest::setglobal("santa", 0, 5, "F");
my $naughty = quest::ChooseRandom(PUT items here);
quest::summonitem($naughty);
}}
else{}
}

if($text=~/nice/i){
if (defined($qglobals{santa})) {
if ($qglobals{santa} > 1) {
quest::say("Oh yes! That's right. Here, take your pres*hick*ent!");
quest::doanim("27");
quest::setglobal("santa", 0, 5, "F");
my $nice = quest::ChooseRandom(PUT items here);
quest::summonitem($nice);
}
}
else{}
}

}



sub EVENT_ITEM {
  if(plugin::check_handin(\%itemcount, 85064=>1)) {
quest::say("Falls into a short food-coma 'Those are so *hick*good! Erm. Did I already ask you if you were [naughty] or [nice]?");	
quest::setglobal("santa", 2, 5, "F");
  quest::doanim("16");
}

  if(plugin::check_handin(\%itemcount, 87555=>1)) {
quest::say("Emits a loud burp.'That's the stuff! Erm. Did I already ask you if you were [naughty] or [nice]?");	
quest::setglobal("santa", 2, 5, "F");
  quest::doanim("14");
}
plugin::return_items(\%itemcount);
}



sub EVENT_TIMER {
 if ($timer eq "Shout") {
  quest::shout("Oh it's way too hot here! I wish I had some nice egg*hick*nog to cool me off! I'd even take a cookie!");
}
}
Reply With Quote