-
Posts
598 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by GrimyBunyip
-
-
so if you've made a class mod, you'll need to update your xcomclassdata.ini file
with new info like excludedAWC, ballowawc, allowedarmors, etc
-
@SteelRook
no
-
Advanced and Superior weapon upgrade drop rates changed
Advanced and superior Repeater drop rates were roughly halved relative to other items
No change to basic repeaters.
-
new inv slots, kinda chuckled when I read the naming convention
case eInvSlot_PrimaryWeapon:
case eInvSlot_SecondaryWeapon:
case eInvSlot_TertiaryWeapon:
case eInvSlot_QuaternaryWeapon:
case eInvSlot_QuinaryWeapon:
case eInvSlot_SenaryWeapon:
case eInvSlot_SeptenaryWeapon:
-
changes were made to X2SoldierClassTemplate and X2SoldierClassTemplateManager
var config array<name> AllowedArmors;
var config array<name> ExcludedAbilities; // Abilities that are not eligible to roll from AWC for this class
var config bool bAllowAWCAbilities; // If this class should receive or share AWC abilities var config protectedwrite bool bMultiplayerOnly;
var config bool bUniqueTacticalToStrategyTransfer; // If this class has unique tactical to strategy transfer code, used for DLC and modding
var config bool bIgnoreInjuries; // This class can go on missions even if they are wounded
var config bool bBlockRankingUp; // Do not let soldiers of this class rank up in the normal way from XP
var config array<EInventorySlot> CannotEditSlots; // Slots which cannot be edited in the armory loadout
var config protectedwrite bool bHideInCharacterPool;
var localized array<string> RankNames; // there should be one name for each rank; e.g. Rookie, Squaddie, etc.
var localized array<string> ShortNames; // the abbreviated rank name; e.g. Rk., Sq., etc.
var localized array<string> RankIcons; // strings of image names for specialized rank icons
function bool IsArmorAllowedByClass(X2ArmorTemplate ArmorTemplate)
{
local int i;
switch (ArmorTemplate.InventorySlot)
{
case eInvSlot_Armor: break;
default:
return true;
}
for (i = 0; i < AllowedArmors.Length; ++i)
{
if (ArmorTemplate.ArmorCat == AllowedArmors)
return true; return true;
} }
return false; return false;
}
-
new effect property:
bCanTickEveryAction=true
needless to say X2StatusEffects.uc has been altered
-
we already knew that, but the question is how they're overridden.From the patch notes:
"Game state classes can now be overridden"
Yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay!
because if it's done in the same way as other overrides, where any time old code would create the old game state instead of the override state, then it might not be that useful.
-
what looks like is going on, is that I can call logs right before:
AbilityState.LookupShotBreakdown
LookupShotBreakdown is inside a native class (XcomGameState_Ability), so I can't drop any logs inside the native class.
what is odd, is that the native class still calls X2AbilityToHitCalc, which is NOT native
and any logs I put inside X2AbilityToHitCalc, or any other changes I make there, will not affect the game itself.
Is it just that code in native classes aren't reflected in the source code? Or I can't even indirectly affect native classes through other classes the native one calls.
-
yes to bothSorry if it's basic, but did you spread `log calls through your code to ensure it is being called, and check XComEngine.ini to make sure your overrides have survived the ini building process?
log calls and redscreen calls never popped up, it's like the code isn't being called at all.
-
I've been trying to edit various functions inside X2AbilityToHitCalc, namely finalizehitchance
but none of my edits seem to be having any effect on the game.
I tried disabling all mods besides the the one making the edit, and deleting the config folder.
I've also traced the function calls for finalizehitchance through other uc files, and it definitely seems like finalizehitchance should be called where I would expect it to.
I'm hoping to see if anybody has any thoughts why this might be the case.
-
-
I'm trying to figure out how to draw a simple rectangle.
I started by trying to make a UIBGBox:
GrimyBox1 = Spawn(class'UIBGBox', self); GrimyBox1.InitBG('BGBoxSimple').SetBGColor("red"); GrimyBox1.SetHighlighed(true); GrimyBox1.AnchorCenter(); GrimyBox1.SetPosition(-250,400); GrimyBox1.SetSize(5 * (GrimyHitChance - GrimyCritChance),20); GrimyBox2 = Spawn(class'UIBGBox', self); GrimyBox2.InitBG('BGBoxSimple').SetBGColor("yellow"); GrimyBox2.SetHighlighed(true); GrimyBox2.AnchorCenter(); GrimyBox2.SetPosition(-250 + 5 * (GrimyHitChance - GrimyCritChance - GrimyDodgeChance),400); GrimyBox2.SetSize(5 * GrimyCritChance,20);
The above code will draw box1, but will not draw box2.If I comment out the code for box1, box2 will appear.
I don't understand why these two are mutually exclusive.
I tried using UIPanel instead of UIBGBox, but nothing appears.
has anyone else experimented with UI elements yet?
-
I discovered something weird today, that I felt I might as well share.
I tried adding config to the X2DownloadableContentInfo header. For Example:
class X2DownloadableContentInfo_GrimyLootMod extends X2DownloadableContentInfo Config(GrimyLootMod);
The code builds, but it turns out that the OnLoadedSavedGame() event will not trigger with config in the header.
But when I removed the Config(GrimyLootMod) from the header, the event would trigger. Very strange.
-
Maybe my memory is bad, but did anyone ever say that OnLoadedSaveGame actually runs once *every* time you load? As opposed to what was stated in the examples?
I'm looking for a method that runs on every load, as a means to implement a form of version control.
-
is there any particular information you need for windows 7 users? just the error logs?
-
i think this line in your code
TechState = XComGameState_Tech(NewGameState.CreateStateObject(class'XComGameState_Item'));
should beTechState = XComGameState_Tech(NewGameState.CreateStateObject(class'XComGameState_Tech'));
I also found that in most of Firaxis code, when dealing with changes like that, they usualy call`XCOMGAME.GameRuleset.SubmitGameState(NewGameState);
instead of History.AddGameStateToHistory, even though that's probably not the reason why it didn't work.And, as was suggested, you might indeed wanna put some Log statements to see if it this function even gets triggered.
That was it! thanks. Sometimes I just can't seem to read my own code it seems.
-
So, how does your tech get installed at all, if it works in a new campaign? Do you have screen listeners? Do they trigger (which you can tell via adding `log)?
I just return it inside an array output by a createtemplate function, the game actually handles the rest by itself.
-
there's no code in Installnewcampaign.
I haven't found the code elsewhere yet.
-
I have a mod that adds new tech templates, and they aren't shown to users who grab this DLC on an ongoing campaign.
I'm trying to figure out how to rectify that.
I'm following the OnLoadedSaveGame() code from the example weapon:
static event OnLoadedSavedGame() { local XComGameStateHistory History; local XComGameState NewGameState; local XComGameState_HeadquartersXCom OldXComHQState; local XComGameState_HeadquartersXCom NewXComHQState; local X2TechTemplate TechTemplate; local XComGameState_Tech TechState; local X2StrategyElementTemplateManager StratMgr; StratMgr = class'X2StrategyElementTemplateManager'.static.GetStrategyElementTemplateManager(); History = `XCOMHISTORY; //Create a pending game state change NewGameState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Adding Research Templates"); //Get the previous XCom HQ state - we'll need it's ID to create a new state for it OldXComHQState = XComGameState_HeadquartersXCom(History.GetSingleGameStateObjectForClass(class'XComGameState_HeadquartersXCom')); //Make the new XCom HQ state. This starts out as just a copy of the previous state. NewXComHQState = XComGameState_HeadquartersXCom(NewGameState.CreateStateObject(class'XComGameState_HeadquartersXCom', OldXComHQState.ObjectID)); //Find tech template TechTemplate = X2TechTemplate(StratMgr.FindStrategyElementTemplate('Tech_IdentifyRareLockbox')); //Instantiate a new item state object using the template TechState = XComGameState_Tech(NewGameState.CreateStateObject(class'XComGameState_Item')); TechState.OnCreation(TechTemplate); NewGameState.AddStateObject(TechState); //Commit the new HQ state object to the state change that we built NewGameState.AddStateObject(NewXComHQState); //Commit the state change into the history. History.AddGameStateToHistory(NewGameState); }
Unfortunately, this doesn't seem to be working. I checked the GetAvailableTechsForResearch function from XcomGameState_HeadquartersXcom as well, and it certainly looks like research lists are acquired by iterating through game states in HISTORY.Could anyone point me in the right direction?
-
Figured it out. Posting code for anyone who is curious:
local XComGameStateHistory History; local XComGameState_HeadquartersXCom XComHQ; local X2ItemTemplateManager ItemTemplateManager; local XComGameState_Item ItemState; local XComGameState_Tech CompletedTechState; local array<XComGameState_Tech> CompletedTechs; local X2ItemTemplate ItemTemplate; ItemTemplateManager = class'X2ItemTemplateManager'.static.GetItemTemplateManager(); ItemTemplate = ItemTemplateManager.FindItemTemplate('ModWeapon_CV'); foreach NewGameState.IterateByClassType(class'XComGameState_HeadquartersXCom', XComHQ) { break; } if (XComHQ == none) { History = `XCOMHISTORY; XComHQ = XComGameState_HeadquartersXCom(History.GetSingleGameStateObjectForClass(class'XComGameState_HeadquartersXCom')); XComHQ = XComGameState_HeadquartersXCom(NewGameState.CreateStateObject(class'XComGameState_HeadquartersXCom', XComHQ.ObjectID)); NewGameState.AddStateObject(XComHQ); } // If it is possible for this item to be upgraded, check to see if the upgrade has already been researched if (ItemTemplate.UpgradeItem != '') { CompletedTechs = XComHQ.GetCompletedProvingGroundTechStates(); foreach CompletedTechs(CompletedTechState) { if (CompletedTechState.GetMyTemplate().ItemsToUpgrade.Find(ItemTemplate.DataName) != INDEX_NONE) { // A tech has already been completed which has upgraded this item, so replace the template with the upgraded version ItemTemplate = ItemTemplateManager.FindItemTemplate(ItemTemplate.UpgradeItem); break; } } } ItemState = ItemTemplate.CreateInstanceFromTemplate(NewGameState); ItemState.ApplyWeaponUpgradeTemplate(X2WeaponUpgradeTemplate(ItemTemplateManager.FindItemTemplate('AimUpgrade_Bsc'))); NewGameState.AddStateObject(ItemState); // Act as though it was just built, and immediately add it to the inventory ItemState.OnItemBuilt(NewGameState); TechState.ItemReward = ItemTemplate; // Needed for UI Alert display info TechState.bSeenResearchCompleteScreen = false; // Reset the research report for techs that are repeatable XComHQ.PutItemInInventory(NewGameState, ItemState); `XEVENTMGR.TriggerEvent('ItemConstructionCompleted', ItemState, ItemState, NewGameState);
-
While I cant explain to you exactly what sequence of events will lead to your specific redscreen, I can point you to something that looks 'incorrect'.
//ItemState = ItemTemplate.CreateInstanceFromTemplate(NewGameState);
NewGameState.AddStateObject(ItemState);
In the second line you try to add the StateObject ItemState to your NewGameState. But since the first line is commented out, ItemState will be null at this point in time, and thats not a good thing to be.In the middle of your first redscreen image, you can see XCom complaining about this: StateObject is NULL!
XCom is so unhappy, it even spend some money to get an exclamation mark in there.
Oops, I did have that line uncommented at some point during my testing. But I started commenting stuff out hoping to figure out what was wrong.
Here's the redscreen if I uncomment those lines of code:
function IndentifyWeaponAR(XComGameState NewGameState, XComGameState_Tech TechState) { local XComGameStateHistory History; local XComGameState_HeadquartersXCom OldXComHQState; local XComGameState_HeadquartersXCom NewXComHQState; local XComGameState_Item ItemState; local X2ItemTemplateManager ItemMgr; local X2ItemTemplate ItemTemplate; local X2WeaponUpgradeTemplate UpgradeTemplate; //In this method, we demonstrate functionality that will add ExampleWeapon to the player's inventory when loading a saved //game. This allows players to enjoy the content of the mod in campaigns that were started without the mod installed. ItemMgr = class'X2ItemTemplateManager'.static.GetItemTemplateManager(); History = `XCOMHISTORY; //Create a pending game state change NewGameState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Adding ExampleWeapon Objects"); //Get the previous XCom HQ state - we'll need it's ID to create a new state for it OldXComHQState = XComGameState_HeadquartersXCom(History.GetSingleGameStateObjectForClass(class'XComGameState_HeadquartersXCom')); //Make the new XCom HQ state. This starts out as just a copy of the previous state. NewXComHQState = XComGameState_HeadquartersXCom(NewGameState.CreateStateObject(class'XComGameState_HeadquartersXCom', OldXComHQState.ObjectID)); //Make the changes to the HQ state. Here we add items to the HQ's inventory ItemTemplate = ItemMgr.FindItemTemplate('AssaultRifle_Central'); //Instantiate a new item state object using the template. ItemState = ItemTemplate.CreateInstanceFromTemplate(NewGameState); `CREATE_X2TEMPLATE(class'X2WeaponUpgradeTemplate', UpgradeTemplate, 'AimUpgrade_Bsc'); ItemState.ApplyWeaponUpgradeTemplate(UpgradeTemplate); ItemState.Nickname = "HelloWorld"; NewGameState.AddStateObject(ItemState); //Add the newly created item to the HQ inventory NewXComHQState.AddItemToHQInventory(ItemState); //Commit the new HQ state object to the state change that we built NewGameState.AddStateObject(NewXComHQState); //Commit the state change into the history. History.AddGameStateToHistory(NewGameState); }
-
Edit: Figured it out.
I'm getting the following redscreen errors upon research completion:Here is the function that runs when the research completes, it's more or less a copy paste from the exampleweapon project.
I'm not sure why I'm getting a "never added to history" error. Can anyone help me understand?
function IndentifyWeaponAR(XComGameState NewGameState, XComGameState_Tech TechState) { local XComGameStateHistory History; local XComGameState_HeadquartersXCom OldXComHQState; local XComGameState_HeadquartersXCom NewXComHQState; local XComGameState_Item ItemState; local X2ItemTemplateManager ItemMgr; local X2ItemTemplate ItemTemplate; local X2WeaponUpgradeTemplate UpgradeTemplate; //In this method, we demonstrate functionality that will add ExampleWeapon to the player's inventory when loading a saved //game. This allows players to enjoy the content of the mod in campaigns that were started without the mod installed. ItemMgr = class'X2ItemTemplateManager'.static.GetItemTemplateManager(); History = `XCOMHISTORY; //Create a pending game state change NewGameState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Adding ExampleWeapon Objects"); //Get the previous XCom HQ state - we'll need it's ID to create a new state for it OldXComHQState = XComGameState_HeadquartersXCom(History.GetSingleGameStateObjectForClass(class'XComGameState_HeadquartersXCom')); //Make the new XCom HQ state. This starts out as just a copy of the previous state. NewXComHQState = XComGameState_HeadquartersXCom(NewGameState.CreateStateObject(class'XComGameState_HeadquartersXCom', OldXComHQState.ObjectID)); //Make the changes to the HQ state. Here we add items to the HQ's inventory ItemTemplate = ItemMgr.FindItemTemplate('AssaultRifle_Central'); //Instantiate a new item state object using the template. //ItemState = ItemTemplate.CreateInstanceFromTemplate(NewGameState); //`CREATE_X2TEMPLATE(class'X2WeaponUpgradeTemplate', UpgradeTemplate, 'AimUpgrade_Bsc'); //ItemState.ApplyWeaponUpgradeTemplate(UpgradeTemplate); //ItemState.Nickname = "HelloWorld"; NewGameState.AddStateObject(ItemState); //Add the newly created item to the HQ inventory NewXComHQState.AddItemToHQInventory(ItemState); //Commit the new HQ state object to the state change that we built NewGameState.AddStateObject(NewXComHQState); //Commit the state change into the history. History.AddGameStateToHistory(NewGameState); }
-
You can do:
class'CLASS_NAME'.default.VARIABLE_PROPERTY
to grab a var, can you do the same for functions? -
Here is the code that Death From Above uses to check for height advantage:
SourceUnit.HasHeightAdvantageOver(PrevTargetUnit, true))
Help : extending native classes
in XCOM 2
Posted
You can try taking a look at my headhunter mod:
http://steamcommunity.com/sharedfiles/filedetails/?id=678149207
I'm under the impression that getmultitargetoptions is meant for the UI, because I'm pretty sure getsingletargetoptions populates the list of possible targets for the UI, for stuff like standard shot.
ANYWAYS in my case I just ignored that altogether and manipulated the targets via the BuildGameStateFn and BuildVisualizationFn