Author Topic: NPC Area OnEnter  (Read 249 times)

Legacy_Q.dot

  • Newbie
  • *
  • Posts: 40
  • Karma: +0/-0
NPC Area OnEnter
« on: January 17, 2011, 09:17:05 am »


               this is the farly straforid qeustion.

If there are NPC's or any object placed in the same area as the players start location, do thet trigger the OnEnter event first, before the pc
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
NPC Area OnEnter
« Reply #1 on: January 17, 2011, 11:28:36 am »


               I think they do.

NPC's placed via toolset, fire their onSpawn script as soon as the server starts up/the area is loaded, in which case the area will register them as being 'in' the area.



Quick way to test it would be to add this to the onArea enter script



void main()

{

object oEnterer = GetEnteringObject();

WriteTimeStampedLogEntry(GetName(oEnterer)+" entered the area");

}





Fire up your module, and see if the log contains the name of the npc's in the area.



Note - when we say onEnter script, it is the 'area' on enter, I dont think NPC's could fire a Module onClientEnter, because they are not Clients.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
NPC Area OnEnter
« Reply #2 on: January 17, 2011, 04:39:34 pm »


               Usually you just want to put in a If !(GetIsPC (oEnterer)) return;
               
               

               
            

Legacy_Q.dot

  • Newbie
  • *
  • Posts: 40
  • Karma: +0/-0
NPC Area OnEnter
« Reply #3 on: January 18, 2011, 02:09:53 am »


               thanks, I had a problem where the npcs would fire the onenter script, and thus screwed up the pcencer variable i had set up, but then I just did what ffbj siad and it worked propally. I just posted here to clarify what I had learned with the community, but thanks anyway.