Log in

View Full Version : Spawn2 // Itemturn in


Expletus
09-14-2011, 01:42 AM
Was trying to get an npc to assign the task (which it did) and upon turn in of 4 of the same item it would depop and spawn another mob in its place. Tried several variations and just couldn't figure this out. Where did I go wrong? The elseif part?

sub EVENT_SAY {

my $help = quest::saylink("help");
my $assist = quest::saylink("assist");

$client->Message(7, "-");
my $NPCName = $npc->GetCleanName();

if (quest::istaskactive(226) || quest::istaskcompleted(226))
{
$client->Message(315, "$NPCName whispers to you, 'What are you waiting for? Don't make me skunk you up.");
}
else
{
if ($text =~/Hail/i)
{
$client->Message(315, "$NPCName whispers to you, 'Please wait, $name! I need your [$help].");
}

if ($text =~/help/i)
{
$client->Message(315, "$NPCName whispers to you, 'I was turned into a skunk by Xalgoz when they invaded. Since I dabbled in some magic, I know essence of shadow can reverse this particular spell. If you can [$assist] me and bring me 4 essences, I will give this shiney thing I found.");
}

if ($text =~/assist/i)
{
$client->Message(315, "$NPCName whispers to you, 'Bring me 4 of those essences and please do hurry.");
quest::assigntask(226);
}
}

}

sub EVENT_ITEM
{
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
$h = $npc->GetHeading();
$entid1 = quest::spawn2(58083,0,0,$x,$y,$z,$h);

if (plugin::check_handin(\%itemcount, 119782=> 4))
{
quest::spawn2(58083,0,0,$x,$y,$z$h);
quest::shout2("Fool you have unleashed me!");
quest::ding ();
quest::depop(58082);
}
elsif(plugin::check_handin(\%itemcount, $_=> 1))
{
$client->Message(315, "$NPCName whispers to you, 'Not quite there yet, ace.");
quest::summonitem($turnins[$i]);
}
plugin::return_items(\%itemcount);

}

blackdragonsdg
09-14-2011, 02:13 AM
You are missing a comma in
quest::spawn2(58083,0,0,$x,$y,$z$h);

Expletus
09-14-2011, 09:03 AM
my God... 2 hours of fiddling and it's a comma... lol thank you !

Expletus
09-14-2011, 09:53 AM
Alright, so it was working somewhat and I am running into the following issues:

1. Spawns 2 of the mobs on turn in
2. Spawns the mob when given less than 4 items but stays up
3. Gives double message when less than 4 items turned in
4. Upon completion, it's crashing the zone - log back in and task rewards is on cursor

Am I missing some particular rule code ? (I only changed the bottom code and the top remains the same).

sub EVENT_ITEM
{
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
$h = $npc->GetHeading();
$entid1 = quest::spawn2(58083,0,0,$x,$y,$z,$h);

if (plugin::check_handin(\%itemcount, 119782=> 4))
{
quest::spawn2(58083,0,0,$x,$y,$z,$h);
quest::shout2("Fool you have unleashed me!");
quest::depop(58082);
}
else
{
$client->Message(315, "$NPCName whispers to you, 'Not quite there yet, ace.");
plugin::return_items(\%itemcount);
}

}

Caryatis
09-14-2011, 10:22 AM
Your spawn command is outside of the if statements so any turn in is going to trigger it.

Expletus
09-14-2011, 01:32 PM
I'm confused what you mean. The spawn2 comes after

if (plugin::check_handin(\%itemcount, 119782=> 4))
{
quest::spawn2(58083,0,0,$x,$y,$z,$h);

So shouldn't it only trigger if the requirement is met, else it won't fire off?

Caryatis
09-14-2011, 01:49 PM
sub EVENT_ITEM
{
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
$h = $npc->GetHeading();
$entid1 = quest::spawn2(58083,0,0,$x,$y,$z,$h);

if (plugin::check_handin(\%itemcount, 119782=> 4)) {...}
else {...}

}

Expletus
09-15-2011, 09:42 AM
Def. thought that was part of the top code needed. Didn't realize it was an actual code line.. :? thank you !