Reference to Actor
I created two progres bars. One for PiratShip and second for EnemyShip. PiratShip is C++ code GameMode and progress bar in blueprint working very good - this is my blueprint: ![alt text]
But i have problem with second EnemyShip blueprint. Enemy ship is C++ code Actor and progress bar for this one do not work ( no matter what i past as a object) This is my blueprint for EnemyShip - progress bar: ![alt text]
I have no idea what i should connect as an object. Could you help me please ? : /storage/temp/119133-piratship_bp.jpg : /storage/temp/119134-enemyship_bp.jpg
asked Dec 17 '16 at 07:10 PM in Blueprint Scripting
You need to pass an instance to your EnemyShip actor that is spawned in the world as a parameter to "Cast To EnemyShip" . Or you can update your EnemyShip Actor so it stores a copy of it's Current and Starting Hull Durability in the GameState and replicate that to each GameState on the client. That way each client UMG widget can get an instance of the GameState and grab the information it needs.
Where is GetYourShipHullProgressBarPercent called from, the blueprint UMG (hud) Widgets?
Are you treating your GameMode like an actor itself where you can actually damage it and destroy it?
I would advise against getting the CurrentHullDurability and MaxHullDurability from the game mode directly. GameMode is only ever going to be available (non-NULL) on the Authority server. This means when you try to play multiplayer you will have issues because your client machines will not have a GameMode returned to them, instead they will be given NULL. Store that information in the Authority's version of GameState or PlayerController and replicate it to each client as a variable.
answered Dec 17 '16 at 08:16 PM
Thank you for your help and sugestions. I gonna try to move it to GameState and I will se how it works.
answered Dec 19 '16 at 01:06 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here