• Create Account

Banner advertising on our site currently available from just \$5!

### #Actualratrace135

Posted 03 March 2013 - 08:39 PM

Back again

In the MagpiePawn code, get rid of the NPCController variable and simply use ControllerClass (the var defined in the Pawn class). If you want your current code to work, you'll have to add in the MagpiePawn's PostBeginPlay(), the line:

ControllerClass = NPCController;


BUT, the only reason you'd have the NPCController variable in the first place is if you wanted it to be editable from in-editor, by declaring it like

var() class<AIController> NPCController;


Also, just a little tip, instead of using 'log("string"), you can use WorldInfo.Game.Broadcast( self, "String"), which will display the string in-game (usually more convenient).

So code should look something like this:

class MagpiePawn extends UTPawn placeable;

var StaticMeshComponent MyMesh;
//var(NPC) SkeletalMeshComponent NPCMesh;

simulated function PostBeginPlay()
{
super.PostBeginPlay();
SetMeshVisibility(true);
WorldInfo.Game.Broadcast( self, "The magpie pawn has spawned!" ); //this appears fine, and I believe the pawn works okay
}

defaultproperties
{
bBlockActors=True
bCollideActors=True
ControllerClass=class'MagpieController'    //<- Notice we're using ControllerClass

Begin Object Class=DynamicLightEnvironmentComponent Name=MagpieLightEnvironment
bEnabled=TRUE
End Object

Begin Object Class=StaticMeshComponent Name=MagpieMesh
StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
Materials(0)=Material'EditorMaterials.WidgetMaterial_X'
LightEnvironment=MagpieLightEnvironment
Scale3D=(X=0.25,Y=0.25,Z=0.5)
End Object
MyMesh=MagpieMesh
}


### #1ratrace135

Posted 03 March 2013 - 08:38 PM

Back again

In the MagpiePawn code, get rid of the NPCController variable and simply use ControllerClass (the var defined in the Pawn class). If you want your current code to work, you'll have to add in the MagpiePawn's PostBeginPlay(), the line:

ControllerClass = NPCController;


BUT, the only reason you'd have the NPCController variable in the first place is if you wanted it to be editable from in-editor, by declaring it like

var() class<AIController> NPCController;


Also, just a little tip, instead of using 'log("string"), you can use WorldInfo.Game.Broadcast( self, "String"), which will display the string in-game (usually more convenient).

So code should look something like this:

class MagpiePawn extends UTPawn placeable;

var StaticMeshComponent MyMesh;
//var(NPC) SkeletalMeshComponent NPCMesh;

simulated function PostBeginPlay()
{
super.PostBeginPlay();
SetMeshVisibility(true);
WorldInfo.Game.Broadcast( self, "The magpie pawn has spawned!" ); //this appears fine, and I believe the pawn works okay
}

defaultproperties
{
bBlockActors=True
bCollideActors=True
ControllerClass=class'MagpieController'

Begin Object Class=DynamicLightEnvironmentComponent Name=MagpieLightEnvironment
bEnabled=TRUE
End Object