Battledale_PRC8/_removed/nw_c2_default6.nss
Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

147 lines
2.4 KiB
Plaintext

/////////////////:://////////////////////////////////////////////////
//:: Default On Damaged
//:: NW_C2_DEFAULT6
//:: Copyright (c) 2001 Bioware Corp.
//::////////////////////////////////////////////////
/*
If already fighting then ignore, else determine
combat round
*/
//::////////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//::///////////////////////////////////////////////////
#include "NW_I0_GENERIC"
// do the voice
void DoVoice();
// About to die
void DieCall(object oMob = OBJECT_SELF);
void main()
{
object oTarget = GetLastDamager();
SetTarget(oTarget);
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
if (GetStealthMode(OBJECT_SELF)==STEALTH_MODE_ACTIVATED)
{
ActionUseSkill(SKILL_HIDE,OBJECT_SELF);
}
if (GetDetectMode(OBJECT_SELF))
{
ActionUseSkill(SKILL_SPOT,OBJECT_SELF);
}
int nCheckHeal=CheckHeal();
if (nCheckHeal==FALSE)
{
DieCall();
}
if (GetObjectType(oTarget)==OBJECT_TYPE_AREA_OF_EFFECT)
{
oTarget=GetAreaOfEffectCreator(oTarget);
}
int nHP=GetMaxHitPoints();
int nDamage=GetTotalDamageDealt();
if ((d2()==1)&&(Random(nHP)<nDamage)&&(GetIsObjectValid(oTarget)))
{
SetVictim(oTarget);
DoVoice();
}
if (!GetIsFighting(OBJECT_SELF))
{
if (GetObjectSeen(oTarget))
{
if ((!GetIsInCombat())&&(d4()==1)&&(GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_FRIEND,OBJECT_SELF,1,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN))))
{
PlayVoiceChat(VOICE_CHAT_ATTACK);
}
DetermineCombatRound();
}
else
{
ActionMoveToObject(oTarget,TRUE,3.0);
}
}
if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1006));
}
}
void DoVoice()
{
int nRandom=d3();
if (nRandom==1)
{
PlayVoiceChat(VOICE_CHAT_BATTLECRY2);
}
else if (nRandom==2)
{
PlayVoiceChat(VOICE_CHAT_BATTLECRY2);
;
}
else if (nRandom==3)
{
PlayVoiceChat(VOICE_CHAT_BATTLECRY3);
}
}
void DieCall(object oMob=OBJECT_SELF)
{
if (d2()==1)
{
// 50 per cent chance of not making the call;
return;
}
if (GetLocalInt(OBJECT_SELF,"diecall"))
{
// if I have called for help once, just return;
return;
}
if(GetCurrentHitPoints(oMob)> (GetMaxHitPoints(oMob)/4))
{
// not near dead
return;
}
PlayVoiceChat(VOICE_CHAT_NEARDEATH);
SetLocalInt(OBJECT_SELF,"diecall",1);
return;
}