Update Pawn - BP_BaseShip

Kyle Austad 2024-10-07 11:26:53 -06:00
parent 05c92a7b47
commit 34ca45ed50

@ -14,6 +14,9 @@ The first thing to do on your new pawn is to go to the *Class Settings* in its b
Next you need to add a slew of variables to your pawn. They are categorized on the include *BP_BaseShip* and you can refer to that for reference. If you have your own movement system implemented you don't need all of the *Movement* variables and if you already have a zoom system for your camera or don't want it you don't have to transfer that logic. The below table shows every variable, its type and it is organized by category. If you have your own movement system on your pawn skip the *Movement* category. Next you need to add a slew of variables to your pawn. They are categorized on the include *BP_BaseShip* and you can refer to that for reference. If you have your own movement system implemented you don't need all of the *Movement* variables and if you already have a zoom system for your camera or don't want it you don't have to transfer that logic. The below table shows every variable, its type and it is organized by category. If you have your own movement system on your pawn skip the *Movement* category.
NOTE: You can simply Ctrl-C and copy the variables from *BP_BaseShip* and Ctrl-V to paste them on your own pawn, making the process faster.
Also note: the function *UpdateMovementVariables* is needed even if you are using your own movement system. It updates the movement stats of your pawn regardless. Its current implementation sets the applicable movement variables on the *FloatingPawnMovement* actor component. If you are using your own movement component you will need to look at this function and change which variables are set by this function to fit your movement component. If you are using a *FloatingPawnMovement* component just make sure the reference to your component is valid in this function on your new pawn.
#### Movement Variables #### Movement Variables
@ -56,3 +59,26 @@ Next you need to add a slew of variables to your pawn. They are categorized on t
| ------------- | ------------- | ------------- | | ------------- | ------------- | ------------- |
| AttachedActorsAndSockets | Map of Actor(object_ref):Names | none | | AttachedActorsAndSockets | Map of Actor(object_ref):Names | none |
| MasterShipInfo | Struct - S_MasterShipInfo | (only need to config *EngineInfo* and *EngineShopInfo*) | | MasterShipInfo | Struct - S_MasterShipInfo | (only need to config *EngineInfo* and *EngineShopInfo*) |
Once you have all the variables in your own pawn head over to the functions on *BP_BaseShip* and copy all the functions there to your new pawn. You can simply right click the function name or select it and Ctrl-C to copy it and paste it on your new pawn.
![](https://git.crabinteractive.com/crabdev/MSSS-Documentation/raw/branch/main/Images/BP_BaseShip/2.png)
Once those 5 functions have been copied, repeat the process for the 1 macro on *BP_BaseShip* called *SetUseControlRotation*
Last thing to copy over is the 3 Event Dispatchers.
On your new pawn create a new *Event Dispatcher*. One called *OnFinishedDocking*, one called *OnPlayerMoneyChanged* (if using the included currency system), and the last one called *OnShipInfoChanged*.
Click on *OnPlayerMoneyChanged* and in the *Details* on the right click the plus icon to add a parameter. It should be a *Float* and called *NewPlayerMoney*.
![](https://git.crabinteractive.com/crabdev/MSSS-Documentation/raw/branch/main/Images/BP_BaseShip/3.png)
On the *OnShipInfoChanged* dispatcher add 2 inputs. One called *BaseShipInfo* of type *Struct - S_BaseShipInformation*, and one called *MasterShipInfo* of type *Struct - S_MasterShipInfo*.
Once all of that is done head over to the *Event Graph* of *BP_BaseShip* and select and copy all the nodes on the main graph. If you don't need the movement system or simple zoom only select the graphs on the right of the event graph. Refer to the comments to find the movement graphs to leave behind. Either way, select the graphs needed on the right half at least and copy and paste them onto the event graph of your new pawn.
Once all of that is copied over there will most likely be some errors. If you moved over the movement logic there will be errors related to specific component references. The simple zoom functionality uses references to the *Camera* and *Spring Arm* so replace those with the applicable components on your new pawn if necessary. Any references to *Capsule* in the movement logic is the root component of your pawn so replace those references if needed with a reference to the root component of your new pawn. After that is done the last error will be about a timeline in the collapsed graphs for docking and undocking. *Undock Alpha* is the output of a *Float Track* in the timeline node used to time undocking. Sometimes *timeline* nodes don't copy and paste correctly so if any remaining errors are related to *Timeline* nodes simply find that timeline node in the *BP_BaseShip* and manually copy and paste it onto the correct spot in your new pawn and replace the one throwing errors.
Now you should have a working pawn that will work flawlessly with all the systems in the stat system!