<

Load / Save Icons

Load / Save Icons

21 Sep 2024
BP

The user will need to prepare the data icon and apply the update to all affected actors. The explanation below is an example on how the user can load the data and call the appropriate function on the world map.


Setup GameInstance

Definition
How To

All data will be loaded from the game instance and thus the "BP_MapNav_GameInstance" will need to be parented with your own game instance. Skip this if you havent yet created your own game instance.

  • Open the bp "BP_MapNav_GameInstance" from
    Map Navigation > GameInstance
  • Switch it parent class to your own game instance bp.
  • Your game instance set from project setting will be "BP_MapNav_GameInstance" as it should be the lowest child game instance.
  • (optional) If your game instance has an EventInit, go back "BP_MapNav_GameInstance" and add the node Parent Init like below:
  • Test both your own game instance and world map functionality if they are working.

PreLoad level placed Actors

Definition
How To

Actor Preparation

When the game start(level map load), all actors possessing the "BP_WidgetComponentIcon" component automatically execute their BeginPlay event. This event retrieves the actor's icon data from the game instance and assigns a tag "IconTag" to the actor.

Widget World Map

Upon creation, the WBP_WorldMap widget iterates through all actors having the tag "IconTag." Based on the retrieved icon data, the corresponding icon button is loaded and displayed on the world map.

  • Open the bp "BP_WidgetComponentIcon" from
    Map Navigation > UI > WorldMap
  • To determine if additional variables are necessary within the "Icon Map Structure", it's recommended to examine the existing variables since it that structure that going to be save.
  • For example: if the booleans "ShowOnWorldMap", "ShowOnMiniMap" are intended to be save, you can move these to the structure.
  • For any additional variable inside the structure, make the necessary changes inside the BP_WidgetComponentIcon to manage the variables from the IconData.
  • The IconMapStructure can be found from
    Map Navigation > UI > IconMap > Structure

  • Once you have finalised which variables you wish to save for each icon, ensure that both the game instance and the save blueprint are configured correctly.
  • Delete any existing save file to avoid any conflict.
  • The game instance data can be loaded on your title screen level map prior to transitioning to the actual game level map.
  • After everything has been loaded, the main character can be spawned and will load the icons on the world map.
Side Note 1

  • When hitting the play button, the event BeginPlay of a bp order sequence will matter when loading variables.
  • Order Example: Widget Component(from placed actor) begin play will always execute before a Character begin play.
  • Example: If we try to get the variable "WBP_WorldMap" of the main character from an actor's "BP_WidgetComponentIcon" beginplay, it will output null since the begin play of the main character havent yet execute to create the widget world map.

Side Note 2

  • It might be needed to add some check condition during the function timers to prevent any conflict.
  • Especially for the event "LoopLoadCustomMarker" in WBP_WorldMap and WBP_DungeonMap.
  • If the timer function is still running and the user add a new custom marker, this might mess up the index loop.
  • A quick fix will be to use some check boolean to prevent new custom marker or to load them through a loading screen.
  • You can also replace the function timer with a ForEach but this is recommended only if don't have a large amount of icon (or with a limit a custom marker to be made as well)
  • Use the node "StartProfiling" and "EndProfiling" to test the execution time of your ForEach.



Load Spawned Actors

How To
Example

Adding icon to spawn actors.

  • The IconData will be loaded from the event begin of the bp component "BP_WidgetComponentIcon" if the IconID is found from it game instance.
  • Use the event
    AddComponentIcon
    to apply the update on the world map.

How To Save

How To
Example

Use the template save example from the main character "BP_Cobaye". You can use that example to move that implementation to your save manager system.

  • Just press T to save the progress
  • Example: