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.
  • name is the internal name for your status effect.
  • T is a class that inherits from CampaignNodeType (e.g. CampaignNodeTypeBattle)

FreeModify (Inherited from DataFileBuilder)

  • FreeModify<T>(Action<T> action) where T is 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 SubscribeToAfterAllBuildEvent instead.
  • T ideally should match the identically match the T from Create<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 d is delayed. When it executes, DataFiles from your mod can be referenced using Get / TryGet.
    • T is absent from this method, so the argument passed into d is assumed to be of the class CampaignNodeType. Use casting if you need the particular derived class of CampaignNodeType.
  • d is 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.
  • canEnter determines 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.
  • canLink determines 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 WithCanSkip and WithMustClear must agree (true for former, false for latter) for the node to be skippable.
  • Most visual effects tied to skipping are influenced by this method.
  • canSkip determines 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).
  • finalNode determines 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.
  • interactable determines 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 isBattle to 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 isBoss to 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, letter must 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.
  • mapNodePrefab is 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 spriteOptions and clearedSpriteOptions. 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 hasRewards variable in the CampaignNodeTypeBattle class serves a similar purpose now.
  • Default is false.

WithMustClear

WithMustClear(bool mustClear)

  • Having WithCanSkip to true and WithMustClear to false will allow the node to be skipped.
  • mustClear determines 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 size is 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 startRevealed to false.
  • Default is false.

WithZoneName

WithZoneName(string zoneName)

  • Determines the name of the CampaignNode.
  • zoneName is 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.