PDA

View Full Version : Making a Npc Despawn


Bandor
04-08-2015, 01:22 PM
Writing a code for a simple quest trying to make the npc despawn and start respawn timer when item is turned in. Currently the npc wont despawn. Any clues what I missed?


sub EVENT_SAY {
if($text=~/hail/i) {
quest::say("Free me!");
}
}



sub EVENT_ITEM {
if(plugin::check_handin(\%itemcount, 19697 => 1)) { # Key
quest::say("Thank you $name!");
$mob->Depop(StartSpawnTimer);
}
plugin::return_items(\%itemcount);
}
}

Kingly_Krab
04-08-2015, 01:42 PM
For the '$mob->Depop(StartSpawnTimer);' portion try this: $npc->Depop(1);

Leetsauce
04-08-2015, 01:58 PM
quest::depop(npc_type_id) # A single mob will de-spawn and not start the spawn timer.

This command will also work. The quest command happens to be the one I use for the depops I've worked with on my server.

Alternatively:

quest::depop_withtimer(npc_type_id) # A single mob will de-spawn and start the spawn timer.

This one will apply the timer if you ever need it to.

Bandor
04-08-2015, 10:48 PM
Worked perfectly KK ty sir flawless as always. Ty for the suggestion Leet,was going to give those a shot first but was worried as I have about 10 total mobs all with different ID's and really didnt feel like making a quest for each one,and was worried applying quest based on name could make wrong npc despawn,or all of them.

Bandor
04-08-2015, 10:53 PM
One more question. How can I make the turn in update a task? Was looking at the wiki but theres not a whole lot of break down on this.

Kingly_Krab
04-08-2015, 11:13 PM
Try this: sub EVENT_ITEM {
if(plugin::check_handin(\%itemcount, 19697 => 1) && quest::istaskactivityactive(TASKID, ACTIVITYID)) { # Key
quest::updatetaskactivity(TASKID, ACTIVITYID, 1);
quest::say("Thank you $name!");
$npc->Depop(1);
}
plugin::return_items(\%itemcount);
}