View Single Post
  #34  
Old 01-25-2005, 08:57 AM
TB3 TB3 is offline
Registered User
TB3's Avatar
Join Date: May 2001
Location: US of A State of VA
Posts: 658
TB3 is on a distinguished road
Send a message via Yahoo to TB3
Quote:
Originally Posted by Projectshifter
I'm going to have to side with Stefan now in the assumption that it is something else with your script. I got on UN and tried it and it works fine. if (created) in the new NPC is called after the 1st NPC (the one that created the new one) finishes it's loop or so. It set the strings and worked fine with if (created). You could do something like this if it's perhaps not adding them
NPC Code:

oldnpcscount = npcscount;
while (npcscount == oldnpcscount)
create();
with(npcs[npcscount-1])
blah;

function create()
putnpc2 x,y,{blah;}


This way it would ensure it really adds the NPC before continuing, and if it doesn't add it, it will try to add it again.
The problem was not that the npc was not being added (or my script), it was that the newly added npc was not having its strings set. And as I said stefans code
NPC Code:

oldnpcscount = npcscount;
putnpc2 ...
if (npcscount>oldnpcscount) with (npcs[oldnpcsount]) { ... }


Did not work at first , he came on to the server and removed the
if (npcscount>oldnpcscount)
And then it worked ( thats when he posted "works for me" )

The real problem is that after the putnpc2 the npcscount was increasing (on very small occasions) do some local npcs loading into memory a bit farther than it should , before the with() took place, even though it was directly following the putnpc2 command. Thus the wrong npc was getting the strings set. So the new way
PHP Code:
  oldnpcscount npcscount;
  
putnpc2 x,y,{
    
join baddy;
  };
  
with(npcs[oldnpcscount]) {
    
//code....
  

Works fine now. These problems however don't seem to occur in regular maps / levels just in gmaps for some reason. (As I have yet to have a problem with the npcs in regular levels)
__________________

To the sun of your age, I arise
Reply With Quote