ShaDoOoW wrote...
Has anyone tried using bits for constants there? Does it work?
For example I need to get creature that OBJECT_SELF either see or hear (ha, anothere question does by "heard" mean "spotted by listen skill" ?). But there isn't PERCEPTION_TYPE_SEEN_OR_HEARD constant. So I thought I will use PERCEPTION_TYPE_SEEN|PERCEPTION_TYPE_HEARD. But testing this is quite difficult...
int PERCEPTION_SEEN_AND_HEARD = 0;
int PERCEPTION_NOT_SEEN_AND_NOT_HEARD = 1;
int PERCEPTION_HEARD_AND_NOT_SEEN = 2;
int PERCEPTION_SEEN_AND_NOT_HEARD = 3;
int PERCEPTION_NOT_HEARD = 4;
int PERCEPTION_HEARD = 5;
int PERCEPTION_NOT_SEEN = 6;
int PERCEPTION_SEEN = 7;
Lets first look at the two Perscptions you are asking about
int PERCEPTION_SEEN = 7; or in binary 0000_0111
int PERCEPTION_HEARD = 5; or in binary 0000_0101
So PERCEPTION_SEEN | PERCEPTION_HEARD is the same as saying
0000_0111 | 0000_0101 = 0000_0111 OR 7 | 5 = 7
So saying PERCEPTION_SEEN | PERCEPTION_HEARD = PERCEPTION_SEEN
So no that will not work.
I think I would end up useing
int i=0;
do
{
i++;
oTarget =GetNearestObject(OBJECT_TYPE_CREATURE,OBJECT_SELF,i);
If (GetIsSeen(oTarget) || GetIsHeard(oTarget)) break;
}
while(GetIsObjectValid(oTarget));
Modifié par Lightfoot8, 14 novembre 2010 - 11:55 .