Game Development Reference
In-Depth Information
/** called from UTPawn, spawns the default controller */
Now we need to do some work in our player controller class, in our case,
TutorialPlayerController class. Let's add the variable array that we'll
use to store the number of companions we want to spawn as shown in the
following code snippet:
/** Array used for setting the number of spawned companions
var Pawn Companions[3];
Let's create a function in our TutorialPlayerController class to spawn
these companions as shown in the following code:
* Spawns companion pawns
function PlayerSpawned(NavigationPoint StartLocation)
Companions[0] = Spawn(Class'TutorialPawn',,,
StartLocation.Location - vect(75,100,0),
Companions[1] = Spawn(Class'TutorialPawn',,,
StartLocation.Location - vect(150,120,0),
Companions[2] = Spawn(Class'TutorialPawn',,,
StartLocation.Location - vect(200,280,0),
The fist parameter requires a class, so we're using our TutorialPawn class
as the pawn we want to spawn, and then we're setting the spawn location.
StartLocation.Location is where our pawn spawns, so we're offsetting
each of our companions by a bit, and then matching their rotation with ours,
so that we're all facing the same way upon spawning.
Search Nedrilad ::

Custom Search