CampaignNodeTypeBuilder - rspforhp/WildfrostModdingDocumentation GitHub Wiki
CampaignNodeTypeBuilder
CampaignNodeTypeBuilder(WildfrostMod mod)
- The builder for creating CampaignNodeType data.
- CampaignNodeType is the template to which the map nodes are made. They establish what the node looks like, the data it pulls, and how the player interacts with them. Common examples are battle nodes, shop nodes, treasure nodes, etc.
- Many CampaignNodeType classes that open the Event scene are paired with a corresponding EventRoutine.
- CampaignNodeType's implement the following methods:
SetUp: determines the data to be obtained for the map node (battle for battle nodes, cards/charms for shop nodes).Run: executes when the player clicks on the corresponding map node. Usually, this takes the player to the Event or Battle scene.HasMissingData: determines whether there is missing data for the node. If so, the run cannot be continued.
- A list of CampaignNodeTypes may be found in the References.
Example
See Tutorial 7.
Methods
[!Note] Some methods inherited from DataFileBuilder are not shown. They can be found on the Builders page.
Create (Inherited from DataFileBuilder)
Create(string name) or Create<T>(string name) where T is a class that inherits from CampaignNodeType
- Used to create a campaign node type.
nameis the internal name for your status effect.Tis a class that inherits from CampaignNodeType (e.g. CampaignNodeTypeBattle)
FreeModify (Inherited from DataFileBuilder)
FreeModify<T>(Action<T> action)whereTis a class that inherits from CampaignNodeType- The DataFileBuilder is wrapped around the DataFile instance you are editing. This method allows you to edit the data directly. If you need to reference modded data that have to be loaded in (e.g. CardData, StatusEffectData), use
SubscribeToAfterAllBuildEventinstead. Tideally should match the identically match theTfromCreate<T>.- As each CampaignNodeType class is only used once, use of this method is rare, but still possible.
SubscribeToAfterAllBuildEvent
SubscribeToAfterAllBuildEvent(AfterBuildDelegate d)
- Similar to
FreeModify<T>with two notable difference.- The execution action
dis delayed. When it executes, DataFiles from your mod can be referenced usingGet / TryGet. Tis absent from this method, so the argument passed intodis assumed to be of the class CampaignNodeType. Use casting if you need the particular derived class of CampaignNodeType.
- The execution action
dis an action (void method) that takes in a CampaignNodeType argument.
WithCanEnter
WithCanEnter(bool canEnter)
- All non-cosmetic map nodes can be entered; all cosmetic map nodes cannot be entered.
- Nodes that cannot be entered are automatically cleared.
canEnterdetermines whether the node can be entered or not.- Default is false.
WithCanLink
WithCanLink(bool canLink)
- Linked nodes occur if the following conditions are met:
- There are two paths, and both paths each contain the same node type.
- And the shared node type can be linked.
- Linked nodes will hold the same data (ie, treasure chests on different paths will contain the same cards).
- Aside from battles and the injured companion event, all interactable nodes can be linked.
canLinkdetermines whether or not the node can be linked.- Default is false.
WithCanSkip
WithCanSkip(bool canSkip)
- Determines whether the adjacent nodes are accessible while the current one is not cleared.
- Both
WithCanSkipandWithMustClearmust agree (true for former, false for latter) for the node to be skippable. - Most visual effects tied to skipping are influenced by this method.
canSkipdetermines whether or not the node can be skipped.- Default is false.
WithFinalNode
WithFinalNode(bool finalNode)
- [Battles only] Determines whether the run ends in a win if the node is cleared.
- The CampaignNode class copies this value, so it is possible to change the final node mid-run (See the SecretFinalBossSystem class).
finalNodedetermines whether or not the node is a final node.- Default is false.
WithInteractable
WithInteractable(bool interactable)
- Interactable nodes are nodes that can be moved to.
- All non-cosmetic map nodes can be entered; all cosmetic map nodes cannot be entered.
interactabledetermines whether the node can be entered or not.- Default is false.
WithIsBattle
WithIsBattle(bool isBattle)
- Determines if the node type corresponds to a battle.
- Setting
isBattleto true means that the node will automatically be given wave data from random battle from the current tier. - Default is false.
WithIsBoss
WithIsBoss(bool isBoss)
- Determines if the node type corresponds to a boss.
- Setting
isBossto true affects miscellaneous systems, such as the drain bell. - Default is false.
WithLetter
WithLetter(string letter)
- A node type's letter is a string that uniquely identifies that node type.
- This method is only useful if you plan on manually editing the run preset via
Events.CampaignLoadPreset. - If so,
lettermust be a unique 1-character string. - The run presets and the letters of other nodes can be found in References for used letters and run presets).
WithMapNodePrefab
WithMapNodePrefab(MapNode mapNodePrefab)
- Determines the Unity object to pull when making a map node of this type.
mapNodePrefabis the MapNode component atached to the Unity object you want to clone.- It is recommended to clone another node's prefab.
- These prefabs typically have a LocalizeStringEvent on its "label" object. Edit the localized string to change the hover text.
- The exceptions to the above are battle nodes. They display the title of the battle that is stored in them.
- Charms, Shops, and Companion nodes store their sprites in the arrays
spriteOptionsandclearedSpriteOptions. Their sprites are randomly chosen based on these options. - Treasures and Battles use a SpriteSetter component to determine what sprites to use. It is possible to make your own SpriteSetter class.
WithMapNodeSprite
WithMapNodeSprite(string mapNodeSprite) or WithMapNodeSprite(Sprite mapNodeSprite)
- Only used in the Icebreaker Hut, as the sprite shown if this "node" is unlocked here.
- This doesn't determine the sprite of the node on the map.
WithModifierReward [Depreciated]
WithModifierReward(bool modifierRewards)
- This variable is depreciated, and the
hasRewardsvariable in the CampaignNodeTypeBattle class serves a similar purpose now. - Default is false.
WithMustClear
WithMustClear(bool mustClear)
- Having
WithCanSkipto true andWithMustClearto false will allow the node to be skipped. mustCleardetermines whether or not the node must be cleared.- Default is false.
WithSize
WithSize(bool size = 1f)
- Determines the size of the node.
- Even without calling the method, the default
sizeis 1.
WithStartRevealed
WithStartRevealed(bool startRevealed)
- Determines if the node appears from the beginning.
- The SNowdwell node and other cosmetic nodes start revealed; non-cosmetic nodes set
startRevealedto false. - Default is false.
WithZoneName
WithZoneName(string zoneName)
- Determines the name of the CampaignNode.
zoneNameis the name given to the CampaignNode that uses this node type.- Default is "Salty Spicelands".
- The zone name is not seen anywhere (except possibly the new area banner nodes).
- Can be used to check node types.