Adding Ancients - Alchyr/ModTemplate-StS2 GitHub Wiki
This guide is for adding new Ancients to the game.
Adding an Ancient requires:
- a
CustomAncientModelclass for your ancient, providing asset file paths and the relic pool - corresponding localization
- a scene for the background of the ancient event
- an icon for run history and dialogues
- a map icon with an outline
The ancient needs at least three relics with the RelicRarity.Ancient rarity, added to the EventRelicPool pool. Here is the Baselib wiki page for CustomRelic.
First up, create the class file of your new ancient. It can be within any folder of the project, you can organize your files how you like it.
Then, make your new class extend BaseLib's CustomAncientModel. Doing this will show errors for missing information that we will add shortly. It should look like this:
public class TestAncient : CustomAncientModel
{
}This will determine what relics your ancient offers.
Override MakeOptionPools in your ancient class and provide an option pool like so:
protected override OptionPools MakeOptionPools => new OptionPools(
[
AncientOption<Nunchaku>(),
AncientOption<Lantern>(),
AncientOption<ArtOfWar>()
//more relic options
]
);Three options from that pool will be selected randomly to be offered by your ancient.
You can also optionally make multiple pools by providing up to 3 arrays to the OptionPools constructor. If 2 pools are provided, 2 options will be selected from the first pool and one from the second. If 3 pools are provided, each option will be selected from a different pool. Base game ancients typically either have one big pool (Nonupeipe, Tanx) or three separate pools (Tezcatara, Orobas, Pael, Vakuu). Darv has two pools, one with all his relics and one with only Dusty Tome (with logic to only offer it half the time).
To change which act your ancient can spawn, override the IsValidForAct method (this example makes it spawn only in act 2):
public override bool IsValidForAct(ActModel act)
{
return act.ActNumber() == 2;
}First, create the ancients.json file. It must be in the right folder : [YourModName]/localization/eng(changing eng to whatever language you're writing localization in). Create those folders if needed.
We can now add localization for our ancient. Go back to your ancient class file, and right click > Show context actions > Generate localization > any of the three options
Cut the generated text and paste it into ancients.json, between the brackets, and save the file. This should clear the error shown in the class file. If it doesn't, check the names and location of the folders.
The generated localization will add the minimal amount of text to your ancient: name, epithet, first dialogue (one line), and generic repeatable dialogue (one line). To add more, check on the BaseLib wiki.
For all these assets, it may be helpful to use GDRE Tools to extract base game assets so you can see how the base game ancients work.
The map icon is a 278x278 image. It has to be accompanied by a separate outline image of the same size (similarly to relics). The default name and location is images/packed/map/ancients/ancient_node_[modID]-[ancientclassname].png and ancient_node_[modID]-[ancientclassname]_outline.png (all lowercase).
You can also provide another path using the CustomMapIconPath and CustomMapIconOutlinePath properties in your ancient's class.
This icon will be used in the run history as well as in dialogues.
It's a 88x88 image, and also has to have a separate outline image.
The default name and location is images/ui/run_history/[modID]-[ancientclassname].png and [modID]-[ancientclassname]_outline.png (all lowercase).
You can also provide another path using the CustomRunHistoryIconPath and CustomRunHistoryIconOutlinePath properties in your ancient's class.
You will need to make a Godot scene to be used as a background for your ancient. Typically it will only contain a background image (and this guide will only cover that), but Godot scenes also allow adding effects, particles and animations.
Open Godot or Megadot, and open the project.godot file from your mod's folder. You should now be able to open your mod as a Godot project.
Create a new 2d scene that will serve as the background of your ancient's event. The default path and name is scenes/events/background_scenes/[modID]-[ancientclassname].tscn (all lowercase). You can also override the CustomScenePath property in your ancient's class to provide another path.
Change the root node into a control node, and rename it to just your ancient's name.
Add a child node to the root node, with the TextureRect type.
Add your chosen image to your mod's files (base game images are 2560x1200), and select the image as the child node's texture.
To align the texture properly, go to Project > Project Settings > Display > Window and change viewport width and height to 1920 and 1080 respectively. This will change the blue rectangle representing the game's window in your scene to be the size the game expects. You can then center the image by dragging it.
Save the scene, and you're done! With everything in this guide done, your ancient should be able to spawn and work properly.