2025/07/28 Update
Added PEPS AI Full compile.
This commit is contained in:
@@ -1,51 +1,54 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: 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
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
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();
|
||||
if (GetObjectType(oDoor) == OBJECT_TYPE_CREATURE)
|
||||
object oCreature = OBJECT_SELF;
|
||||
ExecuteScript("prc_npc_blocked", oCreature);
|
||||
// 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)
|
||||
{
|
||||
// * 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)
|
||||
if(GetIsEnemy(oObject, oCreature))
|
||||
{
|
||||
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)
|
||||
if(ai_CanIAttack(oCreature) && ai_GetIsInCombat(oCreature))
|
||||
{
|
||||
ActionEquipMostDamagingRanged(oEnemy);
|
||||
ActionAttack(oEnemy);
|
||||
ai_DoMonsterCombatRound(oCreature);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
} */
|
||||
if(ai_CheckForCombat(oCreature, TRUE)) return;
|
||||
}
|
||||
}
|
||||
// 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)
|
||||
{
|
||||
if(AI_DEBUG) ai_Debug("nw_c2_defaulte", "33", GetName(oCreature) + " is opening " + GetName(oObject));
|
||||
DoDoorAction(oObject, DOOR_ACTION_OPEN);
|
||||
return;
|
||||
}
|
||||
if(GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 5)
|
||||
// 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) == "")
|
||||
{
|
||||
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);
|
||||
}
|
||||
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