28 lines
814 B
Plaintext
28 lines
814 B
Plaintext
|
// Put this OnHeartbeat.
|
||
|
// Will abort (do nothing) if fighting or talking or if no PCs are in the area.
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
// If running the lowest AI, abort for performance reasons.
|
||
|
if ( GetAILevel() == AI_LEVEL_VERY_LOW )
|
||
|
return;
|
||
|
|
||
|
// If busy with combat or conversation, skip this heartbeat.
|
||
|
if ( IsInConversation(OBJECT_SELF) || GetIsInCombat() )
|
||
|
return;
|
||
|
|
||
|
// Get the PC who will be referenced in this event.
|
||
|
object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF, 1,
|
||
|
CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN);
|
||
|
|
||
|
// Only fire if a PC is seen.
|
||
|
if ( OBJECT_INVALID == oPC )
|
||
|
return;
|
||
|
|
||
|
ActionSpeakString("Shut up and let me sleep.");
|
||
|
|
||
|
ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_TIRED);
|
||
|
|
||
|
}
|
||
|
|