PDA

View Full Version : Does quest::disable_spawn2 work?


MNWatchdog
03-17-2010, 01:09 PM
I'm trying to depop a area of a zone of it's current mobs and prevent those mobs from respawning using quest::disable_spawn2(#####); and the mobs still continue to spawn.

I want these mobs to stay down until I use quest::enable_spawn2.

I've tried using the disable both before and after depopping the mobs.

Am I using this wrong? Did a search and there's no examples I can find of it being used and of course the Wiki has no information other than this function exists.

trevius
03-17-2010, 04:33 PM
I haven't really messed with those commands much yet, so I am not sure, but that is another one that KLS made examples for. Here are the examples she made:

sub EVENT_SAY {
if($text=~/despawn/i)
{
quest::disable_spawn2(10842);
quest::say("Yes sir!");
}
elsif($text=~/enable/i)
{
quest::enable_spawn2(10842);
quest::say("Yes sir!");
}
elsif($text=~/spawn/i)
{
quest::spawn_from_spawn2(10842);
quest::say("Yes sir!");
}
}


I believe you use the spawn group ID, NOT the NPCID, but I could be wrong about that. I also believe that disabling it should depop it for you, so you shouldn't have to use a depop on them as well.

MNWatchdog
03-17-2010, 06:14 PM
Shouldn't it be called disable_spawn_group then? ;-)

I guess that makes sense it would be groups, but the command name definitely should be changed if it is, if for nothing else, because there's almost no documentation other than the command itself.

Why didn't search not show that there we examples?

Well, anyways, I'll try group IDs.

Thanks.

nenelan
03-17-2010, 07:44 PM
Spawn groups are stored in the dbtable, spawn2. Makes sense to me.

joligario
03-17-2010, 08:00 PM
@nenelan: No, spawn groups are in spawngroup and spawnentry. Individual spawn points are in spawn2.

@MNW: Have you thought about using spawn conditions instead?

MNWatchdog
03-18-2010, 01:31 AM
@nenelan: No, spawn groups are in spawngroup and spawnentry. Individual spawn points are in spawn2.

@MNW: Have you thought about using spawn conditions instead?
Spawn conditions? Not sure what ya mean. I just started putzing around with scripts 2 days ago.

Examples always appreciated. ;-)

OK, found what you're talking about....and learning continues.

KLS
03-18-2010, 03:53 AM
It takes the spawn2 id. Ex:

mysql> select * from spawn2 where id=10842;
+-------+--------------+---------+---------+------------+------------+----------+----------+-------------+----------+----------+------------+------------+---------+
| 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.00 sec)

MNWatchdog
03-18-2010, 08:05 AM
How do I get the Spawn2 ID from NPCs ID then?

Example please.

KLS
03-18-2010, 04:09 PM
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.

trevius
03-18-2010, 05:16 PM
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.

KLS
03-18-2010, 07:53 PM
Heck even a command with the simple sql I posted might be highly useful just as a quick lookup tool.

MNWatchdog
03-18-2010, 08:39 PM
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.

MNWatchdog
03-21-2010, 10:48 AM
Nevermind - Really need a way to delete post!

MNWatchdog
03-21-2010, 11:57 AM
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. ;-)

KLS
03-21-2010, 04:38 PM
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.

MNWatchdog
03-21-2010, 05:10 PM
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?

# 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.

joligario
03-21-2010, 07:05 PM
I seriously think it would be easier to just put the pit mobs on a spawn_condition...

Example: Kithicor changes night/day mobs.

MNWatchdog
03-21-2010, 07:54 PM
I seriously think it would be easier to just put the pit mobs on a spawn_condition...

Example: Kithicor changes night/day mobs.

If I understand this right, I'd have to basically make a copy of all the spawn2s in the zone and set the new set of entries in the pit to a different condition than the normal mobs, which has them disable from spawning. Then I just use set the condition to 1 for spawned and 2 for not spawned?

If that is correct, I guess I could do that. Just so newb, wasn't wanting to make significant DB changes.

I'm making these fixes for general consumption.

MNWatchdog
03-23-2010, 10:13 AM
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:
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,44 522,44560,44561,44563,44564,44566,44567,44570,4464 8,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,44 560,44561,44563,44566,44569,44572,44662,44670,4467 2,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,44 581,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,44 668,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,44 672,44673,44675,44678,44688,44715,44741,44742,4474 3,44747,44774,
npcid = 214022 spawn2 entries found = 17 spawn2s=44478,44480,44481,44487,44493,44494,44511, 44512,44526,44529,44569,44572,44647,44670,44672,44 690,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,67 029,67030,67031,67032,67033,67034,67035,67036,6703 7,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.