Aller au contenu

Photo

CreateObjectVoid() fires multiple times on Area OnEnter


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Zeke

Zeke
  • Members
  • 48 messages

It seems that when the following script is attached to an Area OnEnter event, it fires infinitely:

void CreateObjectVoid(int nObjectType, string sTemplate, location lLoc, int bUseAppearAnimation = FALSE)
{
    CreateObject(nObjectType, sTemplate, lLoc, bUseAppearAnimation);
}

void main()
{
    object oSpawn = GetWaypointByTag("WP_Spawn");
    location lSpawn = GetLocation(oSpawn);

    DelayCommand(0.4, CreateObjectVoid(OBJECT_TYPE_CREATURE, "cityguard", lSpawn));
}

Is this wanted behaviour?

 

Oh, and ff there is no DelayCommand() the game freezes on the loading screen...



#2
meaglyn

meaglyn
  • Members
  • 808 messages

Creating a creature in an area fires the on enter script I believe. Your results are not really that surprising...

 

If you want that to fire only if a PC enters you will want to check that before doing the spawn.

if (!GetIsPC(GetEnteringObject()) return;

Somewhere in main before you spawn should help.


  • Zeke aime ceci

#3
Zeke

Zeke
  • Members
  • 48 messages

Oh.....

 

Sorry for the stupid question.

 

Thank you for the quick answer!