
Originally Posted by
tegleg
HI.
Am a grad student new to Uscript.
Am trying to spawn a vehicle instead of player.
But am not able to achieve with the code what i have written.
Please help me if i have gone wrong somewhere.
This is my GameInfo class
Code:
class mygameinfo extends UTGame;
var String VechileClass;
var Vehicle yourvehicle;
var PlayerController P;
var vector alteredlocation;
function RestartPlayer( Controller aPlayer)
{
super.RestartPlayer(aPlayer);
startspawning();
}
exec function startspawning()
{
local PlayerController pc;
`log("Spawn Players in Vehicles");
pc.GotoState('PlayerVehicleState');
}
state PlayerVehicleState
{
Begin:
spawnplayersinvehicle();
}
exec function spawnplayersinvehicle()
{
foreach worldInfo.AllControllers(class'PlayerController',P)
{
alteredlocation = P.Pawn.Location;
alteredlocation += vect(100, 100, 100);
SetCollision(false, false);
yourvehicle = Spawn(class 'UTGameContent.UTVehicle_Scorpion_Content',,, alteredlocation, P.Pawn.Rotation);
SetCollision(false, false);
yourvehicle.AttachDriver(P.Pawn);
}
}
simulated event PostBeginPlay()
{
`log("Player restart");
super.PostBeginPlay();
}
DefaultProperties
{
DefaultPawnClass = class'blur.mypawn'
PlayerControllerClass = class'blur.mycontroller'
}
This is my pawn class
Code:
class mypawn extends GamePawn;
simulated function PostBeginPlay()
{
super.PostBeginPlay();
`log("Custom Pawn UP");
}
DefaultProperties
{
}
Controller Class
Code:
class mycontroller extends PlayerController;
simulated function PostBeginPlay()
{
super.PostBeginPlay();
`log("Player Controller Initialized");
}
//state PlayerDriving
//{
//Ignores SeePlayer, HearNoise, Bump;
// function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot);
// function ProcessDrive(float InForward, float InStrafe, float InUp, bool InJump)
// {
// local myvechile CurrentVechile;
// CurrentVechile=myvechile(pawn);
// if(CurrentVechile != none)
// {
// bpressedJump = InJump;
// CurrentVechile.SetInputs(InForward, -InStrafe, InUp);
// CheckJumpOrDuck();
// }
// }
// function PlayerMove(float DeltaTime)
// {
// UpdateRotation(DeltaTime);
// ProcessDrive(PlayerInput.RawJoyUp, PlayerInput.RawJoyRight, PlayerInput.aUp, bPressedJump);
// if(Role < ROLE_Authority)
// {
// ServerDrive(PlayerInput.RawJoyUp, PlayerInput.RawJoyRight, PlayerInput.aUp, bPressedJump, ((Rotation.Yaw & 65535) << 16) + (Rotation.Pitch & 65535));
// }
// bPressedJump = false;
// }
// event BeginState(Name PreviousStateName)
// {
// cleanOutSavedMoves();
// }
// event EndState(Name NextStateName)
// {
// CleanOutSavedMoves();
// }
//}
DefaultProperties
{
//PawnClass=Class'blurring.mypawn'
}
Bookmarks