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 03-18-2010, 08:05 AM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

How do I get the Spawn2 ID from NPCs ID then?

Example please.
Reply With Quote
  #2  
Old 03-18-2010, 04:09 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Code:
mysql> select * from spawn2 where spawngroupID=(select spawngroupID from spawnentry where npcID=2093);
+-------+--------------+---------+---------+------------+------------+----------+----------+-------------+----------+----------+------------+------------+---------+
| id    | spawngroupID | zone    | version | x          | y          | z        | heading  | respawntime | variance | pathgrid | _condition | cond_value | enabled |
+-------+--------------+---------+---------+------------+------------+----------+----------+-------------+----------+----------+------------+------------+---------+
| 10842 |         7667 | qeynos2 |       0 | 139.699997 | 312.700012 | 3.100000 | 0.000000 |         640 |        0 |        0 |          0 |          1 |       1 |
+-------+--------------+---------+---------+------------+------------+----------+----------+-------------+----------+----------+------------+------------+---------+
1 row in set (0.18 sec)
Keep in mind these are spawn points you don't turn them all on and off at once, they're one at a time.
Reply With Quote
  #3  
Old 03-18-2010, 05:16 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Hmm, I think this may have been mentioned before, but maybe we can add spawn2 ID to #showstats or something next to spawngroup in that output. That will make it easier to figure out what you want in your script without having to query the DB.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 03-18-2010, 07:53 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Heck even a command with the simple sql I posted might be highly useful just as a quick lookup tool.
Reply With Quote
  #5  
Old 03-18-2010, 08:39 PM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

Talk to Rude/Reno. We chatted about this this morning and about what I think should be done and he was thinking about it.

Basically, you could add a Disable_Spawn using the NPC ID number and also allow a proximity setting, so say ya wanted no NPCs of id 200 in the zone, ya do quest::Disable_Spawn(200).

Using proximity type settings ya could do.

quest::Disable_Spawn(NPCID, minX, maxX, minY, maxY, minZ, maxZ)

And if the NPCID was 0 and the X,Ys and possibly Z, it would disable any spawns/groups in that area.

and of course Enable_Spawn to reverse then setting.
Reply With Quote
  #6  
Old 03-21-2010, 11:57 AM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

Quote:
Originally Posted by KLS View Post
Code:
mysql> select * from spawn2 where spawngroupID=(select spawngroupID from spawnentry where npcID=2093);
+-------+--------------+---------+---------+------------+------------+----------+----------+-------------+----------+----------+------------+------------+---------+
| id    | spawngroupID | zone    | version | x          | y          | z        | heading  | respawntime | variance | pathgrid | _condition | cond_value | enabled |
+-------+--------------+---------+---------+------------+------------+----------+----------+-------------+----------+----------+------------+------------+---------+
| 10842 |         7667 | qeynos2 |       0 | 139.699997 | 312.700012 | 3.100000 | 0.000000 |         640 |        0 |        0 |          0 |          1 |       1 |
+-------+--------------+---------+---------+------------+------------+----------+----------+-------------+----------+----------+------------+------------+---------+
1 row in set (0.18 sec)
Keep in mind these are spawn points you don't turn them all on and off at once, they're one at a time.
This query doesn't work when there are multiple spawnentrys for npcID which I'm sure there often will be.

I'll give ya a dollar to impliment DIsable/Enable_Spawn like I posted above.
Reply With Quote
  #7  
Old 03-21-2010, 04:38 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Yeah it wont work out of the box without an expensive join for multiple spawn entries.

We are not adding another quest command that does the same thing for lazy people.
Reply With Quote
  #8  
Old 03-21-2010, 05:10 PM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

It's hardly for lazy people.

For examples, NPC ID 214001 belongs to 6 different spawn2 groups. Certainly a lot easier for someone to find 1 NPC ID over finding the 6 spawn groups it belongs to.

Multiply this by the 50ish NPC IDs who I'm prevent from spawning, it's a lot of looking up.

PS. How does this look?
Code:
# This is a work in progress.  Do NOT use.

sub GetSpawn2GroupIDs
{
use DBI;

my $npcID = shift;
printf("Parms 1 = %d\n", $npcID);

my $confile = "eqemu_config.xml"; #default
my $zonen = "potactics"; #only for testing
my $db = "eq";
my $user = "eq";
my $pass = "eq";
my $host = "localhost";

open(F, "<$confile") or die "Unable to open config: $confile\n";
my $indb = 0;

while(<F>) {
	s/\r//g;
	if(/<database>/i) {
		$indb = 1;
	}
	next unless($indb == 1);
	if(/<\/database>/i) {
		$indb = 0;
		last;
	}
	if(/<host>(.*)<\/host>/i) {
		$host = $1;
	} elsif(/<username>(.*)<\/username>/i) {
		$user = $1;
	} elsif(/<password>(.*)<\/password>/i) {
		$pass = $1;
	} elsif(/<db>(.*)<\/db>/i) {
		$db = $1;
	}
}
if(!$db || !$user || !$pass || !$host) {
	die "Invalid database info, missing one of: host, user, password, database\n";
}

my $source = "DBI:mysql:database=$db;host=$host";
my $dbh = DBI->connect($source, $user, $pass) || die "Could not create db handle\n";

my $spawngroupIDs = $dbh->prepare("SELECT * FROM  spawnentry WHERE npcID=$npcID");

$spawngroupIDs->execute(); #run the query on the db to get list of spawngroupIDs using NPC ID that Spawn2 uses

my($val2, $spawn2id, @spawn2groupsIDs); #define some variables, cause we're cool like that

while (my $val = $spawngroupIDs->fetch()) {
	$spawn2id = $dbh->prepare("SELECT * FROM spawn2 WHERE spawngroupID=@$val[0] AND zone='$zonen'");
	$spawn2id->execute();
	$val2 = $spawn2id->fetch();
	if(@$val2[0]) {
		push(@spawn2groupsIDs, @$val2[0]);
		}
}
return @spawn2groupsIDs;
}
Literally working on this right now. Got it finding all the spawn 2 IDs for a NPCs ID, now going to work on having it accept X, Y and Z perimeters.

PS I wasn't able to find any script that use Disable_Spawn2 and I'm guessing part of the reason is because it is to much of a hassle to write whole lists of spawn2 points.
Reply With Quote
  #9  
Old 03-23-2010, 10:13 AM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

Quote:
Originally Posted by KLS View Post
We are not adding another quest command that does the same thing for lazy people.
Just to show ya it's not for lazy people; I've got my scripts working to do what I specified above and after feeding it the 55 NPC IDs, it found associated 375 spawn2 entries, 197 that were unique.

So, if a person wanted to do this by hand, it would be a HUGE chore looking up all the correct spawn2 IDs, to say nothing of what it would be like if you wanted to include X,Y and Z ranges.

Also, you can just specify a X, Y and Z area and get a list of spawn2 areas, which certainly would be useful.

Here's the output from feeding those 55 NPCs:
Code:
Received an array of 55 NPD IDs
 npcid = 214000 spawn2 entries found = 4 spawn2s=44664,44678,44716,44745,
 npcid = 214001 spawn2 entries found = 6 spawn2s=44665,44677,44748,44765,44776,44781,
 npcid = 214002 spawn2 entries found = 5 spawn2s=44666,44708,44722,44737,44759,
 npcid = 214003 spawn2 entries found = 2 spawn2s=44667,44709,
 npcid = 214006 spawn2 entries found = 31 spawn2s=44463,44465,44468,44469,44470,44474,44475,44479,44482,44483,44484,44486,44492,44509,44510,44522,44560,44561,44563,44564,44566,44567,44570,44648,44669,44670,44672,58319,44704,44706,44787,
 npcid = 214008 spawn2 entries found = 29 spawn2s=44469,44470,44471,44478,44480,44481,44487,44492,44493,44494,44509,44510,44511,44512,44519,44560,44561,44563,44566,44569,44572,44662,44670,44672,44689,44757,44766,44767,44788,
 npcid = 214012 spawn2 entries found = 22 spawn2s=44469,44470,44471,44474,44479,44484,44485,44486,44490,44492,44495,44522,44560,44567,44570,44581,44645,44669,44672,44689,44717,44751,
 npcid = 214015 spawn2 entries found = 12 spawn2s=44473,44476,44477,44488,44491,44513,44518,44520,44571,44579,44668,44779,
 npcid = 214016 spawn2 entries found = 14 spawn2s=44479,44483,44484,44485,44486,44490,44495,44522,44567,44581,44668,44669,44672,44756,
 npcid = 214017 spawn2 entries found = 11 spawn2s=44466,44473,44477,44488,44489,44491,44492,44513,44518,44579,44617,
 npcid = 214018 spawn2 entries found = 17 spawn2s=44473,44476,44477,44488,44489,44491,44513,44518,44520,44571,44573,44574,44575,44576,44579,44668,44718,
 npcid = 214019 spawn2 entries found = 13 spawn2s=44478,44480,44481,44494,44511,44512,44519,44569,44572,44647,44670,44671,44672,
 npcid = 214020 spawn2 entries found = 9 spawn2s=44476,44489,44491,44513,44518,44521,44571,44579,44668,
 npcid = 214021 spawn2 entries found = 26 spawn2s=44479,44483,44484,44485,44490,44495,44567,44570,44573,44574,44575,44576,44581,44617,44669,44672,44673,44675,44678,44688,44715,44741,44742,44743,44747,44774,
 npcid = 214022 spawn2 entries found = 17 spawn2s=44478,44480,44481,44487,44493,44494,44511,44512,44526,44529,44569,44572,44647,44670,44672,44690,44740,
 npcid = 214023 spawn2 entries found = 10 spawn2s=44473,44476,44488,44489,44520,44521,44571,44579,44668,44672,
 npcid = 214024 spawn2 entries found = 11 spawn2s=44478,44480,44481,44487,44493,44494,44512,44519,44647,44670,44672,
 npcid = 214025 spawn2 entries found = 13 spawn2s=44484,44485,44490,44495,44522,44567,44570,44581,44669,44671,44732,44777,44778,
 npcid = 214027 spawn2 entries found = 2 spawn2s=44674,44710,
 npcid = 214028 spawn2 entries found = 10 spawn2s=44676,44682,44711,44712,44719,44720,44723,44729,44760,44764,
 npcid = 214029 spawn2 entries found = 6 spawn2s=44678,44680,44713,44724,44728,44780,
 npcid = 214030 spawn2 entries found = 4 spawn2s=44678,44681,44727,44749,
 npcid = 214038 spawn2 entries found = 4 spawn2s=44667,44687,44746,44775,
 npcid = 214040 spawn2 entries found = 4 spawn2s=44505,44506,44507,44508,
 npcid = 214043 spawn2 entries found = 1 spawn2s=44516,
 npcid = 214045 spawn2 entries found = 7 spawn2s=44494,44523,44524,44525,44527,44528,44653,
 npcid = 214046 spawn2 entries found = 5 spawn2s=44529,44661,44672,44690,44691,
 npcid = 214047 spawn2 entries found = 4 spawn2s=44523,44524,44525,44527,
 npcid = 214048 spawn2 entries found = 4 spawn2s=44524,44525,44527,44528,
 npcid = 214059 spawn2 entries found = 15 spawn2s=44478,44480,44481,44487,44493,44494,44511,44512,44569,44572,44573,44575,44576,44663,44672,
 npcid = 214070 spawn2 entries found = 1 spawn2s=44593,
 npcid = 214077 spawn2 entries found = 2 spawn2s=44462,44656,
 npcid = 214078 spawn2 entries found = 3 spawn2s=44464,44467,44655,
 npcid = 214079 spawn2 entries found = 1 spawn2s=44762,
 npcid = 214080 spawn2 entries found = 2 spawn2s=44702,44745,
 npcid = 214081 spawn2 entries found = 2 spawn2s=44678,44703,
 npcid = 214085 spawn2 entries found = 1 spawn2s=44705,
 npcid = 214087 spawn2 entries found = 1 spawn2s=44782,
 npcid = 214088 spawn2 entries found = 1 spawn2s=44721,
 npcid = 214089 spawn2 entries found = 1 spawn2s=44685,
 npcid = 214090 spawn2 entries found = 2 spawn2s=44666,44738,
 npcid = 214091 spawn2 entries found = 3 spawn2s=44642,44646,44761,
 npcid = 214093 spawn2 entries found = 1 spawn2s=44744,
 npcid = 214094 spawn2 entries found = 2 spawn2s=44641,44763,
 npcid = 214095 spawn2 entries found = 2 spawn2s=44650,44651,
 npcid = 214097 spawn2 entries found = 25 spawn2s=67014,67015,67016,67017,67018,67019,67020,67021,67022,67023,67024,67025,67026,67027,67028,67029,67030,67031,67032,67033,67034,67035,67036,67037,67038,
 npcid = 214098 spawn2 entries found = 0 spawn2s=
 npcid = 214099 spawn2 entries found = 0 spawn2s=
 npcid = 214100 spawn2 entries found = 0 spawn2s=
 npcid = 214101 spawn2 entries found = 0 spawn2s=
 npcid = 214102 spawn2 entries found = 0 spawn2s=
 npcid = 214103 spawn2 entries found = 1 spawn2s=44742,
 npcid = 214106 spawn2 entries found = 0 spawn2s=
 npcid = 214122 spawn2 entries found = 6 spawn2s=44676,44682,44711,44712,44719,44720,
 npcid = 214114 spawn2 entries found = 0 spawn2s=
Found 375 total spawn2 IDs and 197 unique spawn2 IDs.
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 11:18 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