PDA

View Full Version : NPC + Target DD


Xunsai
12-01-2009, 06:13 AM
Syntax of :
$npc->castSpell(9247,$client);

It seems to only be able to cast "Point Blank AE" spells. Is this because it can't find a target? I've tried everything I can find and i'm finally posting. Please help.

nilbog
12-01-2009, 02:05 PM
try using this. I think CastSpell is also case sensitive

$npc->CastSpell(9247,$userid);

Xunsai
12-01-2009, 06:33 PM
I've tried,
$npc->CastSpell(9247,$userid);
$npc->CastSpell($userid,9247);
$npc->CastSpell(9247,$name);
$npc->CastSpell(9247,$target);
$npc->CastSpell(9247,$npc->GetHateTop());
$npc->CastSpell(9247,$npc->GetTopHate());
$npc->CastSpell(9247,$npc->GetHateMost());
$npc->CastSpell(9247,$GetTarget());
$npc->CastSpell(9247,$npc->$GetTarget());

You get the idea,

Also tried adding in
$targ = $npc->GetHateTop();
$whohit = $entity_list->GetClientByID($targ);

and then using

$npc->CastSpell(9248,$whohit);


And then he begins casting but interrupts, everytime. Spells are instant also.

joligario
12-01-2009, 07:53 PM
What sub are you calling it from? Sometimes not all the variables you are calling are passed. Maybe you should paste your code.

jayseesee
12-01-2009, 08:22 PM
We are calling this from EVENT_TIMER, what we are trying to do, unsuccessfully, is have the mob cast a single target spell on whoever is on the top of his hate list every so often (or target, but that is prone to exploits).
We have tried numerous things, and can not get it to work. Is there any way for us to do this?

jayseesee
12-01-2009, 08:37 PM
Disregard, we got this to work.
$targ = $npc->GetTarget();
$targid = $targ->GetID();
$npc->CastSpell($spellid,$targid);

I suppose GetHateTop() would work just as well =P

joligario
12-01-2009, 08:57 PM
Yeah, the client does not trigger the timer, so userid and client would not pass. $targetname will pass through timer though.