20255/17/19 Update
Added PEPS AI. Full compile.
This commit is contained in:
@@ -1,73 +1,53 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: 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 "hench_i0_generic"
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
Script: nw_c2_defaulte
|
||||
Programmer: Philos
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Monsters OnBlocked event script;
|
||||
Can be blocked by a creature or door.
|
||||
*///////////////////////////////////////////////////////////////////////////////
|
||||
#include "0i_associates"
|
||||
void main()
|
||||
{
|
||||
//ExecuteScript("prc_npc_blocked", OBJECT_SELF);
|
||||
|
||||
object oDoor = GetBlockingDoor();
|
||||
|
||||
// Jug_Debug(GetName(OBJECT_SELF) + " is blocked by " + GetName(oDoor));
|
||||
|
||||
if (GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) < 5)
|
||||
object oCreature = OBJECT_SELF;
|
||||
// This actually gets either a Creature or Door that is blocking OBJECT_SELF.
|
||||
object oObject = GetBlockingDoor();
|
||||
if(AI_DEBUG) ai_Debug("nw_c2_defaulte", "14", GetName(oCreature) + " is being blocked by " + GetName(oObject));
|
||||
int nObjectType = GetObjectType(oObject);
|
||||
if(nObjectType == OBJECT_TYPE_CREATURE)
|
||||
{
|
||||
return; // too stupid to follow (out of sight, out of mind)
|
||||
// TODO add wisdom check?
|
||||
}
|
||||
|
||||
int iAggPursue = GetLocalInt(OBJECT_SELF,"ScoutMode") != 1;
|
||||
if (!iAggPursue)
|
||||
{
|
||||
if (GetPlotFlag(oDoor))
|
||||
if(GetIsEnemy(oObject, oCreature))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (GetIsTrapped(oDoor))
|
||||
{
|
||||
return;
|
||||
if(ai_CanIAttack(oCreature) && ai_GetIsInCombat(oCreature))
|
||||
{
|
||||
ai_DoMonsterCombatRound(oCreature);
|
||||
return;
|
||||
}
|
||||
if(ai_CheckForCombat(oCreature, TRUE)) return;
|
||||
}
|
||||
}
|
||||
|
||||
int nSel;
|
||||
if (iAggPursue)
|
||||
{
|
||||
nSel = 0xffff;
|
||||
}
|
||||
else
|
||||
// Anything below blocking us is a door.
|
||||
if(nObjectType != OBJECT_TYPE_DOOR) return;
|
||||
// Only open the door if the player has turned door opening on.
|
||||
if(!GetLocalInt(GetModule(), AI_RULE_OPEN_DOORS)) return;
|
||||
//if(GetLockKeyTag(oObject) != "") return;
|
||||
else if(GetIsDoorActionPossible(oObject, DOOR_ACTION_OPEN) &&
|
||||
GetAbilityScore(oCreature, ABILITY_INTELLIGENCE) >= 5)
|
||||
{
|
||||
nSel = GetMonsterOptions(HENCH_MONAI_UNLOCK | HENCH_MONAI_OPEN);
|
||||
if(AI_DEBUG) ai_Debug("nw_c2_defaulte", "33", GetName(oCreature) + " is opening " + GetName(oObject));
|
||||
DoDoorAction(oObject, DOOR_ACTION_OPEN);
|
||||
return;
|
||||
}
|
||||
if((HENCH_MONAI_OPEN & nSel) && GetIsDoorActionPossible(oDoor, DOOR_ACTION_OPEN) &&
|
||||
GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 7 &&
|
||||
GetCreatureUseItems(OBJECT_SELF))
|
||||
// If we are in combat we should ignore doors that do not easily open.
|
||||
if(GetIsDoorActionPossible(oObject, DOOR_ACTION_BASH) &&
|
||||
ai_GetWeaponDamage(oCreature, 3, TRUE) > GetHardness(oObject) &&
|
||||
GetLockKeyTag(oObject) == "")
|
||||
{
|
||||
DoDoorAction(oDoor, DOOR_ACTION_OPEN);
|
||||
if (!iAggPursue)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF,"OpenedDoor", TRUE);
|
||||
}
|
||||
}
|
||||
else if ((HENCH_MONAI_UNLOCK & nSel) && GetIsDoorActionPossible(oDoor, DOOR_ACTION_UNLOCK))
|
||||
{
|
||||
DoDoorAction(oDoor, DOOR_ACTION_UNLOCK);
|
||||
}
|
||||
else if((HENCH_MONAI_UNLOCK & nSel) && GetIsDoorActionPossible(oDoor, DOOR_ACTION_BASH))
|
||||
{
|
||||
DoDoorAction(oDoor, DOOR_ACTION_BASH);
|
||||
ActionWait(1.0);
|
||||
ActionAttack(oObject);
|
||||
// Give them 3 rounds to break through a door.
|
||||
DelayCommand(18.0, ai_ClearCreatureActions(TRUE));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user