Machaira wrote:
You know what happens when you assume, right?

How do you know that every Unreal engine game hard-coded data?
Cause you can just open UnrealEd and see nearly everything?
Code:
function PickDestination()
{
local inventory Inv, BestInv;
local float Bestweight, NewWeight, DroppedDist;
local actor BestPath;
local decoration Dec;
local NavigationPoint N;
local int i;
local bool bTriedToPick, bLockedAndLoaded, bNearPoint;
local byte TeamPriority;
local Pawn P;
bCanTranslocate = ( Level.Game.IsA('DeathMatchPlus') && DeathMatchPlus(Level.Game).CanTranslocate(self) );
if ( Level.Game.IsA('TeamGamePlus') )
{
if ( (Orders == 'FreeLance') && !bStayFreelance
&& (Orders != BotReplicationInfo(PlayerReplicationInfo).RealOrders) )
SetOrders(BotReplicationInfo(PlayerReplicationInfo).RealOrders, BotReplicationInfo(PlayerReplicationInfo).RealOrderGiver, true);
if ( FRand() < 0.5 )
bStayFreelance = false;
LastAttractCheck = Level.TimeSeconds - 0.1;
if ( TeamGamePlus(Level.Game).FindSpecialAttractionFor(self) )
{
if ( IsInState('Roaming') )
{
TeamPriority = TeamGamePlus(Level.Game).PriorityObjective(self);
if ( TeamPriority > 16 )
{
PickLocalInventory(160, 1.8);
return;
}
else if ( TeamPriority > 1 )
{
PickLocalInventory(200, 1);
return;
}
else if ( TeamPriority > 0 )
{
PickLocalInventory(280, 0.55);
return;
}
PickLocalInventory(400, 0.5);
}
return;
}
}
bLockedAndLoaded = ( (Weapon.AIRating > 0.4) && (Health > 60) );
if ( Orders == 'Follow' )
{
if ( Pawn(OrderObject) == None )
SetOrders('FreeLance', None);
else if ( (Pawn(OrderObject).Health > 0) )
{
bNearPoint = CloseToPointMan(Pawn(OrderObject));
if ( !bNearPoint )
{
if ( !bLockedAndLoaded )
{
bTriedToPick = true;
if ( PickLocalInventory(600, 0) )
return;
if ( !OrderObject.IsA('PlayerPawn') )
{
BestWeight = 0;
BestPath = FindBestInventoryPath(BestWeight, !bNovice && (skill >= 2));
if ( BestPath != None )
{
MoveTarget = BestPath;
return;
}
}
}
if ( ActorReachable(OrderObject) )
MoveTarget = OrderObject;
else
MoveTarget = FindPathToward(OrderObject);
if ( (MoveTarget != None) && (VSize(Location - MoveTarget.Location) > 2 * CollisionRadius) )
return;
if ( (VSize(OrderObject.Location - Location) < 1600) && LineOfSightTo(OrderObject) )
bNearPoint = true;
if ( bVerbose )
log(self$" found no path to "$OrderObject);
}
else if ( !bInitLifeMessage && (Pawn(OrderObject).Health > 0)
&& (VSize(Location - OrderObject.Location) < 500) )
{
bInitLifeMessage = true;
SendTeamMessage(Pawn(OrderObject).PlayerReplicationInfo, 'OTHER', 3, 10);
}
}
}
if ( (Orders == 'Defend') && bLockedAndLoaded )
{
if ( PickLocalInventory(300, 0.55) )
return;
if ( FindAmbushSpot() )
return;
if ( !LineOfSightTo(OrderObject) )
{
MoveTarget = FindPathToward(OrderObject);
if ( MoveTarget != None )
return;
}
else if ( !bInitLifeMessage )
{
bInitLifeMessage = true;
SendTeamMessage(None, 'OTHER', 9, 10);
}
}
if ( (Orders == 'Hold') && bLockedAndLoaded && !LineOfSightTo(OrderObject) )
{
GotoState('Hold');
return;
}
if ( !bTriedToPick && PickLocalInventory(600, 0) )
return;
if ( (Orders == 'Hold') && bLockedAndLoaded )
{
if ( VSize(Location - OrderObject.Location) < 20 )
GotoState('Holding');
else
GotoState('Hold');
return;
}
if ( ((Orders == 'Follow') && (bNearPoint || (Level.Game.IsA('TeamGamePlus') && TeamGamePlus(Level.Game).WaitForPoint(self))))
|| ((Orders == 'Defend') && bLockedAndLoaded && LineOfSightTo(OrderObject)) )
{
if ( FRand() < 0.35 )
GotoState('Wandering');
else
{
CampTime = 0.8;
GotoState('Roaming', 'Camp');
}
return;
}
if ( (OrderObject != None) && !OrderObject.IsA('Ambushpoint') )
bWantsToCamp = false;
else if ( (Weapon.AIRating > 0.5) && (Health > 90) && !Region.Zone.bWaterZone )
{
bWantsToCamp = ( bWantsToCamp || (FRand() < CampingRate * FMin(1.0, Level.TimeSeconds - LastCampCheck)) );
LastCampCheck = Level.TimeSeconds;
}
else
bWantsToCamp = false;
if ( bWantsToCamp && FindAmbushSpot() )
return;
// if none found, check for decorations with inventory
if ( !bNoShootDecor )
foreach visiblecollidingactors(class'Decoration', Dec, 500,,true)
if ( Dec.Contents != None )
{
bNoShootDecor = true;
Target = Dec;
GotoState('Roaming', 'ShootDecoration');
return;
}
bNoShootDecor = false;
BestWeight = 0;
// look for long distance inventory
BestPath = FindBestInventoryPath(BestWeight, !bNovice && (skill >= 2));
//log("roam to"@BestPath);
//log("---------------------------------");
if ( BestPath != None )
{
MoveTarget = BestPath;
return;
}
// nothing around - maybe just wait a little
if ( (FRand() < 0.35) && bNovice
&& (!Level.Game.IsA('DeathMatchPlus') || !DeathMatchPlus(Level.Game).OneOnOne()) )
{
GoalString = " Nothing cool, so camp ";
CampTime = 3.5 + FRand() - skill;
GotoState('Roaming', 'Camp');
}
// if roamed to ambush point, stay there maybe
if ( (AmbushPoint(RoamTarget) != None)
&& (VSize(Location - RoamTarget.Location) < 2 * CollisionRadius)
&& (FRand() < 0.4) )
{
CampTime = 4.0;
GotoState('Roaming', 'LongCamp');
return;
}
// hunt player
if ( (!bNovice || (Level.Game.IsA('DeathMatchPlus') && DeathMatchPlus(Level.Game).OneOnOne()))
&& (Weapon.AIRating > 0.5) && (Health > 60) )
{
if ( (PlayerPawn(RoamTarget) != None) && !LineOfSightTo(RoamTarget) )
{
BestPath = FindPathToward(RoamTarget);
if ( BestPath != None )
{
MoveTarget = BestPath;
return;
}
}
else
{
// high skill bots go hunt player
for ( P=Level.PawnList; P!=None; P=P.NextPawn )
if ( P.bIsPlayer && P.IsA('PlayerPawn')
&& ((VSize(P.Location - Location) > 1500) || !LineOfSightTo(P)) )
{
BestPath = FindPathToward(P);
if ( BestPath != None )
{
RoamTarget = P;
MoveTarget = BestPath;
return;
}
}
}
bWantsToCamp = true; // don't camp if couldn't go to player
}
// look for ambush spot if didn't already try
if ( !bWantsToCamp && FindAmbushSpot() )
{
RoamTarget = AmbushSpot;
return;
}
// find a roamtarget
if ( RoamTarget == None )
{
i = 0;
for ( N=Level.NavigationPointList; N!=None; N=N.NextNavigationPoint )
if ( N.IsA('InventorySpot') )
{
i++;
if ( (RoamTarget == None) || (Rand(i) == 0) )
RoamTarget = N;
}
}
// roam around
if ( RoamTarget != None )
{
if ( ActorReachable(RoamTarget) )
{
MoveTarget = RoamTarget;
RoamTarget = None;
if ( VSize(MoveTarget.Location - Location) > 2 * CollisionRadius )
return;
}
else
{
BestPath = FindPathToward(RoamTarget);
if ( BestPath != None )
{
MoveTarget = BestPath;
return;
}
else
RoamTarget = None;
}
}
// wander or camp
if ( FRand() < 0.35 )
GotoState('Wandering');
else
{
GoalString = " Nothing cool, so camp ";
CampTime = 3.5 + FRand() - skill;
GotoState('Roaming', 'Camp');
}
}