Announcement

Collapse
No announcement yet.

[Solved] Make NPC's Name Plate?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Solved] Make NPC's Name Plate?

    Hi everyone!


    I have some questions about NPC's name plate like MMO's.


    I want to make Gfx instance and set it by individual NPC's property.


    This is a part of my NPC pawn script.

    Code:
    var() const StaticMeshComponent TagPlate;
    
    var MaterialInstanceConstant NameTagInst;
    
    var TextureRenderTarget2D TagTarget;
    
    var class<GFxMoviePlayer> NPCNameTagClass;
    
    var GFxMoviePlayer TagMovie;
    
    var SwfMovie TagMovieBinder;
    
    event PostBeginPlay(){
    	super.PostBeginPlay();
    
    	NameTagInst = new(none) Class'MaterialInstanceConstant';
    	NameTagInst.SetParent(Material'My_NameTag.Materials.RenderMaterial_A_mat');
    	TagPlate.SetMaterial(0, NameTagInst);
    
    	TagTarget = new(none) Class'TextureRenderTarget2D';
    	NameTagInst.SetTextureParameterValue('RenderTarget2D', TagTarget);
    
    	TagMovie = new(none) NPCNameTagClass;
    	TagMovie.RenderTexture = TagTarget;
    	TagMovie.MovieInfo = TagMovieBinder;
    	TagMovie.RenderTextureMode = RTM_AlphaComposite;
    	TagMovie.SetTimingMode(TM_Real);
    
    	TagMovie.Init(class'Engine'.static.GetEngine().GamePlayers[TagMovie.LocalPlayerOwnerIndex]);
    }
    DefaultProperties
    {
    	begin object class=StaticMeshComponent Name=TagPlateComponent
    		StaticMesh = StaticMesh'My_NameTag.Mesh.Tag_A_SM'
    		Scale = 1.000000
    	end object
    	TagPlate=TagPlateComponent
        Components.Add(TagPlateComponent)
    
    	NPCNameTagClass = class'MyUnrealScript.MyTag_A'
    	TagMovieBinder = SwfMovie'MyScaleform.MyFlash.MyNPCTag'
    
    }
    but In PIE, rendertxture was just white.

    I think the movie didn't play.

    And I used Start() instead TagMovie.Init(), neither it wasn't work.


    How can I fix it?

    Thanks.

    #2
    TagTarget = new(none) Class'TextureRenderTarget2D';

    is not allow.

    and Start() is work.

    Comment

    Working...
    X