[Question]NPC Spawning

06/14/2011 07:59 stealarcher#1
Alright, Im completely out of ideas on what to check on this one, just need a few pointers on what to check for. Version im on is 5369. My NPCs are spawning perfectly until i change maps (whether NPC or teleport). As soon as I teleport i see the NPCs in the viewdistance of my teleport location, but if i leave that area, no other NPC appears, but the NPCs within that circle still disappear/appear fine. The packets are being sent at the correct times when they are suppose to be, but when the client receives the packet, nothing appears. The MapID that the server is checking, packets being sent, so im kind of out of ideas. Any tips on what to look for?
06/14/2011 13:47 { Angelius }#2
if you are storing the local npcs in some kind of a dictionary . is it being cleared once you teleport?

the X/Y/Map is it really being changed to the new x/y/map after the teleport ?

is there any try{}catch() around any of the send/spawn void if not are you sure there is no silent Exceptions that is being throwing some how ?

did you split the maps and each map has its own npcs/Clients like(whatever[Client.map].npcs/whatever[Client.map].Clients) if so are you really removing the player from the old map /adding him to the new map ?

idk a lot of things that can be a reason for such thing it might be the spawn packet it self but i cant really tell as long as i dont know the way you coded your spawn system :P
i hope that helps some how
Good luck .
06/14/2011 16:37 stealarcher#3
Yeah, im sure its hard to give ideas hah, i just dont see exactly what code to paste if any. NPCs are correctly being cleared, X/Y/Map are being changed correctly, and just checked for the silent exception, nothing was displayed :\.
06/14/2011 18:27 _DreadNought_#4
Not actually read the post above, so yah.

...

Breakpoint where it spawns the object, should be something like
[code]
if (!screen.Objects.Contains(NPCid))
{
Spawn
}
else
return;
}
breakpoint "if (!screen.Objects.Contains(NPCid))", Check what Objects contains and see if its not removing the npc correctly, I had that too,
06/14/2011 18:37 stealarcher#5
I have this:

Code:
           lock (screenObjects){
               IScreenObject[] objects = new IScreenObject[screenObjects.Values.Count];
               screenObjects.Values.CopyTo(objects, 0);

               foreach (IScreenObject screenObj in objects){
                   if (SimplicityCore.Calculations.Distance(screenObj.currentPosition, currentPosition) >= LinearMap.ViewDistance)
                       screenObjects.Remove(screenObj.Entity_ID);
                   }
               }
The screen objects contains the values thats on the screen, I have even tried removing them after every jump, the NPCs that spawn spam constantly, (re-appear very fast), but no new NPCs appear. And if im right, the server wouldnt send the packets if they werent removed correctly :s.