Aller au contenu

Photo

GetNearestCreature


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

#1
Calvix2

Calvix2
  • Members
  • 3 messages
Hi,
tried get nearest PC that is around Enemy NPC, witch entered a trigger

object oTarget = GetNearestCreature( CREATURE_TYPE_PLAYER_CHAR , PLAYER_CHAR_IS_PC , GetEnteringObject() ,CREATURE_TYPE_IS_ALIVE, TRUE);

but always get a OBJECT_INVALID.

Any suggestion ?

#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
object GetNearestCreature(int nFirstCriteriaType, int nFirstCriteriaValue, object oTarget=OBJECT_SELF, int nNth=1, int nSecondCriteriaType=-1, int nSecondCriteriaValue=-1, int nThirdCriteriaType=-1, int nThirdCriteriaValue=-1 )

Looking at that, it looks like you're missing the nNth portion of it. You'll need to add a 1 after GetEnteringObject().

I'm surprised it didn't give an error when you compiled it with it missing that.

#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
object oTarget = GetNearestCreature( CREATURE_TYPE_PLAYER_CHAR , PLAYER_CHAR_IS_PC , GetEnteringObject() );


It will default to is alive

#4
Shadooow

Shadooow
  • Members
  • 4 474 messages

Failed.Bard wrote...

object GetNearestCreature(int nFirstCriteriaType, int nFirstCriteriaValue, object oTarget=OBJECT_SELF, int nNth=1, int nSecondCriteriaType=-1, int nSecondCriteriaValue=-1, int nThirdCriteriaType=-1, int nThirdCriteriaValue=-1 )

Looking at that, it looks like you're missing the nNth portion of it. You'll need to add a 1 after GetEnteringObject().

I'm surprised it didn't give an error when you compiled it with it missing that.

As LightFoot8 said default value for nSecondCriteriaType and nSecondCriteriaValue is PLAYER_CHAR_IS_ALIVE,TRUE, this is special behavior since 1.69. But this means that you wont find dead PC by this! If you want to find PC in any state you have to repeat the call with parameters for DEAD if you find OBJECT_INVALID.

Also I would not used GetEnteringObject() as a object to look from rather OBJECT_SELF. You cant be sure that it was NPC who entered trigger, it could be the PC you are looking for.

Modifié par ShaDoOoW, 31 août 2011 - 10:06 .