Phoenix Point

Phoenix Point

评价数不足
How To Make A Mod For Beginners
由 Dtony 制作
This will be a basic stats modification mod.
   
奖励
收藏
已收藏
取消收藏
Things you will need
1. Phoenix Point Steam Workshop Tool
2. Read The Instruction on Creating a new mod project by clicking here [github.com]
2. Dump Data Or Asset Studios.
3. Visual Studios IDE

Dump Data And/Or Asset Studios Is Important because you will need to find the proper names for weapons/items/abilities/armor etc... And To know What Parameters To Modify.

Although I Do Not Recommend It You Can Get By With Just The weapons/items/abilities/armor Names Found Here https://docs.google.com/document/d/18tdMZlYVIPrO942GQagoZTjFBvSTXiDQ80cqbAlusPg/edit The Weapon Names Can Be Found Under All Items And Ability Names Can Be Found Under Teach Commands. For A Reference Of Some Weapon Names We Are Working With Scroll To The Bottom Of The Page
First Things First
You Need To first understand how to define something. first lets define the starter assault rifle. the blueprint for defining things should look like this.

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

Lets use the blueprint above to define the Ares AR-1 starter assault rifle. We need to declare its type (WeaponDef), give it a custom name, and then enter the Real name of weapon inside the quotation marks(in this case PX_AssaultRifle_WeaponDef )

the Type of any weapon is called WeaponDef, and the type of any Armor is called TacticalItemDef

we know the starter assault rifle is of type WeaponDef since its a weapon, right after we declare a Type we give a name to what we are defining , we can name it anything so lets name it AssaultRifle
The Next Step
Lets assume you created a new mod project and named the it New Mod. Open your project and go to NewModMain.cs

At the top of the page Make Sure You Have These Using Directives, If You Dont Copy And Paste it....
using Base.Core;
using Base.Defs;
using Base.Levels;
using PhoenixPoint.Common.Game;
using PhoenixPoint.Modding;
using PhoenixPoint.Tactical.Entities.Weapons;
using System.Linq;
using UnityEngine;



inside public override void OnModEnabled() { After PhoenixGame game = GetGame(); Add This Line Of Code.

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

lets start with tweaking the stats of the starter assault rifle Ares AR-1. Keep in mind anything following two forward slashes // is a comment.


After you have copy and pasted/entered/typed the required line of code above, One the very next line Copy And Paste The following code up to where it says Copy the code up to here.

//Defines phoenix point starter assault rifle
WeaponDef AssaultRifle = Repo.GetAllDefs<WeaponDef>().FirstOrDefault(a=>a.name.Equals("PX_AssaultRifle_WeaponDef");
//adjusts action points cost to fire weapon. for weapons 1 ap = 25
AssaultRifle.APToUsePerc = 50;
//adjusts accuracy penalty if not efficient with weapon. 2 = half accuracy. 1 or 0 = no penalty
AssaultRifle.IncompetenceAccuracyMultiplier = 2;
//adjusts number of hands required to use weapon
AssaultRifle.HandsToUse = 2;
//adjusts number of Bursts
AssaultRifle.DamagePayload.AutoFireShotCount = 6;
//adjusts number of bullets per burst
AssaultRifle.DamagePayload.ProjectilesPerShot = 1;
//adjusts if bullets can't pass through objects
AssaultRifle.DamagePayload.StopOnFirstHit = false;
//adjusts regular damage
AssaultRifle.DamagePayload.DamageKeywords[0].Value = 30;
//Copy the code up to here

The code above defines the Ares AR-1 Assault Rifle And some of its default/vanilla values. Lets make some changes to it. We will changes action point cost to 1, hands required to use to 1, Burst to 8, bullets per Burst to 2, and the regular damage amount to 40

//adjusts action points cost to fire weapon. for weapons 1 ap = 25
AssaultRifle.APToUsePerc = 25;
//adjusts number of hands required to use weapon
AssaultRifle.HandsToUse = 1;
//adjusts number of bursts
AssaultRifle.DamagePayload.AutoFireShotCount = 8;
//adjusts number of bullets per burst
AssaultRifle.DamagePayload.ProjectilesPerShot = 2;
//adjusts regular damage
AssaultRifle.DamagePayload.DamageKeywords[0].Value = 40;

lets try doing this with the starter sniper rifle AKA Firebird SR. For readability Skip a line or two before copy pasting the following block of code.

//Defines phoenix point starter sniper rifle
WeaponDef SniperRifle = Repo.GetAllDefs<WeaponDef>().FirstOrDefault(a => a.name.Equals("PX_SniperRifle_WeaponDef"));
//adjusts action points cost to fire weapon. 1 ap = 25
SniperRifle.APToUsePerc = 75;
//adjusts accuracy penalty if not efficient with weapon. 2 = half accuracy. 1 or 0 = no penalty
SniperRifle.IncompetenceAccuracyMultiplier = 2;
//adjusts number of hands required to use weapon
SniperRifle.HandsToUse = 2;
//adjusts number of bursts
SniperRifle.DamagePayload.AutoFireShotCount = 1;
//adjusts number of bullets per burst
SniperRifle.DamagePayload.ProjectilesPerShot = 1;
//adjusts if bullets can't pass through objects
SniperRifle.DamagePayload.StopOnFirstHit = false;
//adjusts regular damage
SniperRifle.DamagePayload.DamageKeywords[0].Value = 110;
//Copy Up To Here

Since the Firebird SR is of type WeaponDef it uses the same exact variables as the Ares AR-1 or any other Weapon. APToUsePerc or HandsToUse are examples of variables. the above are vanilla values for starter sniper rifle. lets change it so if you are not proficient with the weapon you get no accuracy penalty and lets make it so bullets can not pass through objects.

//adjusts accuracy penalty if not efficient with weapon. 2 = half accuracy. 1 or 0 = no penalty
SniperRifle.IncompetenceAccuracyMultiplier = 0;
//adjusts if bullets can't pass through objects
SniperRifle.DamagePayload.StopOnFirstHit = true;

lastly lets define the New Jericho Heavy Leg Armor and its default values. Copy and Paste The Following

//Defines New Jericho Heavy Leg Armor
TacticalItemDef HeavyLegArmor = Repo.GetAllDefs<TacticalItemDef>().FirstOrDefault(a=>a.name.Equals("NJ_Heavy_Legs_ItemDef"));
//adjusts armor value
HeavyLegArmor.Armor = 35;
//adjusts weight
HeavyLegArmor.Weight = 3;
//adjusts if armor can be removed
HeavyLegArmor.IsPermanentAugment = false;
//adjusts armor speed
HeavyLegArmor.BodyPartAspectDef.Speed = -1;
//adjusts armor accuracy
HeavyLegArmor.BodyPartAspectDef.Accuracy = -0.02f;
//adjusts armor stealh
HeavyLegArmor.BodyPartAspectDef.Stealth = -0.2f;
//adjusts armor perception
HeavyLegArmor.BodyPartAspectDef.Perception = 0;
//adjusts armor strength
HeavyLegArmor.BodyPartAspectDef.Endurance = 0;
//adjusts will power
HeavyLegArmor.BodyPartAspectDef.WillPower = 0;
//Copy Up To Here

lets adjust it so it gets no stat penalties and lets increase its armor to 50

//adjusts armor value
HeavyLegArmor.Armor = 50;
//adjusts armor speed
HeavyLegArmor.BodyPartAspectDef.Speed = 0;
//adjusts armor accuracy
HeavyLegArmor.BodyPartAspectDef.Accuracy = 0;
//adjusts armor stealh
HeavyLegArmor.BodyPartAspectDef.Stealth = 0;


build your solution (CTRL + SHIFT + B), Launch Phoenix Point With Mods, Make Sure Your Mod Is In The Mod Menu, Load A Games And Test Your Changes.

References
References:

Workshop Tool Guide https://github.com/SnapshotGames/PPWorkshopTool

List OF Weapon Names https://docs.google.com/document/d/18tdMZlYVIPrO942GQagoZTjFBvSTXiDQ80cqbAlusPg/edit

For Reference Sake I Will Add Some Weapon Names In This Guide

Phoenix Weapons

PX_AcidCannon_WeaponDef
PX_AssaultRifle_WeaponDef
PX_GrenadeLauncher_WeaponDef
PX_HeavyCannon_WeaponDef
PX_LaserArrayPack_WeaponDef
PX_LaserPDW_WeaponDef
PX_LaserTechTurretItem_ItemDef
PX_Neurazer_WeaponDef
PX_Pistol_WeaponDef
PX_ShotgunRifle_WeaponDef
PX_ShredingMissileLauncherPack_WeaponDef
PX_StunRod_WeaponDef
PX_VirophageSniperRifle_WeaponDef
11 条留言
Dtony  [作者] 2024 年 7 月 14 日 上午 7:42 
Below is an example Of taking preexisting a def and "Cloning" it
Dtony  [作者] 2024 年 7 月 14 日 上午 7:41 
public static void Clone_OilCrab()
{
string skillName3 = "GoldTorsoOilCrab_AbilityDef";
DeathBelcherAbilityDef source3 = Repo.GetAllDefs<DeathBelcherAbilityDef>().FirstOrDefault(p => p.name.Equals("Oilcrab_Die_DeathBelcher_AbilityDef"));
DeathBelcherAbilityDef oilCrab = Helper.CreateDefFromClone(
source3,
"54CD9E74-7F1D-4D84-8316-FCBF56C0D38D",
skillName3);

AddAbilityStatusDef oilCrabStatus = Repo.GetAllDefs<AddAbilityStatusDef>().FirstOrDefault(a => a.name.Equals("OilCrab_AddAbilityStatusDef"));
ActorHasTagEffectConditionDef oilCrabCondition = (ActorHasTagEffectConditionDef)oilCrabStatus.ApplicationConditions[0];
oilCrabCondition.GameTag = Repo.GetAllDefs<GameTagDef>().FirstOrDefault(a => a.name.Equals("SmallGeyser_GameTagDef"));
oilCrabCondition.HasTag = false;
}
Dtony  [作者] 2024 年 7 月 14 日 上午 7:41 
TFTV Is a complete Overhaul and likely to conflict with a lot of mods.

Turn it off first to test and see if that is the problem.

Adjusting seats Is located in GeoVehicleDef.BaseStats.SpaceForUnits

You could always add new custom defs and add that to the game so it does not conflict
Optional Guy 2024 年 7 月 14 日 上午 1:06 
@Dtony Finally figured it out thanks to you. Thanks a lot for your help! What I was trying to do was increase the amount of seats on aircraft. There aren't any issues from the coding side of things, it's building successfully and all that. Unfortunately it's not letting me activate the mod though.

I have a feeling that's to do with TFTV? I'm talking out my ass of course I have no idea but I'm guessing there is a conflict of some sort because TFTV reduces the amount of seats on aircraft? Or am I totally wrong?
Dtony  [作者] 2024 年 7 月 13 日 下午 8:56 
Are you using dump data to dump all the definitions?

try using

VehicleItemDef
GroundVehicleItemDef
GeoVehicleDef

for weapons try

GeoVehicleWeaponDef
GeoVehicleModuleDef
Optional Guy 2024 年 7 月 13 日 下午 2:47 
I've been searching for ages and have not been able to find what defines aircraft. Do you know by any chance? Thanks for this guide btw, was able to make some simple changes I'd been wanting to make to weapons with very little prior knowledge.
Dtony  [作者] 2022 年 8 月 21 日 上午 10:24 
Discord
dtony22#1456
Dtony  [作者] 2022 年 8 月 21 日 上午 10:23 
@ClanFoxReaper You want the parameters right?

for the module some parameters are GeoVehicleModuleBonusValue, AmmoCount, ChargeTime, HitPoints, Armor, ChargesMax

for weapons there is Accuracy, Range, ProjectileSpeed, NumberOfProjectiles, AmmoCount, ChargeTime, HitPoints, Armor, ChargesMax

if you want to know more message me on discord or kindly create a thread for modding help and coding questions
Dtony  [作者] 2022 年 8 月 21 日 上午 10:14 
@italiangamer[Schizophrenic] THANKS!
italiangamer89[schizoprhenic] 2022 年 8 月 13 日 上午 3:31 
hey in WeaponDef AssaultRifle = Repo.GetAllDefs<WeaponDef().FirstOrDefault(a=>a.name.Equals("PX_AssaultRifle_WeaponDef"); you forgot to close with this > after WeaponDef