Already done in MH-Frigate_R16 if I well remember the title... ( Shooting Hydraulic Compressor ) + View Support for "EndCam" - after ending match...
It's not the best code concerning Bot because it was "hired" from elsewhere (several things are assumptions) and there might be errors if settings are wrong but... if it's about BOT only, it worked... And... can be disabled/enabled on demand (triggered).
Code: Select all
class Bot_Hunter expands Triggers;
var() bool bOnceOnly, bEnabled;
var() class<Bot> LimitedToClass;
var Bot Pending;
var() float Frequency;
var Actor MyPoint;
var() name PointTag;
event PostBeginPlay()
{
FindMyPoint();
Super.PostBeginPlay();
}
function FindMyPoint()
{
local Actor A;
if ( PointTag != '' )
foreach RadiusActors(class'Actor',A,700)
{
if ( A != None && A.Tag == PointTag )
{
MyPoint = A;
break;
log ("Point Set "$A);
}
}
}
function Timer()
{
if ( MyPoint != None && bEnabled && Pending.health > 0 )
{
if ( Level.Game.IsA('TeamGamePlus') )
TeamGamePlus(Level.Game).FindSpecialAttractionFor(Pending)==False;
if ( MyPoint.bIsPawn )
{
Pending.DesiredRotation = Rotation;
Pending.Velocity=Vect(0,0,0);
Pending.Target=MyPoint;
Pending.Enemy=Pawn(MyPoint);
Pending.GotoState('RangedAttack');
Pending.SpecialPause = RandRange(0.5,2);
}
else
{
Pending.DesiredRotation = Rotation;
Pending.Velocity=Vect(0,0,0);
Pending.Target=MyPoint;
Pending.bShootSpecial=True;
Pending.FireWeapon();
Pending.bFire = 0;
Pending.bAltFire = 0;
Pending.SpecialPause = RandRange(0.5,2);
}
}
}
function Touch( actor Other )
{
if ( Other.IsA('Bot')
&& ((LimitedToClass == None) || (Other.Class == LimitedToClass)) )
{
Pending = Bot(Other);
SetTimer(Frequency, false);
if ( bOnceOnly )
{
Disable('Touch');
Disable('Trigger');
}
}
}
function Trigger( actor Other, pawn EventInstigator )
{
if ( bEnabled )
{
Disable('Touch');
bEnabled = False;
}
else
{
bEnabled = True;
Enable('Touch');
}
}