Shop_Upgrades
Now that we have the new Weapon Aspect ready, we no longer want to overwrite an existing aspect. To add our aspect as a seperate aspect into the game, we will need it into the Weapon Shop and upgrade menus
Adding the Aspect ShopData
We will need to enter our Aspect into the WeaponShop table which is located in WeaponShopItemData.
We will use OverwriteTableKeys to insert our new entry as we need both a key and a value and table.insert cannot enter new keys.
At this stage it is important to name our aspect in a unique name that is unlikely to be used by other modders.
Base-game WeaponShop data can be found in Scripts/WeaponShopData.lua
Below is an example of an Aspect WeaponShop entry and its rank 2 upgrade.
-- Staff Aspect of young Mel
OverwriteTableKeys(WeaponShopItemData, {
StaffAspectofYoungMelinoe = {
WeaponName = "WeaponStaffSwing",
HideAfterPurchased = true,
IconScale = 0.8,
UnlockTextId = "WeaponShopAspectUnlock",
Cost =
{
PlantIShaderot = 5,
},
GameStateRequirements =
{
{
PathTrue = { "GameState", "WorldUpgrades", "WorldUpgradeWeaponUpgradeSystem" },
},
},
PreRevealVoiceLines =
{
TriggerCooldowns = { "MelinoeMiscWeaponEquipSpeech" },
{
BreakIfPlayed = true,
PreLineWait = 0.65,
ObjectType = "NPC_Skelly_01",
TriggerCooldowns = { "SkellyAnyQuipSpeech" },
{ Cue = "/VO/Skelly_0350", Text = "A witch most-powerful!" },
}
}
},
StaffAspectofYoungMelinoe2 =
{
WeaponName = "WeaponStaffSwing",
IconScale = 0.8,
Graphic = "WeaponArt05",
TraitUpgrade = "StaffAspectofYoungMelinoe",
InheritFrom = { "BaseWeaponUpgrade", },
Cost =
{
WeaponPointsRare = 1,
},
GameStateRequirements =
{
{
PathTrue = { "GameState", "WeaponsUnlocked", "StaffAspectofYoungMelinoe" }
},
},
PreRevealGlobalVoiceLines = "StaffAspectUpgradedVoiceLines",
},
})
HideAfterPurchased - A boolean that determines whether the item will remain in the shop after purchased. In base game this is true only for the rank 5 aspect.
Cost - How many rescources are needed to purchase the item. Resources like PlantIShaderoot are often named by their category: "Plant", "Ore" then the region letter "F" - Erebus, "G" - Oceanus... and ending with the resource name.
Note in basegame aspect rank 2-4 cost 1 WeaponPointsRare or its ingame name Nightmare, and rank 5 cost 2.
``
Adding the Aspect ShopData to the Weapon Shop
After we made our entry for the Weapon shop we will need to insert it into the game so it could be viewed in the weapon shop.
The data for the shop is located in ScreenData.WeaponShop. The shop is seperated into ItemCategories, one for each weapon and an additional one for the Gathering tools.
Staff = 2
Dagger = 3
Torch = 4
Axe = 5
Skull = 6
Suit = 7
To insert our aspect for purchase we need to add the weaponshop entry for the base aspect and all of its upgrades into ItemCategories as seen below.
table.insert( ScreenData.WeaponShop.ItemCategories[2], "StaffAspectofYoungMelinoe")
table.insert( ScreenData.WeaponShop.ItemCategories[2], "StaffAspectofYoungMelinoe2")
Adding the Aspect to the Aspect selection menu
Finally we need to add the aspect we purchased into the aspect selection menu. This is found in ScreenData.WeaponUpgradeScreen.DisplayOrder with each weapon having its own list. The weapon names are the same as found in the aspect object.
In the example below we add the new StaffAspectofYoungMelinoe into the staff aspect selection list. The 2 is optional and tells the game to add our new aspect into the 2nd place in the list, pushing all other entries down the order.
table.insert( ScreenData.WeaponUpgradeScreen.DisplayOrder.WeaponStaffSwing, 2 , "StaffAspectofYoungMelinoe" )