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 ?
GetNearestCreature
Débuté par
Calvix2
, août 30 2011 06:42
#1
Posté 30 août 2011 - 06:42
#2
Posté 30 août 2011 - 06:52
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.
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
Posté 30 août 2011 - 06:58
object oTarget = GetNearestCreature( CREATURE_TYPE_PLAYER_CHAR , PLAYER_CHAR_IS_PC , GetEnteringObject() );
It will default to is alive
It will default to is alive
#4
Posté 31 août 2011 - 10:03
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.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.
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 .





Retour en haut






