Phoenix Point
0 of 0

File information

Last updated

Original upload

Created by

Dtony

Uploaded by

dt123

Virus scan

Safe to use

Tags for this mod

About this mod

make C# mods (.dll) tutorial

Permissions and credits
Donations
this is rough draft will update in more detail later, stay tuned for extra tutorials. This Tutorial assumes you read sheepys tutorial on setting up a DLL mod project. if you do not know how to setup a project please read this https://github.com/Sheep-y/Modnix/wiki/DLL-Mod-Quick-Start 

Click Here For Beginner Basic Stat Modification Tutorial

Adding Abilities to armor:


For this tutorial we will be adding dash to the agile legs keep in mind for coding purposes we will use names the game code uses for items/weapons/armor/abilities we will call this the Real name. the agile legs Real name is  AN_Berserker_Shooter_Legs_ItemDef and dash Real name is Dash_AbilityDef. you can find all names using Dump Data or click here for Real names of abilities, weapons, and armor.

first step is to make sure to add reference UnityEngine.CoreModule and the other references listed in sheepys tutorial.
Below should be your starting code.

using System;
using Harmony;
using System.Linq;
using Base.Defs;
using PhoenixPoint.Tactical.Entities.Equipments;
using PhoenixPoint.Tactical.Entities.Abilities;
using PhoenixPoint.Common.Entities.Items;
using Base.Core;
using Base.Entities.Abilities;

namespace OP_Armor_Abilities
{
    public static class MyMod
    {
        public static void HomeMod(Func<string, object, object> api = null)
        {
            HarmonyInstance.Create("your.mod.id").PatchAll();
            api?.Invoke("log verbose", "Mod Initialised.");

            DefRepository Repo = GameUtl.GameComponent<DefRepository>();
       
            };      
        }

        public static void MainMod(Func<string, object, object> api)
        {
            HarmonyInstance.Create("your.mod.id").PatchAll();
            api("log verbose", "Mod Initialised.");
        }
    }
}


inside your main method (i.e HomeMod or MainMod) after this line of code DefRepository Repo = GameUtl.GameComponent<DefRepository>();
we will add our code.

first let define agile legs.  the blueprint for defining things should look like this.

Type CustomName = Repo.GetAllDefs<Type>().FirstOrDefault(a => a.name.Equals("Real name of weapon/armor/ability "));

to define agile legs we need to declare its type (TacticalItemDef) give it a custom name and then enter the Real name of armor/weapon/ability inside the quotation marks(in this case AN_Berserker_Shooter_Legs_ItemDef )

the Type of any weapon is called WeaponDef, the Type for any armor is called TacticalItemDef  and for tutorial purposes the type of any ability is called AbilityDef

we know the agile legs is of type TacticalItemDef since its armor, right after we declare a Type we give a name to what we are defining to what we are defining, we can name it anything so lets name it agileLegs. the last step to define something is entering its name real name   i.e AN_Berserker_Shooter_Legs_ItemDef inside the quotation marks

with all that in mind the code should look like this.

TacticalItemDef agileLegs = Repo.GetAllDefs<TacticalItemDef>().FirstOrDefault(a => a.name.Equals("AN_Berserker_Shooter_Legs_ItemDef "));

do not worry about anything in between the blueprint for defining things, only important things are the Type Custom Name and Real Name. now that we defined agile legs the next step is to give it the dash ability.

the blue print for adding new abilities should look like this

         CustomName.Abilities = new AbilityDef[]
           {
                 Repo.GetAllDefs<AbilityDef>().FirstOrDefault(a => a.name.Equals("Real name of ability")),
            };

for adding two abilities just add another line of this Repo.GetAllDefs<AbilityDef>().FirstOrDefault(a => a.name.Equals("Real name of ability")),
like this

CustomName.Abilities = new AbilityDef[]
            {
            Repo.GetAllDefs<AbilityDef>().FirstOrDefault(a => a.name.Equals("Real name of ability")),
            Repo.GetAllDefs<AbilityDef>().FirstOrDefault(a => a.name.Equals("Real name of ability")),
            };

now lets enter the variables. the custom name should be agileLegs because thats the name we gave it when we defined it. The Real name of ability is Dash_AbilityDef. the code should look like this

agileLegs.Abilities = new AbilityDef[]
    {
            Repo.GetAllDefs<AbilityDef>().FirstOrDefault(a => a.name.Equals("Dash_AbilityDef")),
            };

keep in mind this will overwrite all the armors current abilities so if you want to include its default abilities (agile legs can jump one floor up) you will need to add it in their like this

agileLegs.Abilities = new AbilityDef[]
   {
            Repo.GetAllDefs<AbilityDef>().FirstOrDefault(a => a.name.Equals("Humanoid_HighJump_AbilityDef")),
            Repo.GetAllDefs<AbilityDef>().FirstOrDefault(a => a.name.Equals("Dash_AbilityDef")),
            };

the final code should look like this

using System;
using Harmony;
using System.Linq;
using Base.Defs;
using PhoenixPoint.Tactical.Entities.Equipments;
using PhoenixPoint.Tactical.Entities.Abilities;
using PhoenixPoint.Common.Entities.Items;
using Base.Core;
using Base.Entities.Abilities;

namespace OP_Armor_Abilities
{
    public static class MyMod
    {
        public static void HomeMod(Func<string, object, object> api = null)
        {
            HarmonyInstance.Create("your.mod.id").PatchAll();
            api?.Invoke("log verbose", "Mod Initialised.");

            DefRepository Repo = GameUtl.GameComponent<DefRepository>();

       
      TacticalItemDef agileLegs = Repo.GetAllDefs<TacticalItemDef>().FirstOrDefault(a => a.name.Equals("AN_Berserker_Shooter_Legs_ItemDef"));

            agileLegs.Abilities = new AbilityDef[]
   {
            Repo.GetAllDefs<AbilityDef>().FirstOrDefault(a => a.name.Equals("Dash_AbilityDef")),
            };      
        }

        public static void MainMod(Func<string, object, object> api)
        {
            HarmonyInstance.Create("your.mod.id").PatchAll();
            api("log verbose", "Mod Initialised.");
        }
    }
}

build your solution and add the mod to test it out. If you have questions message me on discord  my username is dtony22. thats it and thats all for now.