113 lines
5.7 KiB
Plaintext
113 lines
5.7 KiB
Plaintext
#include "X0_INC_HENAI"
|
|
void main()
|
|
{ //SpawnScriptDebugger();
|
|
|
|
if(!GetAssociateState(NW_ASC_IS_BUSY))
|
|
{
|
|
object oMaster = GetMaster();
|
|
//Seek out and disable undisabled traps
|
|
object oTrap = GetNearestTrapToObject();
|
|
if (bkAttemptToDisarmTrap(oTrap) == TRUE) return ; // succesful trap found and disarmed
|
|
|
|
if(GetIsObjectValid(oMaster) &&
|
|
GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOW &&
|
|
GetCurrentAction(OBJECT_SELF) != ACTION_DISABLETRAP &&
|
|
GetCurrentAction(OBJECT_SELF) != ACTION_OPENLOCK &&
|
|
GetCurrentAction(OBJECT_SELF) != ACTION_REST &&
|
|
GetCurrentAction(OBJECT_SELF) != ACTION_ATTACKOBJECT)
|
|
{
|
|
if(
|
|
!GetIsObjectValid(GetAttackTarget()) &&
|
|
!GetIsObjectValid(GetAttemptedSpellTarget()) &&
|
|
!GetIsObjectValid(GetAttemptedAttackTarget()) &&
|
|
!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN))
|
|
)
|
|
{
|
|
if (GetIsObjectValid(oMaster) == TRUE)
|
|
{
|
|
if(GetDistanceToObject(oMaster) > 6.0)
|
|
{
|
|
if(GetAssociateState(NW_ASC_HAVE_MASTER))
|
|
{
|
|
if(!GetIsFighting(OBJECT_SELF))
|
|
{
|
|
if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND))
|
|
{
|
|
if(GetDistanceToObject(GetMaster()) > GetFollowDistance())
|
|
{
|
|
ClearActions(CLEAR_NW_CH_AC1_49);
|
|
if(GetAssociateState(NW_ASC_AGGRESSIVE_STEALTH) || GetAssociateState(NW_ASC_AGGRESSIVE_SEARCH))
|
|
{
|
|
if(GetAssociateState(NW_ASC_AGGRESSIVE_STEALTH))
|
|
{
|
|
//ActionUseSkill(SKILL_HIDE, OBJECT_SELF);
|
|
//ActionUseSkill(SKILL_MOVE_SILENTLY,OBJECT_SELF);
|
|
}
|
|
if(GetAssociateState(NW_ASC_AGGRESSIVE_SEARCH))
|
|
{
|
|
ActionUseSkill(SKILL_SEARCH, OBJECT_SELF);
|
|
}
|
|
MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + "Assigning Force Follow Command with Search and/or Stealth");
|
|
ActionForceFollowObject(oMaster, GetFollowDistance());
|
|
}
|
|
else
|
|
{
|
|
MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + "Assigning Force Follow Normal");
|
|
ActionForceFollowObject(oMaster, GetFollowDistance());
|
|
//ActionForceMoveToObject(GetMaster(), TRUE, GetFollowDistance(), 5.0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND))
|
|
{
|
|
if(GetIsObjectValid(oMaster))
|
|
{
|
|
if(GetCurrentAction(oMaster) != ACTION_REST)
|
|
{
|
|
ClearActions(CLEAR_NW_CH_AC1_81);
|
|
if(GetAssociateState(NW_ASC_AGGRESSIVE_STEALTH) || GetAssociateState(NW_ASC_AGGRESSIVE_SEARCH))
|
|
{
|
|
if(GetAssociateState(NW_ASC_AGGRESSIVE_STEALTH))
|
|
{
|
|
//ActionUseSkill(SKILL_HIDE, OBJECT_SELF);
|
|
//ActionUseSkill(SKILL_MOVE_SILENTLY,OBJECT_SELF);
|
|
}
|
|
if(GetAssociateState(NW_ASC_AGGRESSIVE_SEARCH))
|
|
{
|
|
ActionUseSkill(SKILL_SEARCH, OBJECT_SELF);
|
|
}
|
|
MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + "Assigning Force Follow Command with Search and/or Stealth");
|
|
ActionForceFollowObject(oMaster, GetFollowDistance());
|
|
}
|
|
else
|
|
{
|
|
MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + "Assigning Force Follow Normal");
|
|
ActionForceFollowObject(oMaster, GetFollowDistance());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if(!GetIsObjectValid(GetAttackTarget()) &&
|
|
!GetIsObjectValid(GetAttemptedSpellTarget()) &&
|
|
!GetIsObjectValid(GetAttemptedAttackTarget()) &&
|
|
!GetAssociateState(NW_ASC_MODE_STAND_GROUND))
|
|
{
|
|
//DetermineCombatRound();
|
|
}
|
|
|
|
}
|
|
if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT))
|
|
{
|
|
SignalEvent(OBJECT_SELF, EventUserDefined(1001));
|
|
}
|
|
}
|
|
{
|
|
if (GetMaster(OBJECT_SELF) == OBJECT_INVALID) {
|
|
ExecuteScript("demonleave", OBJECT_SELF);}}
|
|
}
|