65 lines
1.8 KiB
Plaintext
65 lines
1.8 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Custom AI Demo Template
|
|
//:: x2_ai_demo
|
|
//:: Copyright (c) 2003 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This is a template for those who want to
|
|
override the standard combat AI NWN uses.
|
|
|
|
The code in this file effectivly replaces
|
|
the DetermineCombatRound() function in
|
|
nw_i0_generic.nss, which is the core of the
|
|
NWN combat AI.
|
|
|
|
To override the default AI with this or any
|
|
other AI script you created, you can either
|
|
call the SetCreatureOverrideAIScript from
|
|
x2_inc_switches
|
|
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Georg Zoeller
|
|
//:: Created On: 2003-08-21
|
|
//:://////////////////////////////////////////////
|
|
|
|
#include "nw_i0_generic"
|
|
#include "x2_inc_switches"
|
|
void main()
|
|
{
|
|
// The following two lines should not be touched
|
|
object oIntruder = GetCreatureOverrideAIScriptTarget();
|
|
ClearCreatureOverrideAIScriptTarget();
|
|
|
|
int nCurrHP = GetCurrentHitPoints();
|
|
|
|
if (nCurrHP > FloatToInt(GetMaxHitPoints ()* 0.8))
|
|
{
|
|
SetCreatureFlag(OBJECT_SELF,CREATURE_AI_MODIFIED_MAGIC_RATE,100);
|
|
}
|
|
else if ( nCurrHP < GetMaxHitPoints()/3)
|
|
{
|
|
if (GetHasSpell(SPELL_HEAL))
|
|
{
|
|
ClearAllActions(TRUE);
|
|
ActionCastSpellAtObject(SPELL_HEAL,OBJECT_SELF,METAMAGIC_NONE);
|
|
SetCreatureOverrideAIScriptFinished();
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
SetCreatureFlag(OBJECT_SELF,CREATURE_AI_MODIFIED_OFFENSE_RATE,100);
|
|
SetCreatureFlag(OBJECT_SELF,CREATURE_AI_MODIFIED_MAGIC_RATE,1);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SetCreatureFlag(OBJECT_SELF,CREATURE_AI_MODIFIED_OFFENSE_RATE,100);
|
|
SetCreatureFlag(OBJECT_SELF,CREATURE_AI_MODIFIED_MAGIC_RATE,1);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|