This is my script, which I attach to the "OnPercieve" slot of the NPC.
#include "nw_i0_generic"
void main()
{
// * if not runnning normal or better Ai then exit for performance reasons
// * if not runnning normal or better Ai then exit for performance reasons
if (GetAILevel() == AI_LEVEL_VERY_LOW) return;
object oPercep = GetLastPerceived();
int bSeen = GetLastPerceptionSeen();
int bHeard = GetLastPerceptionHeard();
if (bSeen)
{
//MyPrintString("GetLastPerceptionSeen: TRUE");
if (GetIsPC(oPercep))
{
SpeakString("I C WUT U DID THERE");
}
}
// activate ambient animations or walk waypoints if appropriate
if (!IsInConversation(OBJECT_SELF)) {
if (GetIsPostOrWalking()) {
WalkWayPoints();
} else if (GetIsPC(oPercep) &&
(GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS)
|| GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN)
|| GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS)
|| GetIsEncounterCreature()))
{
SetAnimationCondition(NW_ANIM_FLAG_IS_ACTIVE);
}
}
}
The NPCs will whip around if I am too close behind them. I think this is coming from the whole "hearing" thing. Is there a way to make deaf NPCs? I only want them to see the player if the player is running in front of them.
As an alternate way of doing this, would it somehow be possible to use angles, such as with "GetAngleBetweenLocations(location 1, location 2)" to determine if the player is in a certain line of sight..?
Thanks.





Retour en haut







