39 lines
1.3 KiB
Plaintext
39 lines
1.3 KiB
Plaintext
//////////////////////////////////////////////////////////////////////////////
|
|
/* Original script by: <Unknown>
|
|
/ Concept explained by: Xovian
|
|
/
|
|
/ Henchman patrol script, upon using this ability, the henchmen will
|
|
/ go towards the nearest enemy that they can find. This script is useful
|
|
/ because many times henchmen follow the player insteead of taking an active
|
|
/ role in the front if they are a tank or the like. Very useful for the
|
|
/ support classes out there that could use a henchmen meat shield.
|
|
*/
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
void main()
|
|
{
|
|
object oPC = GetFirstPC();
|
|
object oArea = GetArea(OBJECT_SELF);
|
|
object oMob = GetFirstObjectInArea(oArea);
|
|
object oTarg;
|
|
int iFlag;
|
|
while (GetIsObjectValid(oMob))
|
|
{
|
|
if (GetObjectType(oMob)==OBJECT_TYPE_CREATURE && !GetIsDead(oMob))
|
|
{
|
|
if (GetIsEnemy(oMob, oPC) && GetDistanceToObject(oMob)<50.0)
|
|
{
|
|
oTarg = oMob;
|
|
iFlag=1;
|
|
}
|
|
}
|
|
oMob = GetNextObjectInArea(oArea);
|
|
}
|
|
if (iFlag==1)
|
|
{
|
|
SpeakString("I think I hear something!");
|
|
ActionMoveToObject(oTarg, FALSE, 5.0);
|
|
ActionAttack(oTarg);
|
|
}
|
|
else SpeakString("I sense no enemies in the immediate area");
|
|
}
|