PDA

View Full Version : Multiple mob spawns


bouzi567
07-11-2007, 04:06 PM
hey kinda jus gettin started with the server thing but im not a total noob lol, anyways for fun i was messin round in anguish and was making the omm fight spawn one of each of the other raid type mobs in the zone.I got the first part down was doing keld first then hanvar etc but after i get keld to spawn when it goes to change to hanvar instead of spawning him it spawns keld again then nothing till he dies was lookin for help this is whats there so far and info would help alot,thanks

sub EVENT_SAY {
if ($text=~/hail/i)
{
quest::say("Welcome warrior,youve bested the guards now i suppose you have [come for me]?");
}

if($text=~/come For me/i)
{
quest::say("Prepare for death foolish mortal!!!");
quest::attack($name);
quest::setnexthpevent(90);
}
}


sub EVENT_HP
{
if($hpevent <= 90)
{
quest::shout("Keldovan!!");
quest::spawn2(317005,0,0,$x+20,$y+20,$z,$h);
quest::setnexthpevent(85);}
}
}

sub EVENT_HP
{
if($hpevent <= 85)
{
quest::shout("Hanvar!!!");
quest::spawn2(317004,0,0,$x+20,$y+20,$z,$h);
quest::setnexthpevent(50);
}
}
}
}

Striat
07-11-2007, 05:32 PM
You would need to write it:

sub EVENT_SAY {
if ($text=~/hail/i) {
quest::say("Welcome warrior,youve bested the guards now i suppose you have [come for me]?");
}

if($text=~/come For me/i) {
quest::say("Prepare for death foolish mortal!!!");
quest::attack($name);
quest::setnexthpevent(90);
}
}


sub EVENT_HP {
if($hpevent <= 90) {
quest::shout("Keldovan!!");
quest::spawn2(317005,0,0,$x+20,$y+20,$z,$h);
quest::setnexthpevent(85);}
}

if($hpevent <= 85) {
quest::shout("Hanvar!!!");
quest::spawn2(317004,0,0,$x+20,$y+20,$z,$h);
quest::setnexthpevent(50);
}
}


For this, you'll want to be sure to do add an action in this same format for hp events at 50 since you call for it in the script.

However, I would recommend this way to ensure the npcs attack correctly:

sub EVENT_SAY {
if ($text=~/hail/i) {
quest::say("Welcome warrior,youve bested the guards now i suppose you have [come for me]?");
}

if($text=~/come For me/i) {
quest::say("Prepare for death foolish mortal!!!");
quest::attack($name);
quest::setnexthpevent(90);
}
}


sub EVENT_HP {
if($hpevent <= 90) {
quest::shout("Keldovan!!");
$entid1 = quest::spawn2(317005,0,0,$x+20,$y+20,$z,$h);
$mob1 = $entity_list->GetMobID($entid1);
$mobnpc1 = $mob1->CastToNPC();
$mobnpc1->AddToHateList($npc->GetHateTop(),1);
quest::setnexthpevent(85);}
}

if($hpevent <= 85) {
quest::shout("Hanvar!!!");
$entid2 = quest::spawn2(317004,0,0,$x+20,$y+20,$z,$h);
$mob2 = $entity_list->GetMobID($entid2);
$mobnpc2 = $mob2->CastToNPC();
$mobnpc2->AddToHateList($npc->GetHateTop(),1);
quest::setnexthpevent(50);
}
}


This would ensure thep erson with the most hate gets the adds when they spawn. Nothing worse than the add picking off the group's cleric.

bouzi567
07-11-2007, 07:57 PM
Thnx,didnt look into the agro yet but you jus saved me future hassles lol,he does now spawn both of them but the first time is jus keld second time is keld and hanvar.any way or code to make it clear kelds after he spawns so he doesnt spawn again during hanvars trigger?again thnx i been reading and tryin to figure out how to do this for like 2 weeks now on n off with no progress ur a lifesaver =p (o yea forgot to mention i got hanvar to spawn with ur code minus one of the "}" after kelds code)

Striat
07-20-2007, 01:35 PM
Bleh, double post

Striat
07-20-2007, 01:37 PM
Well, there are several ways to address this. One would be simply to switch the spawn limit to 1 of each of those npc types. That way only one npc would be up at a time. In my opinion, this would not be the most optimal choice, because the event will still go off and the npc will still shout. Just only one npc.

My recommendation for now would be to use == instead of >=. And adding this to the npc:

sub EVENT_AGGRO {
quest::stoptimer(1);
}

sub EVENT_SLAY {
quest::settimer(1,10);
}

sub EVENT_TIMER {
if ($timer == 1) {
quest::signalwith(317004,1,0000);
quest::signalwith(317005,1,0000);
quest::depop();
quest::stoptimer(1);
}
}

And this to the npcs he spawns:

sub EVENT_SIGNAL {
if ($signal == 1) {
quest::depop();
}
}

This would make it so that if he kills a player, he starts a timer. If 10 second passes with no aggro, he sends a signal to the npcs to depop.

I do think I can propose a perhaps better solution, I just am not able to give a test run right this second.