PDA

View Full Version : client casting


JimB_1958
01-20-2016, 04:27 PM
This should be simple. But I'm stuck (Again)

I want to make a click in code item script that will cast a nuke or root etc on a targeted mob.

Tried variations of $client->Castspell and $client->Spellfinished and just can't get it to work.

make me feel stupid(er) please.

ghanja
01-20-2016, 04:46 PM
This should be simple. But I'm stuck (Again)

I want to make a click in code item script that will cast a nuke or root etc on a targeted mob.

Tried variations of $client->Castspell and $client->Spellfinished and just can't get it to work.

make me feel stupid(er) please.

Supply the actual implementation (code) within [ code ] and [ /code ] blocks please.

NatedogEZ
01-20-2016, 04:51 PM
Here is a small example..


sub EVENT_ITEM_CLICK {
my $target = $client->GetTarget();
if ($target && $target->IsNPC() && !($target->GetOwnerID() && $entity_list->GetMobByID($target->GetOwnerID())->IsClient())) { #Only cast on NPCs and ignore player pets
$client->SpellFinished(982, $target); #Cast Cazic Touch
}
}

JimB_1958
01-20-2016, 05:34 PM
Sorry ghanga... My code was trashed in frustration. But it was something like



sub EVENT_ITEM_CLICK {
$client->SpellFinished(982, $targetid);
}

and

sub EVENT_ITEM_CLICK {
$client->CastSpell(982, $client->GetTarget(),11);
}


I guess I was closer than I thought.

Natedog your example was spot on. Thanks a bunch