PDA

View Full Version : NPC casts on NPC


Capheus
06-07-2009, 01:01 PM
I might be missing something simple here, wouldn't be the first time. I'm trying to get one NPC/MOB to cast on another NPC/MOB. I've tried several variations of $mob->CastSpell and $npc->CastSpell, but nothing seems to work. Anyone have something workable out there?

ChaosSlayerZ
06-07-2009, 02:33 PM
I have asked simular question before, thought i never actualy got time to test the suggestions:

http://www.eqemulator.net/forums/showthread.php?t=25604

and I am still bot sure how to make NPC:

-cast spell on player OTHEr than selfcast (cuase I belvie selfcast casted as if player casts on himself and may result in wrong landign when NPC suppsoe to NUKE the player)

-make npc cast spell on HIMSELF

Capheus
06-08-2009, 05:19 AM
I almost got something working, the problem I am having is getting the casting mob to recognize the target mob's Entity ID.

Unless I am doing something wrong the following lines do not reveal a mob's Entity ID by type, target, or name:

$entity_list->GetMobByNpcTypeID(get_id);
$entity_list->GetMobID(id);
$entity_list->GetMob(name);

I've got the NPC casting on itself and I can get the mob to recognize its own Entity ID, I just can't get an Entity ID from some other mob or transfer that variable to another mob's script.

sub EVENT_SPAWN {

$npc->GetID(); #returns this mob's Entity ID
quest::settimer(1,10);

}

sub EVENT_TIMER {

if ($timer == 1) {
$npc->CastSpell(2110,$mobid); #casts skin like wood on this NPC
}
}

Capheus
06-08-2009, 07:05 AM
We can get a mob's Entity ID from #listnpcs and #showstats, but how can we use/apply that to get and Entity ID by NPCtype or by Target or Name?

Capheus
06-08-2009, 08:16 AM
Ok I finally got it. A bizaare method but it works. I am sending the NPC's Entity ID as a signal to the other mob.

#this npc has an ID of 2900000
#this NPC will be casted on by another NPC with an ID 2900001

sub EVENT_AGGRO {

$myeid = $npc->GetID(); #get this npc's Entity_ID
quest::spawn2(2900001,0,0,22,16,0,166); #spawn the casting NPC #change the loc
quest::settimer("signal",5); #give time for spawning


}


sub EVENT_TIMER {

if ($timer eq "signal") {
quest::signalwith(2900001,$myeid,0); #send Enity_ID as a signal to casting NPC
quest::stoptimer("signal");
}
}


#this npc has an ID of 2900001
#this npc will cast on NPC with an ID of 2900000

sub EVENT_SPAWN {

quest::settimer(1,15); #time before I start casting

}

sub EVENT_SIGNAL {

if ($signal => 1) {
$eid = $signal; #transfering the signal number for use in CastSpell

}
}

sub EVENT_TIMER {

if ($timer == 1) {
$npc->CastSpell(13,$eid); #casts a reapeating complete heal on the other NPC
}
}