Here's a script for you. Select the flying creature of a seagull - or other bird with associated appearance.
OnDamage
//::///////////////////////////////////////////////
//:: Name n_dam_seagull
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Seagull On Damaged
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 018.05.06
//:://////////////////////////////////////////////
#include "nw_i0_generic"
void main()
{
object oDamager = GetLastDamager();
if (!GetIsObjectValid(oDamager)) return;
if (GetIsDead(OBJECT_SELF) == TRUE) return;
SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_SEAGULL_FLYING);
// I am damaged, so I won't return
effect eFly = EffectDisappear();
DelayCommand(0.7, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFly, OBJECT_SELF, 30.0));
if (GetCreatureSize(oDamager) > 1)
{
//Shout for friends to flee as well
SpeakString("N_FLEE_ALL", TALKVOLUME_SILENT_TALK);
PlaySound("c_seagull_atk2");
}
// Send the user-defined event signal
if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DAMAGED));
}
}
OnDisturbed
//::///////////////////////////////////////////////
//:: Name
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Seagull OnDisturbed
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 18.05.06
//:://////////////////////////////////////////////
#include "nw_i0_generic"
void main()
{
object oTarget = GetLastDisturbed();
if (GetIsObjectValid(oTarget))
{
// Someone nicked a feather? Fly away and don't come back!
SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_SEAGULL_FLYING);
effect eFly = EffectDisappear();
DelayCommand(0.7, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFly, OBJECT_SELF));
}
// Send the disturbed flag if appropriate.
if(GetSpawnInCondition(NW_FLAG_DISTURBED_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DISTURBED));
}
}
OnPhysicalAttacked
//::///////////////////////////////////////////////
//:: Name n_att_seagull
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Seagull On Physical Attacked
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 18.08.05
//:://////////////////////////////////////////////
void main()
{
object oAttacker = GetLastAttacker();
if (GetIsObjectValid(oAttacker))
{
if (GetCreatureSize(oAttacker) == 1)
{
// Not running away from tiny creatures
ExecuteScript("nw_c2_default5", OBJECT_SELF);
}
else
{
// Need to delay it in order to see if we got wounded or killed.
DelayCommand(1.5, SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_ATTACKED)));
}
}
}
OnSpawn
//::///////////////////////////////////////////////
//:: Default: On Spawn In
//:: n_sp_seagull
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Seagull OnSpawn
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 18.05.06
//:://////////////////////////////////////////////
#include "x0_i0_anims"
void main()
{
SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT);
SetListeningPatterns();
SetListening(OBJECT_SELF,TRUE);
SetListenPattern(OBJECT_SELF, "N_FLY_AWAY", 2001);
DelayCommand(1.5, SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_SEAGULL_WALKING));
}
OnUserDefined
//::///////////////////////////////////////////////
//:: Custom User Defined Event
//:: FileName
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 18.05.06
//:://////////////////////////////////////////////
void main()
{
int nUser = GetUserDefinedEventNumber();
if(nUser == 1004) // ON DIALOGUE
{
int nMatch = GetListenPatternNumber();
if(nMatch == 2001)
{
// Someone shouted to fly away. Do that, but return later.
SetLocalInt(OBJECT_SELF, "BUSY_WITH_ANIMATION", 1);
SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_SEAGULL_FLYING);
effect eFly = EffectDisappearAppear(GetLocation(OBJECT_SELF));
DelayCommand(0.7, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFly, OBJECT_SELF, 30.0));
DelayCommand(22.1, SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_SEAGULL_WALKING));
DelayCommand(22.2, SetLocalInt(OBJECT_SELF, "BUSY_WITH_ANIMATION", 0));
}
}
else if(nUser == 1005) // ATTACKED
{
int nMax = GetMaxHitPoints();
int nCurrent = GetCurrentHitPoints();
if (GetIsDead(OBJECT_SELF) == FALSE &&
nMax == nCurrent)
{
// Neither dead nor damaged; fly away and return later
SetLocalInt(OBJECT_SELF, "BUSY_WITH_ANIMATION", 1);
SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_SEAGULL_FLYING);
effect eFly = EffectDisappearAppear(GetLocation(OBJECT_SELF));
DelayCommand(0.7, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFly, OBJECT_SELF, 30.0));
DelayCommand(22.1, SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_SEAGULL_WALKING));
DelayCommand(22.2, SetLocalInt(OBJECT_SELF, "BUSY_WITH_ANIMATION", 0));
}
}
}
Now you'll have birds that fly away when approached and land again when the player has moved away.
FP!