NPCs vs Objects

EQ2Emulator Development forum.

Moderator: Team Members

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 12:55 pm

Let me try this post again. I am experiencing some odd behavior with Collect nodes "?" in my DB. I'll try to be as detailed as possible, because this is pretty confusing.

First, I have many spawn_id's for "?" nodes, usually at least one per zone where "?" might be found. My goal this morning was to try and make a single common "?" spawn ID for all zones. So I took one of the spawn_id's from Queen's Colony, and changed it's ID to 1,000 (generic range). I restarted my world and everything was fine. ?'s appeared as expected.

Upon further investigation, I discovered that with the newbie zones I originally spawned, "?" nodes are NPCs, and not Objects - complete with eyes, skin, and hair :/ which of course is incorrect. So I thought it would be simple enough to delete the spawn_npcs record for spawn_id 1,000, and insert a spawn_objects record in it's place - thus making it an Object.

However, after a world restart this time, the "?" spawns would not appear. But, I could /spawn 1000 and get the new OBJECT version of "?" to appear fine. This boggled me, so I set the "?" spawn_id 1000 back to being an NPC, and deleted the object record. Repopped, and everything was fine again.

/spawn details show the "?" as an NPC ID: 1000. All other data lines up perfectly.

Now is when it gets bizarre... I did the same routine on "creature den", changing it to 1001, and this time after a restart, everything actually worked perfectly. The creature den is now an Object ID 1001 as expected. So I went back to my old "?" and again moved the spawn_npcs record to spawn_objects instead, and restarted.

Magically, the spawn_id 1000 "?" shows up in the world perfectly. /boggle... but, here's the punchline... /spawn details of this object shows it as a NPC ID 1000, not an Object ID 1000. If I /spawn 1000 and then get details of the manually spawned object, it shows Object ID 1000.

Lethal, buddy... is there some magic in the zone spawn routines that does not adhere to the actual zone spawn group settings (like does it say "I'll grab the first ? I find" when spawning a zone)? I cannot explain why spawn_id 1000, spawngroup 60, which is an OBJECT would be identified by /spawn details as an NPC.

I got another question, but I'll post that separately. :) Good luck with this one.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 1:11 pm

Ok, scratch that thing about the /spawn 1000 being ok... once I added it as a permanent spawn via /spawn add new, it became an NPC - even though there is no data in spawn_npcs for this spawn_id...
npc_object.jpg
This said "Object ID: 1000" prior to /spawn add new and /reload spawns.
You do not have the required permissions to view the files attached to this post.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: NPCs vs Objects

Post by LethalEncounter » Sat Feb 21, 2009 1:24 pm

Which database are you using? I would like to see what the data looks like in your database. You are confusing me :P

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 1:33 pm

In my phpMyAdmin, it would be `eq2live` DB. I'll leave it as-is for now so you can see there are no spawn_npcs records for spawn_id 1000, just to demonstrate the point made above.

But something just came to me, which makes me sad. I cannot make "?" spawn_id's generic, and use them across multiple zones... because a "?" might have different grounspawn_items at different tiers. :( So aside from finding an unexplainable circumstance above, this whole exercise is once again moot ~cries~

I need to stop trying to make our DB look pretty, and just focus on making it work. :)

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 1:43 pm

Here's a few queries that might help see what I am seeing.

Code: Select all

select * from spawn where id = 1000;
select * from spawn_npcs where spawn_id = 1000;
select * from spawn_objects where spawn_id = 1000;
select * from zonespawns where spawngroup_id in (select spawngroupid from zonespawnentry where spawn_id = 1000);
This shows the spawn record, that there is no spawn_npcs record, that there IS a spawn_objects record, and that the new spawn_id is set to spawn (which it does now).

I'll need to revert this DB to before I made changes, so let me know when you're done chasing my red herring :)

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: NPCs vs Objects

Post by LethalEncounter » Sat Feb 21, 2009 1:56 pm

John Adams wrote:In my phpMyAdmin, it would be `eq2live` DB. I'll leave it as-is for now so you can see there are no spawn_npcs records for spawn_id 1000, just to demonstrate the point made above.

But something just came to me, which makes me sad. I cannot make "?" spawn_id's generic, and use them across multiple zones... because a "?" might have different grounspawn_items at different tiers. :( So aside from finding an unexplainable circumstance above, this whole exercise is once again moot ~cries~

I need to stop trying to make our DB look pretty, and just focus on making it work. :)
If you want the '?'s to be groundspawns you should put them into the spawn_ground table, not the object or npc table. In fact putting them into the spawn_ground table you can have 1 ? entry for the entire game. You can add a spawn script to this entry and inside of the spawn script have it call a function that as of yet doesnt exist. We can add this function which uses the zone id and location_id to determine which item should be given to the player. Of course this would require an additional table be created for the collection items, but it is up to you :)

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 2:06 pm

Hmm. I did not know the spawn_ground table was to be used like npcs, objects, signs and widgets. That is good to know. I'll restore my spawn tables and give it a try.

This goes beyond the "?" only though, as I was considering doing this for all harvest nodes... example; there are only a few variations of "creature den", so removing all the dupes and setting up 1 each would solve the dupe data. But then you have tier 0 - 8 items that can be harvested, and currently I do not see how to set that up.

Same goes for "a rat" NPC spawns. Almost every village has rats. Do we really need 14 "a rat" spawn IDs? I thought not, until I started thinking about loot tables... how would I differentiate the loot on "a rat" in Castelview vs "a rat" in Temple Street if they both used the same spawn.id?

Rhetorical question, just something I have been rolling around for 8 mos, and I still haven't come up with a solution.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 2:09 pm

John Adams wrote:I'll need to revert this DB to before I made changes, so let me know when you're done chasing my red herring :)
Oops, shit. I got froggy and restored over live... so my examples are wiped. :) sorry. I'll try your suggestion above to see if stuff shows up in-game as a spawn_ground entity.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 2:15 pm

One more annoying factoid about "?"s that think they are NPCs... the only data set in a ?'s spawn_npcs record is initial_state = 129, and activity_status = 64. But spawning a ? as an Object (without that data), the ? looked exactly the same to me... so I suppose the data is not required.

Are these actually valid states for this object? If so, we may need to expand our spawn_ground / spawn_objects tables to support these states.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 2:31 pm

LethalEncounter wrote:If you want the '?'s to be groundspawns you should put them into the spawn_ground table, not the object or npc table. In fact putting them into the spawn_ground table you can have 1 ? entry for the entire game.
Just because I need to bump my post count, nowhere near high enough...

I went ahead and set one of my ? nodes to spawn.id 1000, deleted the spawn_npcs record for this spawn_id, and added it to spawn_ground (actually it was already there thanks to Scatman setting up ? nodes :)) Entering game, I target the ? and do a /spawn details... and it shows up exactly as the above screenshot. NPC ID: 1000, not Ground Spawn ID 1000.


Something else I just noticed, if you look at the above screen shot again, you will see an initial_state: 129 is set. That is not possible, since spawn_id 1000 has no spawn_npcs record. Where is World getting this data?

I think this is a bug afterall. :) :) :)

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: NPCs vs Objects

Post by LethalEncounter » Sat Feb 21, 2009 3:45 pm

John Adams wrote: I went ahead and set one of my ? nodes to spawn.id 1000, deleted the spawn_npcs record for this spawn_id, and added it to spawn_ground (actually it was already there thanks to Scatman setting up ? nodes :)) Entering game, I target the ? and do a /spawn details... and it shows up exactly as the above screenshot. NPC ID: 1000, not Ground Spawn ID 1000.
That is simply a display issue as the default is NPC and the display wasn't updated for GroundSpawns. I have fixed it.
John Adams wrote: Something else I just noticed, if you look at the above screen shot again, you will see an initial_state: 129 is set. That is not possible, since spawn_id 1000 has no spawn_npcs record. Where is World getting this data?

I think this is a bug afterall. :) :) :)
GroundSpawn.cpp(34): appearance.pos.state = 129;

:)

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 3:46 pm

Damnit! Foiled again...

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: NPCs vs Objects

Post by LethalEncounter » Sat Feb 21, 2009 3:47 pm

Heh, you see the part above about the display issue? I had it messed up when I first submitted it so I had to edit the post.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 3:52 pm

Ahh I was looking for that exact code because I had suspected that. But of course got side-tracked 15 ways before finally getting back here.

Thanks for looking into it, though I will still be pondering the "how to loot different tiers off a single ?" until we discuss it again. Maybe your idea above is a good one, or if you'd prefer to not have to add additional stuff right now, I could just go with multiple spawn_id's and deal with it next time the obsession arises.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: NPCs vs Objects

Post by John Adams » Sat Feb 21, 2009 5:58 pm

LethalEncounter wrote:If you want the '?'s to be groundspawns you should put them into the spawn_ground table, not the object or npc table. In fact putting them into the spawn_ground table you can have 1 ? entry for the entire game. You can add a spawn script to this entry and inside of the spawn script have it call a function that as of yet doesnt exist. We can add this function which uses the zone id and location_id to determine which item should be given to the player. Of course this would require an additional table be created for the collection items, but it is up to you :)
LE, after playing with groundspawns all afternoon, I think I'd like to go with your idea of same spawn_id, different zone_id / locations. Reason being, I just discovered that the "?" on the beach of Queen's Colony usually give up Shell collection items, while the same "?" in the grassy areas give up Feather collection items. Using even the 1 spawn_id I have now, I cannot configure what I need.

The other solution may be to tie the groundspawn to the spawn group instead of spawn id. If we did this, it might be less work for you... but the other way could be more configurable. Let me know what you think.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests