HELP: I want to check wether an Ability is an Officer Ability and the game breaks?

Post Reply
LeaderEnemyBoss
Posts: 106
Joined: Wed Jan 18, 2017 5:27 pm

HELP: I want to check wether an Ability is an Officer Ability and the game breaks?

Post by LeaderEnemyBoss »

Hey everyone,

I'm about to release an UI-Mod for LW2 and encountered a strange issue. I loop through all earned soldier abilities and want to check whether a specific ability is an officer ability or not. As soon as I implement the following function, the officer part of LW2 broke! Officer icons are not displayed anymore in squadselect, GTS does no longer display two officer slots, i cant even access the one present correctly. I am really confused by this, since my code seems innocent enough? Maybe anyone has a pointer on what I do wrong

Code: Select all

function bool isAnOfficerPerk(X2AbilityTemplate AbTemplate, out int AbilityRank) 
{
	local int i;

	`LEBMSG("AbTemplate:" @ AbTemplate.Dataname);

	for (i = 0; i < class'LWOfficerUtilities'.default.OfficerAbilityTree.length; ++i)
	{
		If(class'LWOfficerUtilities'.default.OfficerAbilityTree[i].AbilityName == AbTemplate.Dataname) 
		{
		     AbilityRank = class'LWOfficerUtilities'.default.OfficerAbilityTree[i].Rank;
		    return true;
		}
	}

	AbilityRank = 0;
	return false;
}
Screenshot of the broken GTS:
http://images.akamai.steamusercontent.c ... 9D71AFC53/

Funny thing is: Justz the function being there is enough to break everything, I dont even need to call it/use it.
LeaderEnemyBoss
Posts: 106
Joined: Wed Jan 18, 2017 5:27 pm

Re: HELP: I want to check wether an Ability is an Officer Ability and the game breaks?

Post by LeaderEnemyBoss »

Small update: So the issue is definitely not on my side, i deleted configs, verified the cache etc.

What I also tried: Issueing a small innocent log command like:

Code: Select all

`LEBMSG("Officer?" @ class'LWOfficerUtilities'.static.IsOfficer(Unit));
also tried

Code: Select all

`LEBMSG("Officer?" @ class'LW_OfficerPack_Integrated.LWOfficerUtilities'.static.IsOfficer(Unit));
... leads to the same buggy result. Then i copied the functions "IsOfficer" and "GetOfficerComponent" into my own file, didnt improve the situation. It seems like as soon as I try to access any class of the officer pack stuff breaks. Maybe a loadorder issue? Funny enough is: log command itself works. It returns true for officers. It's just everything else related to officers thats broken. Maybe a pavonis dev can chime in?

As always: as soon as i remove the commands/functions referencing the officer pack, everything works fine.
Phantom
Posts: 31
Joined: Fri Jan 13, 2017 5:03 pm

Re: HELP: I want to check wether an Ability is an Officer Ability and the game breaks?

Post by Phantom »

Sry i can not help you with that, but i am interested in the solution. Did you fixed it?
LeaderEnemyBoss
Posts: 106
Joined: Wed Jan 18, 2017 5:27 pm

Re: HELP: I want to check wether an Ability is an Officer Ability and the game breaks?

Post by LeaderEnemyBoss »

Phantom wrote:Sry i can not help you with that, but i am interested in the solution. Did you fixed it?
No i wrote a dirty workaroudnd ... what i did notice is that referencing some of the officer classes in one of my testmods didnt break stuff. But so far i did no further investigations, under what circumstances stuff works.
LeaderEnemyBoss
Posts: 106
Joined: Wed Jan 18, 2017 5:27 pm

Re: HELP: I want to check wether an Ability is an Officer Ability and the game breaks?

Post by LeaderEnemyBoss »

Sooo this is a late update, but I think I know what the issue is. First things first: pavonis did nothing wrong! ;) I noticed occasional similar weird issues and sometimes got strange bug reports for my existing LW2 mods.

In the end it all seems to boil down to load order issues. The test version of my latest mod broke LW2s promotion screen and prevented loot from dropping (allthough my mod never even touches both of these). The cause: my testmod was stored locally, LW2 was stored in the workshop folder. Apparently local mods get loaded first, which sometimes breaks stuff in LW2. As soon as I uploaded my testmod, deleted the local version, and used the online version everything worked fine.

So the general rule of thumb seems to be: if you create a mod that accesses LW2's submods, LW2 NEEDS to load first.
Also: If you notice problems with any subscribed mod that needs LW2, try to unsubscribe the mod, start the game, delete your configs and resubscribe to the mod. This should ensure that it gets loaded after LW2.

EDIT:
Also accessing LW_OVERHAUL classes seems to work fine regardless of loadorder. I suspect this is because LW_OVERHAUL is the "main package" but all submods (toolbox, officerpack, etc.) require LW_OVERHAUL being loaded first.

EDIT2:
Want to know how you can control the loadorder of your local mods? Easy: change the mod folders name. Mods get loaded alphabetically depending on the name of the folder they reside in. However some mods require their mod folder name to be as expected or they wont work. LW2 is such a case, it's local mod folder NEEDS to be LW_Overhaul or the Highlander wont load. But for testing purposes i was able to rename my mods (which usually start with LEB and are therefore loaded before LW2) to something like ZLEB[modname] and it worked just fine.

EDIT3:
This is actually a larger issue and would explain a lot of bug reports I receive. All my local mod folders start with "LEB". If people use local copies of my mod, there will always be loadorder issues in conjunction with LW_Overhaul. Would be great if firaxis would implement a way to control loadorders for modcreators.
LeaderEnemyBoss
Posts: 106
Joined: Wed Jan 18, 2017 5:27 pm

Re: HELP: I want to check wether an Ability is an Officer Ability and the game breaks?

Post by LeaderEnemyBoss »

Small update:

I was wrong in one account: the order in which you subscribe to mods in the workshop doesnt seem to influence the loadorder. As with local mods, mods in the steam workshop folder get loaded alphanumerically. That means: As long as LW2 keeps its ID (which it should), any new mod that gets made nowadays is loaded after LW2 (which is good for mods depending on it). Problems only arise if:
  • For some reason the user uses a local copy of a mod depending on LW2 and a workshop version of LW2 (local copies get loaded first)
  • The default local folder name of a mod depending on LW2 is alphabetically "infront" of the LW_Overhaul folder (some user prefer local copies of mods, these user would experience problems in this case.
Zyxpsilon
Posts: 274
Joined: Fri Jan 20, 2017 1:26 am

Re: HELP: I want to check wether an Ability is an Officer Ability and the game breaks?

Post by Zyxpsilon »

LeaderEnemyBoss wrote: * For some reason the user uses a local copy of a mod depending on LW2 and a workshop version of LW2 (local copies get loaded first)
That is precisely my situation.. and i simply can't find what could be done to properly setup such a tricky Loading-Process while LW2 does its regular updates **BEFORE** i would even react with my own (necessary) corrections to qUIck_LW2 & other assets.

Oh well.. someday, somehow. ;)
Post Reply