Phoenix Point

Phoenix Point

Not enough ratings
Step By Step Guide On Making A Mod
By Dtony
I recently created and uploaded the mod to replace Quickaim with Gunslinger, This guide takes us through the process of replacing the level 3 skill of the sniper "Quickaim" with a better OP Version called Gunslinger Step by Step. From opening the phoenix point workshop tool, Where What And how to add necessary code in Visual Studios, To uploading the mod to steam.
   
Award
Favorite
Favorited
Unfavorite
1. Phoenix Point Workshop Tool
1. In my library I launch the Phoenix Point Workshop Tool

2. Select "Project" Tab located at the top left in Phoenix Point Workshop Tool

3. Select New Project

4. For Id section, replace the newmod in com.example.newmod with a name of your choosing i.e com.example.SniperGunslinger

5. Where it says "Name" replace New Mod with whatever you want to call the mod, In my case it will be Sniper Gunslinger

6. Add a description If you want in the description box i.e. Replaces Quickaim with an OP ability called Gunslinger

7. Select "Create"

8. You will see your newly created mod project show up in the workshop tool, double click your new mod to open it in Visual Studios IDE.
2. Setting Up The Mod In Visual Studios
1. Once you have double clicked on your newly created mod project(In This Case Sniper Gunslinger), navigate to solution explorer and expand the area where it says "SniperGunslinger" by clicking on the arrow pointer located next to it on the left. (I will try to add Images)

2. While Still in solution explorer and expanding your project to see the files inside, right click and delete SniperGunslingerConfig.cs, SniperGunslingerGeoscape.cs, and SniperGunslingerTactical.cs
we will not be needing these.

3. In Solution Explorer, double click on SniperGunslingerMain.cs to open the file.
3. Modify SniperGunslingerMain.cs
0. Once you have opened SniperGunslinger.cs delete this line of code
public new SniperGunslingerConfig Config => (SniperGunslingerConfig)base.Config;

1. Locate where it says
public class SniperGunslingerMain : ModMain
at the top of the file

2. On the next line after the opening bracket of
public class SniperGunslingerMain :ModMain
add these two lines of code
internal static readonly DefRepository Repo =GameUtl.GameComponent<DefRepository>();

public static ModMain Main { get; private set; }

It Should look like this

namespace SniperGunslinger { public class SniperGunslingerMain : ModMain { internal static readonly DefRepository Repo = GameUtl.GameComponent<DefRepository(); public static ModMain Main { get; private set; }


3. you will see a red underline right under DefRepository and GameUtl, click anywhere on DefRepository press ALT + ENTER on your keyboard

4. A Suggested Change should pop up, once it does (right after you pressed ALT + Enter on your keyboard) press ENTER. You should now notice the word DefRepository no longer has a red underline and the word is a bluish color.

5. click anywhere on the word GameUtl and press ALT + ENTER on your keyboard, then press ENTER again once the suggestion box pops up. You should no longer see a red underline underneath the word GameUtl.

6. After the opening bracket of
public override void OnModEnabled() {
add this line of code on the next line
Main = this;
it should look like this
public override void OnModEnabled() {
Main = this;

7. After the opening bracket of
public override void OnModDisabled() {
add this line of code
Main = null;

7. Select "File" located at the top left of Visual Studios and select save all.
4. Create A New File And Add Necessary Code
1. In Solution Explorer right click on "SniperGunslinger"

2. select Add

3. Select New Item

4. Name it Sniper.cs and select Add then double click on it to open it.

5. Add this line of code anywhere between the opening and closing brackets of
internal class Sniper
the line of code to enter is
readonly DefRepository Repo = SniperGunslingerMain.Repo;
it should look like this
internal class Sniper
{
private static readonly DefRepository Repo = SniperGunslingerMain.Repo;
}

6. You will see a red underline by DefRepository, fix this by using the process of pressing
ALT + ENTER then press ENTER Again once the suggestion box pops up. From here on out we will call this process QIUD (Quickly Include Using Directives)

7. after you have entered that line of code, will create a new method named SniperChanges on the very next line by adding this code

public static void SniperChanges()
{

}

your Sniper.cs code should look like this
namespace SniperGunslinger
{
internal class Sniper
{
private static readonly DefRepository Repo = SniperGunslingerMain.Repo;

public static void SniperChanges()
{

}
}
}
5. Add Code Inside The Method SniperChanges()
1. Inside the opening brackets of
public static voic SniperChanges()
add this line of code to define the sniper class AKA Sniper Specialization
SpecializationDef sniper = Repo.GetAllDefs<SpecializationDef>().FirstOrDefault (a=>a.name.Equals("SniperSpecializationDef"));

the the line of code for defining sniper class should all be in one line.

2. Next we will define the Gunslinger ability by using this line of code
ShootAbilityDef Gunslinger = Repo.GetAllDefs<ShootAbilityDef>().FirstOrDefault(a => a.name.Equals("Gunslinger_AbilityDef"));

3. We need to Navigate to where Quickaim is located within the sniper specializations ability track and replace it with Gunslinger. We will not do that in this guide but I will include steps on how I did that in a reference section I will create(See Reference Material On How I located various things within the game file). for now simply add this line of code after you have defined Gunslinger.
sniper.AbilityTrack.AbilitiesByLevel[2].Ability = Gunslinger;

your Sniper.cs file should now look like this
using Base.Defs; using PhoenixPoint.Common.Core; using PhoenixPoint.Common.Entities; using PhoenixPoint.Tactical.Entities.Abilities; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SniperGunslinger { internal class Sniper { private static readonly DefRepository Repo = SniperGunslingerMain.Repo; public static void SniperChanges() { SpecializationDef sniper = Repo.GetAllDefs<SpecializationDef>().FirstOrDefault(a=>a.name.Equals("SniperSpecializationDef")); ShootAbilityDef Gunslinger = Repo.GetAllDefs<ShootAbilityDef>().FirstOrDefault(a => a.name.Equals("Gunslinger_AbilityDef")); sniper.AbilityTrack.AbilitiesByLevel[2].Ability = Gunslinger; } } }


6. Include SniperChanges() Method In SniperGunslingerMain.cs
1. Inside the brackets of
public override void OnModEnabled()
after
PhoenixGame game = GetGame();
add this line of code
Sniper.SniperChanges();

your SniperGunslingerMain.cs file should resemble something like this although it doesnt have to exactly(I removed some comments and unnecessary code for readability)
using Base.Core; using Base.Defs; using Base.Levels; using PhoenixPoint.Common.Game; using PhoenixPoint.Modding; using System.Linq; using UnityEngine; namespace SniperGunslinger { public class SniperGunslingerMain : ModMain { internal static readonly DefRepository Repo = GameUtl.GameComponent<DefRepository>(); public static ModMain Main { get; private set; } public override bool CanSafelyDisable => true; public override void OnModEnabled() { Main = this; int c = Dependencies.Count(); Logger.LogInfo($"Say anything crab people-related."); string v = MetaData.Version.ToString(); HarmonyLib.Harmony harmony = (HarmonyLib.Harmony)HarmonyInstance; string id = Instance.ID; GameObject go = ModGO; PhoenixGame game = GetGame(); Sniper.SniperChanges(); } public override void OnModDisabled() { Main = null; } } }
7. Build And Save Your Project
1. Press CTRL + B on your keyboard to build the solution. If you did everything correctly you should not see any errors after you build, warnings are fine.

2. Press CTRL + SHIFT + S to save everything.

8. Upload Mod To Steam Workshop Using Phoenix Point Workshop Tool
I recommend testing mods before uploading. once you have built any mod project you can launch phoenix point with mods options and your mod should should up in inside the Mods Section Of the title screen.

1. Click and Highlight Sniper Gunslinger then click on the "Workshop" located at the top of the workshop tool, and select New Workshop Item

2. Enter Details Of Mod Like name and description.

3. set to public to allow others to see the mod or keep visibility on private if you do not want to share it with others yet.

4. Select Create

5. Press OK if a pop up box appears.

6. right click on the mod and select Upload Data To Workshop, Select Ok if a pop up box appears.

7. The Mod should now be in the workshop
9. References
Coming Soon....
10. Additional Stuff
Coming Soon....
3 Comments
Dtony  [author] Oct 7, 2024 @ 10:14am 
@OSOK Gunslinger was already in the game, I found it using dump data and looked into Ability Defs. You can make your own abilities however by clonings existing ones and and adding a new guid to the clone
OSOK Jan 22, 2024 @ 6:46pm 
This is a very helpful guide. In particular though, can you expand on the creation of the Gunslinger ability and how that is coded.
ClanFoxReaper Oct 16, 2022 @ 10:42am 
Will there be more Phoenix Point guides? For example PassiveModifierAbilityDef?