151 lines
5.4 KiB
Plaintext
151 lines
5.4 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Default On Blocked
|
|
//:: NW_C2_DEFAULTE
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This will cause blocked creatures to open
|
|
or smash down doors depending on int and
|
|
str.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: Nov 23, 2001
|
|
//:://////////////////////////////////////////////
|
|
#include "cai_inc_hos"
|
|
#include "lib_hos2_shpath"
|
|
#include "x0_i0_position"
|
|
|
|
void main()
|
|
{
|
|
//ExecuteScript("prc_npc_blocked", OBJECT_SELF);
|
|
|
|
object oDoor = GetBlockingDoor();
|
|
object oMe=OBJECT_SELF;
|
|
string sType;
|
|
if (GetObjectType(oDoor) == OBJECT_TYPE_CREATURE&&GetIsEnemy(oDoor)==TRUE)
|
|
{
|
|
// * Increment number of times blocked
|
|
/*SetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED", GetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED") + 1);
|
|
if (GetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED") > 3)
|
|
{
|
|
SpeakString("Blocked by creature");
|
|
SetLocalInt(OBJECT_SELF, "X2_NUMTIMES_BLOCKED",0);
|
|
ClearAllActions();
|
|
object oEnemy = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
|
|
if (GetIsObjectValid(oEnemy) == TRUE)
|
|
{
|
|
ActionEquipMostDamagingRanged(oEnemy);
|
|
ActionAttack(oEnemy);
|
|
}
|
|
return;
|
|
} */
|
|
// CUSTOM AI for Harvest of Souls
|
|
if (GetLocalInt(GetModule(),"bCOMBAT_AI_OFF")!=TRUE)
|
|
{ // Combat AI is turned on for the module
|
|
if (GetLocalInt(oMe,"bCOMBAT_AI_ON")==TRUE)
|
|
{ // This unit has been assigned combat AI
|
|
sType=GetLocalString(oMe,"sCOMBAT_AI_TYPE");
|
|
sType=GetStringLowerCase(sType);
|
|
if (sType=="melee")
|
|
{ // melee combat
|
|
ExecuteScript("cai_melee",oMe);
|
|
} // melee combat
|
|
else if (sType=="ranged")
|
|
{ // ranged combat
|
|
ExecuteScript("cai_ranged",oMe);
|
|
} // ranged combat
|
|
else if (sType=="stealth")
|
|
{ // stealth combat
|
|
ExecuteScript("cai_stealth",oMe);
|
|
} // stealth combat
|
|
else if (sType=="support")
|
|
{ // support role such as healing and buffing
|
|
ExecuteScript("cai_support",oMe);
|
|
} // support role such as healing and buffing
|
|
else if (sType=="summon")
|
|
{ // summoner type caster
|
|
ExecuteScript("cai_summon",oMe);
|
|
} // summoner type caster
|
|
else if (sType=="caster")
|
|
{ // spell caster
|
|
ExecuteScript("cai_caster",oMe);
|
|
} // spell caster
|
|
else if (sType=="flee")
|
|
{ // try not to get hurt under any circumstance
|
|
ExecuteScript("cai_flee",oMe);
|
|
} // try not to get hurt under any circumstance
|
|
else if (sType=="hold")
|
|
{ // hold where you are
|
|
ExecuteScript("cai_hold",oMe);
|
|
} // hold where you are
|
|
else
|
|
{ // based on weapon holding and skill
|
|
if (GetSkillRank(SKILL_HIDE,oMe)>10)
|
|
{ // stealth
|
|
ExecuteScript("cai_stealth",oMe);
|
|
} // stealth
|
|
else if (caiGetEquippedWeaponType(oMe,INVENTORY_SLOT_RIGHTHAND)==CAI_WEAPON_RANGED)
|
|
{ // ranged
|
|
ExecuteScript("cai_ranged",oMe);
|
|
} // ranged
|
|
else if (caiGetIsArcane(oMe))
|
|
{ // caster - wizard/sorcerer
|
|
ExecuteScript("cai_caster",oMe);
|
|
} // caster - wizard/sorcerer
|
|
else if (caiGetIsCleric(oMe))
|
|
{ // support - cleric
|
|
ExecuteScript("cai_support",oMe);
|
|
} // support - cleric
|
|
else
|
|
{ // melee
|
|
ExecuteScript("cai_melee",oMe);
|
|
} // melee
|
|
} // based on weapon holding and skill
|
|
} // This unit has been assigned combat AI
|
|
} // Combat AI is turned on for the module
|
|
// CUSTOM AI for Harvest of Souls
|
|
return;
|
|
}
|
|
else if (GetObjectType(oDoor)==OBJECT_TYPE_CREATURE&&!GetIsInCombat(oMe))
|
|
{ // was blocked by a creature
|
|
int nChoice=d20();
|
|
if (nChoice<5)
|
|
{ // move left
|
|
location lLoc=GetStepRightLocation(oDoor);
|
|
AssignCommand(oMe,ClearAllActions());
|
|
AssignCommand(oMe,ActionMoveToLocation(lLoc,TRUE));
|
|
} // move left
|
|
else if (nChoice<8)
|
|
{ // move right
|
|
location lLoc=GetStepLeftLocation(oDoor);
|
|
AssignCommand(oMe,ClearAllActions());
|
|
AssignCommand(oMe,ActionMoveToLocation(lLoc,TRUE));
|
|
} // move right
|
|
else if (nChoice==8)
|
|
{ // move away
|
|
AssignCommand(oMe,ClearAllActions());
|
|
AssignCommand(oMe,ActionMoveAwayFromObject(oDoor,TRUE,IntToFloat(d8())));
|
|
} // move away
|
|
else if (nChoice==9)
|
|
{ // move random
|
|
location lLoc=MoveGetRandomLocation(GetLocation(oDoor),5);
|
|
AssignCommand(oMe,ClearAllActions());
|
|
AssignCommand(oMe,ActionMoveToLocation(lLoc,TRUE));
|
|
} // move random
|
|
} // was blocked by a creature
|
|
|
|
|
|
if(GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 5)
|
|
{
|
|
if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_OPEN) && GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 7 )
|
|
{
|
|
DoDoorAction(oDoor, DOOR_ACTION_OPEN);
|
|
}
|
|
else if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_BASH))
|
|
{
|
|
DoDoorAction(oDoor, DOOR_ACTION_BASH);
|
|
}
|
|
}
|
|
}
|