Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualratrace135

Posted 03 March 2013 - 08:39 PM

Back again tongue.png

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
    WorldInfo.Game.Broadcast( self, self );
}

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

  Begin Object Class=DynamicLightEnvironmentComponent Name=MagpieLightEnvironment
  bEnabled=TRUE
  End Object
  Components.Add(MagpieLightEnvironment)

  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
  Components.Add(MagpieMesh)
  MyMesh=MagpieMesh
}

#1ratrace135

Posted 03 March 2013 - 08:38 PM

Back again :P

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
    WorldInfo.Game.Broadcast( self, self );
}

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

  Begin Object Class=DynamicLightEnvironmentComponent Name=MagpieLightEnvironment
  bEnabled=TRUE
  End Object
  Components.Add(MagpieLightEnvironment)

  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
  Components.Add(MagpieMesh)
  MyMesh=MagpieMesh
}

PARTNERS