PDA

View Full Version : OnNotice in .utc file question


Seamhainn
01-18-2008, 06:37 AM
Is it save to assume that the perception range is determind in the Perception Range entry in the .utc file of a creature/npc?

Is it also save to assume that the reaction of said npc is determind by the script entered in the OnNotice field in the .utc file?

Can it be checked scriptwise if the PC is alone (without any other party member(s)) or in Solo mode?

Thanks and take care

stoffe
01-18-2008, 08:13 AM
Is it save to assume that the perception range is determind in the Perception Range entry in the .utc file of a creature/npc?

Is it also save to assume that the reaction of said npc is determind by the script entered in the OnNotice field in the .utc file?

Can it be checked scriptwise if the PC is alone (without any other party member(s)) or in Solo mode?


The perception range is a reference to the ranges.2da file where the radius of their detection bubble is specified (in meters). The OnNotice/OnPerception event of the NPC fires whenever they first perceive anything within their range, when they no longer perceive something in their range. Perception in this case is both sight and hearing.

So, if you want to do something special whenever an NPC sees the player, you could use a script that looks something like:

void main() {
if (GetLastPerceptionSeen()
&& (GetLastPerceived() == GetFirstPC())
&& ((GetPartyMemberCount() > 1) && !GetSoloMode()))
{
// Just noticed the player who's not alone or solo! Do something!
}
else {
ExecuteScript("k_ai_master", OBJECT_SELF, 1002);
}
}


Keep in mind that this event will only fire when the character is first perceives, and when perception of it is lost. It will not fire continuously while the character is being seen/heard.

Seamhainn
01-18-2008, 08:29 AM
Keep in mind that this event will only fire when the character is first perceives, and when perception of it is lost. It will not fire continuously while the character is being seen/heard.

Ah, that is the problem! I want the npc run away from the pc as long as he is not alone or in solo mode. So, I guess, this is unfortunately not an option :-( . Do you have another solution for this problem by chance?

Again: I want that a npc flees from the pc as long as the pc is not alone. If the pc is alone the pc can talk with the npc.

Thanks again and take care