View Full Version : I'm stumped - can't seem to get $target or $npc with player event say
Davood
12-30-2012, 06:04 AM
Hello everyone,
The new feature where the server parses # text freely spoken by players... doesn't seem to work properly.
namely....
$target and or $npc are not being passed;
I want to use the # to cast spells on an npc or player I have targeted. But I cannot. (I can do self cast or cast ae stuff, but that is not what i want)
If anyone has any quick tips here i'd appreciate it.. Ive been at it for hours trying to sort it out (facepalm?)
I know when i'm beat. I will post more details later if that isnt enough information to go on.
Thanks,
Davood
c0ncrete
12-30-2012, 01:10 PM
i don't think $npc will be passed because it's an event that exists in a player quest and i believe that object only exists on npc quests. as far as $target is concerned, does $client->GetTarget() not work?
Davood
12-30-2012, 02:27 PM
then this shold work right?
my $npc_target = $client->GetTarget();
my $mon_target = $npc_target->GetMobID();
$client->CastSpell($a_cast_buff,$mon_target,10,0,0);
it doesn't i'm not sure why
$a_cast_buff is some spell id value (i outputted it to make sure it was valid)
casting on $clientid works with the same $client->Cast. etc code
c0ncrete
12-30-2012, 02:39 PM
i'd start by testing the return value of GetTarget(). this should evaluate to true if you've got anything targeted:
ref($client->GetTarget()) =~ /Mob/iif it's false, then GetTarget() isn't returning a Mob object
c0ncrete
12-30-2012, 02:52 PM
i think i know what the problem is. GetMobID() isn't what you want. you should be using GetID(). GetMobID() returns a Mob object (don't ask me why, because it doesn't make any sense to me either) and is an $entity_list method, not a $mob method.
EDIT: i updated the QuestObject method list on the wiki at revision 2264, so some things have been moved/removed/added fairly recently. i used python scripts to parse the information so i didn't have to do it all by hand. i'll likely be updating it this way every few weeks and adding additional information to each entry when i have time (and motivation).
then this shold work right?
my $npc_target = $client->GetTarget();
my $mon_target = $npc_target->GetMobID();
$client->CastSpell($a_cast_buff,$mon_target,10,0,0);it doesn't i'm not sure why
$a_cast_buff is some spell id value (i outputted it to make sure it was valid)
casting on $clientid works with the same $client->Cast. etc code
Davood
12-30-2012, 03:12 PM
yeah that worked GetID()
thanks dude! you are teh m45t3r of p3r1
Davood
12-30-2012, 03:13 PM
and upon directory searching with notepad++ i did find evidence of GetMobID() only being used with list entities and it made me a little apprehensive!
c0ncrete
12-30-2012, 03:18 PM
i think $entity_list->GetMobID() and $entity_list->GetMobByID() do the same thing, but i haven't looked into it enough to find out for sure yet.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.