|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Q&A This is the quest support section |
08-27-2008, 12:38 AM
|
Fire Beetle
|
|
Join Date: Aug 2008
Location: norrath
Posts: 8
|
|
$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{
quest::shout("rawr");
quest::settimer(1, 10);
}
sub EVENT_TIMER{
if ($timer == 1){
quest::shout("BAM");
$mob->gate();
}
}
|
08-27-2008, 03:31 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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);
if ($gating_npc) {
my $gate_now = $gating_npc->CastToNPC();
$gate_now->gate(); }
The only thing that I know of that uses $mob is the SetHP() command.
|
08-27-2008, 01:18 PM
|
Fire Beetle
|
|
Join Date: Aug 2008
Location: norrath
Posts: 8
|
|
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();
and then using that charid to cast a spell on a random person.
Code:
$mob->CastSpell(123, $mob->GetHateRandom());
He stated he was not sure if it would work, and I don't believe it is. I was using this script to test wether or not it was getting a charid. I believe I also tried $npc->castspell.
If GetHateRandom is working, how would I direct:
or
Code:
$mob->SetLevel(in_level, command= false)
to the randomly selected guy on the hate list?
|
08-27-2008, 05:11 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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
quest::say("My hate target is $hate_target."); #this will show if it selected someone or not and which one it selected
$npc->CastSpell(123, $hate_target);
quest::level(1);
I used a variable of $hate_target, cause I think using variables is a good way to replace certain things and to get them to run properly.
|
08-27-2008, 05:15 PM
|
Fire Beetle
|
|
Join Date: Aug 2008
Location: norrath
Posts: 8
|
|
Ok, I will try that.
Thanks again Trevius.
|
08-27-2008, 11:13 PM
|
Fire Beetle
|
|
Join Date: Aug 2008
Location: norrath
Posts: 8
|
|
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).
Any idea what that could mean?
|
08-27-2008, 11:31 PM
|
Dragon
|
|
Join Date: Feb 2007
Posts: 659
|
|
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.
|
08-27-2008, 11:32 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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
I am not sure I have the settings for that command set properly, but I imagine that the quest object might work better for the leveling part in this situation.
|
|
|
|
08-27-2008, 11:44 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
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.
|
08-28-2008, 03:09 PM
|
Fire Beetle
|
|
Join Date: Aug 2008
Location: norrath
Posts: 8
|
|
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{
quest::shout("rawr");
quest::settimer(1, 10);
}
sub EVENT_TIMER{
if ($timer == 1){
my $hate_target = $npc->GetHateRandom();
quest::shout("My hate target is $$hate_target");
$npc->CastSpell(1588, $$hate_target);
quest::level(1);
quest::shout("k");
}
}
The npc now returns:
Code:
My hate target is 122026464
No zone crash, but the npc will not cast the spell on me, the number is not directing to me. The NPC casts the spell, but is then interrupted, I assume because it has no valid target. Is the GetHateRandom function not working?
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.
|
08-28-2008, 03:31 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
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
|
08-28-2008, 04:22 PM
|
Fire Beetle
|
|
Join Date: Aug 2008
Location: norrath
Posts: 8
|
|
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{
if ($timer == 1){
my $hate_target = $npc->GetHateRandom();
my $hate_name = $hate_target->GetName();
my $hate_id = $hate_target->GetID();
quest::shout("My hate target is $hate_name");
$npc->CastSpell(1588, $hate_id);
$client->SetLevel(1, 0);
}
Anyone have any ideas? If not I may just make the NPC cast some spell that would produce the same sort of end result, but I'd really like it to actually delevel if possible.
|
08-28-2008, 05:30 PM
|
Fire Beetle
|
|
Join Date: Aug 2008
Location: norrath
Posts: 8
|
|
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{
if ($timer == 1){
my $hate_target = $npc->GetHateRandom();
my $hate_name = $hate_target->GetName();
my $hate_id = $hate_target->GetID();
quest::shout("My hate target is $hate_name");
$npc->CastSpell(5051, $hate_id);
undef $hate_target;
}
}
|
08-28-2008, 06:05 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
$client shouldn't be exported on timer as there's no client trigger for that event.
Code:
if($hate_target->IsClient()){
$hate_target->SetLevel(1, false);
}
|
08-28-2008, 07:05 PM
|
Fire Beetle
|
|
Join Date: Aug 2008
Location: norrath
Posts: 8
|
|
Success! Thanks KLS and everyone else that helped.
Final product for those wanting to do something similar in the future:
Code:
sub EVENT_TIMER{
if ($timer == 1){
my $hate_target = $npc->GetHateRandom();
my $hate_name = $hate_target->GetName();
my $hate_id = $hate_target->GetID();
quest::shout("My hate target is $hate_name");
if($hate_target->IsClient()){
$hate_target->SetLevel(1, false);
}
undef $hate_target;
}
}
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 08:34 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|