allright heres some more stuff so you can use it.
i cant get the mobile scorpion that epic provides to work with any ai, so this requires my mobile car
it also uses the player controller from epics mobile vehicle example
this game type will put you in a car and spawn bot cars at every Bot_SpawnPoint you place on your map.
MobileVehicleRaceGame.uc
Code:
class MobileVehicleRaceGame extends SimpleGame;
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
SpawnTheBots();
}
exec function SpawnTheBots()
{
local vector L;
local Rotator R;
local Bot_SpawnPoint S;
local MobileCarPawn P;
local RaceAIController C;
//find all the Bot_SpawnPoints in the map and spawn the bots
foreach WorldInfo.AllActors(class'Bot_SpawnPoint', S)
{
L = S.Location;
R = S.Rotation;
//spawn the bot car pawn
P = Spawn(class'MobileCarPawn',,,L, R);
//spawn the controller and possess pawn
C = Spawn(class'RaceAIController',,,L, R);
C.Possess(P, false);
}
}
//below here is almost a copy of MobileVehicleGameInfo from epic
function RestartPlayer(Controller NewPlayer)
{
local NavigationPoint StartSpot;
local int Idx;
local array<SequenceObject> Events;
local SeqEvent_PlayerSpawned SpawnedEvent;
local Vehicle Vehicle;
if (bRestartLevel && WorldInfo.NetMode!= NM_DedicatedServer && WorldInfo.NetMode!= NM_ListenServer)
{
return;
}
StartSpot = FindPlayerStart(NewPlayer, 255);
if (StartSpot == None)
{
if (NewPlayer.StartSpot != None)
{
StartSpot = NewPlayer.StartSpot;
}
else
{
return;
}
}
if (NewPlayer.Pawn == None)
{
NewPlayer.Pawn = Spawn(class'MobileVehiclePawn',,, StartSpot.Location, StartSpot.Rotation);
}
if (NewPlayer.Pawn == None)
{
NewPlayer.GotoState('Dead');
if (PlayerController(NewPlayer) != None)
{
PlayerController(NewPlayer).ClientGotoState('Dead', 'Begin');
}
}
else
{
NewPlayer.Pawn.SetAnchor(StartSpot);
if (PlayerController(NewPlayer) != None)
{
PlayerController(NewPlayer).TimeMargin = -0.1;
StartSpot.AnchoredPawn = None;
}
NewPlayer.Pawn.LastStartSpot = PlayerStart(StartSpot);
NewPlayer.Pawn.LastStartTime = WorldInfo.TimeSeconds;
NewPlayer.Possess(NewPlayer.Pawn, false);
NewPlayer.ClientSetRotation(NewPlayer.Pawn.Rotation, true);
SetPlayerDefaults(NewPlayer.Pawn);
if (WorldInfo.GetGameSequence() != None)
{
WorldInfo.GetGameSequence().FindSeqObjectsByClass(class'SeqEvent_PlayerSpawned', true, Events);
for (Idx = 0; Idx < Events.Length; Idx++)
{
SpawnedEvent = SeqEvent_PlayerSpawned(Events[Idx]);
if (SpawnedEvent != None && SpawnedEvent.CheckActivate(NewPlayer,NewPlayer))
{
SpawnedEvent.SpawnPoint = startSpot;
SpawnedEvent.PopulateLinkedVariableValues();
}
}
}
NewPlayer.Pawn.SetCollision(false, false, false);
Vehicle = Spawn(class'TegMobileVehicle_Escort_Content',,, StartSpot.Location, StartSpot.Rotation);
if (Vehicle != None)
{
Vehicle.TryToDrive(NewPlayer.Pawn);
}
}
}
defaultproperties
{
HUDType=class'MobileVehicleHUD'
PlayerControllerClass=class'MobileVehiclePlayerController'
}
MobileCarPawn.uc
Code:
class MobileCarPawn extends TegMobileVehicle_Escort_Content
placeable;
simulated function PostBeginPlay()
{
super.PostBeginPlay();
}
function bool DriverEnter(Pawn P);
function DriverLeft();
function bool FindAutoExit(Pawn ExitingDriver);
function DriverRadiusDamage( float DamageAmount, float DamageRadius, Controller EventInstigator, class<DamageType> DamageType, float Momentum, vector HitLocation, Actor DamageCauser, optional float DamageFalloffExponent=1.f);
simulated function bool DisableVehicle();
simulated function EnableVehicle();
simulated event StartDriving(Vehicle V);
function AdjustDriverDamage(out int Damage, Controller InstigatedBy, Vector HitLocation, out Vector Momentum, class<DamageType> DamageType);
function DriverDied(class<DamageType> DamageType);
function NotifyDriverTakeHit(Controller InstigatedBy, vector HitLocation, int Damage, class<DamageType> DamageType, vector Momentum);
function float GetDamageScaling()
{
return Super(Pawn).GetDamageScaling();
}
function bool Died(Controller Killer, class<DamageType> DamageType, vector HitLocation)
{
return Super(Pawn).Died(Killer, DamageType, HitLocation);
}
function bool AnySeatAvailable()
{
return false;
}
function bool HasOccupiedTurret()
{
return true;
}
simulated function Destroyed()
{
Super(Pawn).Destroyed();
}
function bool IsDriverSeat(Vehicle TestSeatPawn)
{
return true;
}
simulated function SetInputs(float InForward, float InStrafe, float InUp)
{
Throttle = InForward;
Steering = InStrafe;
Rise = InUp;
//ClientMessage("Throttle:"@Throttle@" Steering:"@Steering@" Rise:"@Rise);
}
simulated event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
Super(Pawn).TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
}
simulated function TakeRadiusDamage(Controller InstigatedBy, float BaseDamage, float DamageRadius, class<DamageType> DamageType, float Momentum, vector HurtOrigin, bool bFullDamage, Actor DamageCauser, optional float DamageFalloffExponent=1.f)
{
Super(Pawn).TakeRadiusDamage(InstigatedBy, BaseDamage, DamageRadius, DamageType, Momentum, HurtOrigin, bFullDamage, DamageCauser, DamageFalloffExponent);
}
function PossessedBy(Controller C, bool bVehicleTransition)
{
//ClientMessage("PossessedBy() Controller ="@C);
Driver = self;
SetDriving(true);
Super.PossessedBy(C, bVehicleTransition);
}
simulated event Tick( float DeltaTime )
{
//ClientMessage("CurrentState = "$GetStateName()$", Controller.State = "$Controller.GetStateName());
Super.Tick(DeltaTime);
}
defaultproperties
{
bAttachDriver=false
bDriverIsVisible=false
InventoryManagerClass=class'MobileInventoryManager'
}
MobileInventoryManager.uc
Code:
class MobileInventoryManager extends InventoryManager;
simulated function DiscardInventory()
{
local Vehicle V;
if (Role == ROLE_Authority)
{
Super(InventoryManager).DiscardInventory();
V = Vehicle(Owner);
// HACK to fix ininite loop - Driver will = V for default player pawn!!
if (V != None && V.Driver != None && V.Driver.InvManager != None && V.Driver != V)
{
V.Driver.InvManager.DiscardInventory();
}
}
}
Bot_SpawnPoint.uc
place these where you want the bots to spawn
Code:
//=============================================================================
class Bot_SpawnPoint extends Actor
hidecategories(Lighting,LightColor,Force)
placeable;
var CylinderComponent CylinderComponent;
/** Normal editor sprite */
var const transient SpriteComponent GoodSprite;
/** Used to draw bad collision intersection in editor */
var const transient SpriteComponent BadSprite;
defaultproperties
{
Begin Object Class=SpriteComponent Name=Sprite
Sprite=Texture2D'EditorResources.S_KVehFact'
HiddenGame=true
HiddenEditor=false
AlwaysLoadOnClient=False
AlwaysLoadOnServer=False
End Object
Components.Add(Sprite)
GoodSprite=Sprite
Begin Object Class=SpriteComponent Name=Sprite2
Sprite=Texture2D'EditorResources.Bad'
HiddenGame=true
HiddenEditor=true
AlwaysLoadOnClient=False
AlwaysLoadOnServer=False
Scale=0.25
End Object
Components.Add(Sprite2)
BadSprite=Sprite2
Begin Object Class=ArrowComponent Name=Arrow
ArrowColor=(R=150,G=200,B=255)
ArrowSize=1.5
bTreatAsASprite=True
HiddenGame=true
AlwaysLoadOnClient=False
AlwaysLoadOnServer=False
End Object
Components.Add(Arrow)
Begin Object Class=CylinderComponent Name=CollisionCylinder //LegacyClassName=NavigationPoint_NavigationPointCylinderComponent_Class
CollisionRadius=+0050.000000
CollisionHeight=+0050.000000
End Object
CollisionComponent=CollisionCylinder
CylinderComponent=CollisionCylinder
Components.Add(CollisionCylinder)
bCollideWhenPlacing=true
bCollideActors=false
}
let me know if you cant get it working.
Bookmarks