Modules
1.1.0.5
Flowgraph Plugin System
Quick Links:
About
Creating a Module
Saving a Module
Calling a Module from Flowgraph
A Module is an exported Flowgraph that can be loaded and called from another Flowgraph at any point during the game session. Any Flowgraph can be converted to a Module simply by exporting the Flowgraph to its
Xml format using the "Save" option in the Flowgraph Editor.
The advantages of using Modules in your Mod:
-
Same Flowgraph can be used in multiple levels, but only exist in one location.
-
Modules can receive unique input values from their caller, allowing them to be very robust.
-
Modules can return unique output values to their callers, allowing them to be used in many different situations.
A Module is just a special flavor of a Flowgraph. This means ANY Flowgraph can become a Module with a few simple modifications made to it. So pick your favorite Flowgraph that you want to turn into a Module, or create a simple one to work with.
The first thing you will need to do is place a Module:Start Node. This acts as the starting point for your Module when it is called. It also carries over any input sent from the Caller Node. (More on this later.)
Module:Start Node
Outputs:
-
Start - Called when Module is loaded. Treat this like you would the Misc:Start Node.
-
Entity - EntityId assigned to the Module as its Graph Entity. This is your your own reference; any Node that is either set to use the Graph Entity or not assigned an Entity will automatically use this.
-
Param1 - Additional parameter data passed from the Caller Node.
-
Param2 - Additional parameter data passed from the Caller Node.
-
Param3 - Additional parameter data passed from the Caller Node.
-
Param4 - Additional parameter data passed from the Caller Node.
-
Param5 - Additional parameter data passed from the Caller Node.
-
Param6 - Additional parameter data passed from the Caller Node.
After you have placed the Starting point, you may want to place an Ending point by using the Module:Return Node. Note that this set is not required. When a Module returns, it is unloaded and stops executing. If you want your Module to always remain executing while the level is being played, then don't return from it! Returning from a Module does allow you to pass optional data back to the Caller.
Module:Return Node
Inputs:
-
End - Call to return from the Module with a Success status.
-
Cancel - Call to return from the Module with a Fail status.
-
Param1 - Additional parameter data passed back to the Caller Node.
-
Param2 - Additional parameter data passed back to the Caller Node.
-
Param3 - Additional parameter data passed back to the Caller Node.
-
Param4 - Additional parameter data passed back to the Caller Node.
-
Param5 - Additional parameter data passed back to the Caller Node.
-
Param6 - Additional parameter data passed back to the Caller Node.
To save your Flowgraph so that it can be used as a Module, all you need to do is bring up your Flowgraph in the Flowgraph Editor, and select
Save from the File Menu. There are multiple locations where you should save the Flowgraph, depending on how you want to use it in your Mod:
Where MYMOD is your Mod Folder...
-
MYMOD/Modules/
-
This is your Global Modules folder. Save your Module here if you want to use it in multiple levels for your Mod.
-
MYMOD/Game/Level/MyLevel/Modules/
-
This is your Level Modules folder. Every Level can have their own Modules folder. Save your Module here if you want to use it only in one particular level.
When loading a Module, the system will first check the current level's Modules folder. If the Module is not found there, it will then look in the Global Modules folder. This gives you the potential to overwrite a Global Module with a Level-Specific Module if you wish.
So now we have this Module ready to be used in our level. To call the Module, all we need to do is use the
Module:Call Node.
Module:Call Node
Inputs:
-
Call - Call to load the Module and begin its execution.
-
Module - Name of the Module to call. This should match the name of the Xml file you saved in the previous step. You do not have to include the ".xml" part.
-
Entity - EntityId that should be this Module's Graph Entity.
-
Param1 - Additional parameter data to pass to the Module's Start nodes.
-
Param2 - Additional parameter data to pass to the Module's Start nodes.
-
Param3 - Additional parameter data to pass to the Module's Start nodes.
-
Param4 - Additional parameter data to pass to the Module's Start nodes.
-
Param5 - Additional parameter data to pass to the Module's Start nodes.
-
Param6 - Additional parameter data to pass to the Module's Start nodes.
Outputs:
-
Called - Called when the Module is fully loaded and has started executing. Returns True if successful, False if failed to load.
-
Done - Called when the Module returns with a Success status.
-
Canceled - Called when the Module returns with a Fail status.
-
Param1 - Additional parameter data passed back from the Module when it returned.
-
Param2 - Additional parameter data passed back from the Module when it returned.
-
Param3 - Additional parameter data passed back from the Module when it returned.
-
Param4 - Additional parameter data passed back from the Module when it returned.
-
Param5 - Additional parameter data passed back from the Module when it returned.
-
Param6 - Additional parameter data passed back from the Module when it returned.