Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2013, 03:52 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default

Sorry to be general, I didn't have a specific example in mind. But I'll come up with one now. Please keep in mind this is part of some experimental quest work I am doing that is not intended for live servers.

Let's say that a quest requires the player to kill NPC-A and his three guards. These NPCs spawn under a tree, and just wait around for the player to come for them.

We really do not need NPC-A and his buddies to clutter up the zone when none of the players performing the quest aren't around. So part of the experiment is to only spawn these guys when someone with the quest comes within range (I'm going to test having them spawn anytime the player is in-zone too, but I'm curious how well this mechanic will work).

To complicate matters a bit, NPC-A is a rare spawn in the spawn group, so the guards would keep respawning until the player leaves the area or kills NPC-A.

So my thought is to create a spawn group for these NPCs and enable it when the player comes within range, and disable it when the player leaves or kills NPC-A.

I'll be happy to PM you the details, but I don't want to go into too much on the forums since I don't think what I am doing is of interest to the general community.
Reply With Quote
  #2  
Old 01-23-2013, 04:53 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Here's what I'd do.

First, you'd need some way to identify if a player has the quest. If it's a normal quest, you'd use a qglobal. If it's a task, you can just check the task step on the player. Create an invisible NPC, make sure to mark it to check qglobals, and spawn it right in the middle of the trigger area. This NPC will handle the bulk of the work. The script would look similar to this:

Code:
sub EVENT_SPAWN
{
     $x = $npc->GetX();
     $y = $npc->GetY();
     quest::set_proximity($x - 40, $x + 40, $y - 40, $y + 40);
}

sub EVENT_ENTER
{
     if(defined $qglobals{hasquest} && $qglobals{hasquestl} == 1)
     {
          quest::spawn_condition($zonesn,1,1);
     }   
}
Next, Create the NPC-A and 3 guards. Create spawnpoints for each of the 3 guards (but NOT NPC-A), and add them to the same spawngroup. Set their _condition to 1. You'll also need to add an entry to spawn_conditions for the current zone and condition id (which in this case is just 1.) The NPC above will already spawn the guards when a player with the appropriate progress comes near. (You can change the qglobal check for a level check, item check, task step check, etc.) On each of the guards, add the following script:

Code:
sub EVENT_DEATH
{
     my $random_result = int(rand(100));
     if($random_result <= 1)
     {
          quest::unique_spawn(NPC-A_ID,0,0,$x,$y,$z)
     }
}
That will give NPC-A a 1% chance to spawn on the death of one of the guards. You can fiddle with the number if you want, or you can add a $entity_list->GetMobByNpcTypeID($id); if you need all 3 guards to be down before you even roll for NPC-A. Since the spawn_condition has not been toggled off, those guards will continue to spawn over and over, based on their timer set in spawn2.

Last, for the NPC-A create the following script:

Code:
sub EVENT_DEATH
{
     quest::spawn_condition($zonesn,1,0);
}
That will turn the spawn_condition off when he is killed. These are just quick examples, but will do the basic job.

Last edited by cavedude; 01-23-2013 at 05:11 PM..
Reply With Quote
  #3  
Old 01-23-2013, 05:28 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default

Thanks much for the example. That should be enough to test with. It looks like setting the value to 1 enables spawning and clearing it disables, which is all I need at the moment.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:15 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3