$mob->
What's the deal with these? Been trying to use a few commands from http://www.eqemulator.net/wiki/wikka...a=QuestObjects
but nothing is working. Started with some of the more complex stuff, and worked my way down to $mob->gate(); which is not working for me either. Code:
sub EVENT_ATTACK{ |
Some of those are a little tricky to get working and some don't work at all I think.
Sometimes you might need to do $entity_list->gate(); or $npc->gate(); or something like that instead. And some of them, you need to get the mob ID first. Here is a way to get the NPC ID and use it for something. I don't know if this would work, but I use something like this for adding hate to NPCs and other things: Code:
my $gating_npc = $entity_list->GetMobByNpcTypeID(2120410); |
Thanks Trevius. Well in that case I guess I will go ahead and post what I'm actually tryng to do.
I want a mob to randomly pick someone on the hate list and set their level to 1. I was referencing AndMetal's post here: http://www.eqemulator.net/forums/showthread.php?t=25588 where he suggests using: Code:
$mob->GetHateRandom(); Code:
$mob->CastSpell(123, $mob->GetHateRandom()); If GetHateRandom is working, how would I direct: Code:
quest::level(1) Code:
$mob->SetLevel(in_level, command= false) |
Once you have the client chosen, the quest::level command should work fine.
One thing I tend to do when I am testing is to use quest::say to verify if/what is being passed on or selected. So, in your case, you could do: Code:
my $hate_target = $mob->GetHateRandom(); #this may need to be $npc instead of $mob |
Ok, I will try that.
Thanks again Trevius. |
Tried this out, did have to use $npc instead of $mob. My mob relayed this message, and then it crashed zone.exe:
Code:
My hate target is Mob=SCALAR(0x218b6fc). |
You need to dereference your return value. You are getting a reference instead of a value. Looks like a mob object. So you need to dereference the object.
|
I don't know exactly what the numbers and stuff mean, but that does mean that it was able to get at least some target, and probably it was the random hate target you wanted.
The zone crash could possibly have been caused by the leveling part of the quest. So, I would next try to remove the quest::level line and see if you can at least get the rest of it working without the zone crashes. If that works, then you just need to keep messing around until you can figure out how to get the level part working. It may be that you will have to use level quest object command something like this instead: Code:
$npc->SetLevel(1, false); #it might need to be $client instead of $npc |
The numbers are an internal memory address used by perl to track the object pointer.
$npc should work for most things. npc:: inherits from mob:: so you should be able to use just about anything mob from a npc object. |
I dereferenced as Andrew said. I googled it and from what I found all you need to do is add an extra $. So here is my new code:
Code:
sub EVENT_ATTACK{ Code:
My hate target is 122026464 Also, the only way the script will get to my "k" shout, is if the level(1) line is a quest::, it will not progress to the shout if it is a $client->level or $npc->level. It also does not actually level me to 1. |
Deref. does not give the id for CastSpell(spell_id, target_id)
$npc->CastSpell(spellid, $hate_target->GetID()) The member function for setting level on a specific PTR_OBJ is SetLevel() $client->SetLevel(1, 0); You can use $hate_target->GetName() to actually have it say which target is the target by name instead of cryptic pointers |
Awesome thanks KLS. The NPC can now actually pick me up as the random hate target, and cast a spell on me. The level function is still not working though, I don't think it knows who to cast it on.
Here's code: Code:
sub EVENT_TIMER{ |
Also, an update for anyone wanting to perform this sort of process, I needed to add a line that undefined the hate_target variable so that it would get a new random hate target next time the timer rolled around. Before I did this, it would keep the original hate target indefinately.
Code:
sub EVENT_TIMER{ |
$client shouldn't be exported on timer as there's no client trigger for that event.
Code:
if($hate_target->IsClient()){ |
Success! Thanks KLS and everyone else that helped.
Final product for those wanting to do something similar in the future: Code:
sub EVENT_TIMER{ |
All times are GMT -4. The time now is 03:10 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.