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-22-2013, 07:34 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default Spawn condition confusion

I would like a quick check of my understanding before I spend any time going down this road. I would like to be able to turn a spawn group on and off within a quest. For example spawning mobs when players get near an area. (The mobs should respawn, otherwise it would be straightforward).

Spawn conditions seem to apply to spawn points although it looks like a coordinate can be used for multiple spawn2 entries (one per spawn group). OK, so create spawn2 entries for each possible spawn point and assign a condition id (which I assume is _condition).

Then when a script decides to enable the spawn group use quest::spawn_condition to change the condition value, likewise when disabling the spawn group.

I'm definitely not clear on how the spawn condition values are used. I am guessing that if the current value of the condition is 1 then the spawn2 entry is used, and if it is 0 then it is skipped. The version of the database that I am using only has two entries for spawn_events, but I am guessing here that the argument field is the new value for the condition.

But if that is the case, what is the purpose of the "enabled" field in spawn2? Could one not just flip enabled?

I thought that looking at Kithikor would clear some things up, but spawn_events are not used there (rather timers in Perl).
Reply With Quote
  #2  
Old 01-23-2013, 10:23 AM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default

I do not know how spawn conditions work yet. But I think you can achieve this via perl scripts quite easily.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
Reply With Quote
  #3  
Old 01-23-2013, 01:14 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

What exactly are you looking to do? spawn_conditions is a very broad topic and I won't be able to help with such a general request.

I'm not sure which database you're using, because PEQ got rid of the Perl timers long ago in favor of spawn_events. (Maybe you're using Angelox, or a very old version of PEQ?) However, if you are planning on using proximity then you won't use spawn_events. spawn_events changes spawn_condition based on time of day (or month, or year, etc) and is used in the PEQ db for Kithicor and all the other zones with day/night cycles. It is entirely DB/server driven and does not use Perl at all, so no scripts are required. If you need another method to change spawn_conditions, then you'll have to use Perl combined with setting up the appropriate DB entries. If you tell me what you need, I can give you some examples.

In the meantime, grab the newest PEQ DB and quests from here https://code.google.com/p/projecteqdb/downloads/list and here: https://code.google.com/p/projecteqq...downloads/list and check out Kithicor, and other day/night zones for example of spawn_events usage (look at the spawn_events table). Also, check out the Perl scripts in potimeb, especially the phase 3 trigger. That will give you an example of how to manipulate spawn_conditions within Perl.
Reply With Quote
  #4  
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
  #5  
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
  #6  
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
  #7  
Old 01-23-2013, 07:39 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

As another example, you can look at the script in PoNightmare. The guy by the tree/river. Invisible NPC waiting for hail with the right conditions to spawn another NPC.
Reply With Quote
  #8  
Old 01-23-2013, 08:00 PM
jdoran
Hill Giant
 
Join Date: Jul 2012
Posts: 212
Default

Gotcha. #Aid_Eino.pl spawns when a player with EinoTrigger says the magic phrase.

I still want to use spawn groups, as I want mobs to respawn with the frequency/distribution in the tables. But Eino is a great example.
Reply With Quote
Reply


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 12:47 AM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3