Modding Soldier's Ranks

Please post here for questions and discussion about general game modding
Post Reply
Alzikar
Posts: 2
Joined: Sun Jun 17, 2007 7:22 pm

Modding Soldier's Ranks

Post by Alzikar »

I would post this help request at http://www.ufo-extraterrestrials.com/
however, I registered an account there, but did not receive an activation e-mail from the forum administrators. :(

At any rate, I'm working on implementing 15 soldier ranks instead of the default 12.

I extracted system.xbg and geoscape.xbg using Xbig extractor v101. which I d/l from
Activating_Modifications

Once extracted, I edited the following files as such:

ResourceBundle.dat
SOLDIER_RANK1=Recruit
SOLDIER_RANK2=Private
SOLDIER_RANK3=Private first class
SOLDIER_RANK4=Corporal
SOLDIER_RANK5=Lance Corporal
SOLDIER_RANK6=Sergeant
SOLDIER_RANK7=Sergeant first class
SOLDIER_RANK8=1st Sergeant
SOLDIER_RANK9=Sergeant Major
SOLDIER_RANK10=2nd Lieutenant
SOLDIER_RANK11=1st Lieutenant
SOLDIER_RANK12=Captain
SOLDIER_RANK13=Major
SOLDIER_RANK14=Lt. Colonel
SOLDIER_RANK15=Colonel

rpgValues.config
levels
{
className CVector
0 15 //Recruit 15
1 35 //Private 37
2 65 //Private 1st Class 49
3 115 //Corporal 66
4 170 //Lance Corporal 91
5 260 //Sergeant 129
6 530 //Sergeant First Class 196
7 850 //1st Sergeant 271
8 1325 //Sergeant Major 399
9 1850 //2nd Lt.
10 2450 //1st. Lt.
11 3125 //Captain
12 3850 //Major
13 4500 //Lt. Colonel 592
14 5200 //Colonel 880
}


Mission.xscr
checkPromotion(unit) {
if (unit.typeName != "MissionHumanUnit" && (!unit.hasProperty("unitTypeID") || unit.unitTypeID != "human")) return false;
if (unit.rank == 15) return false;
object rpgValues = getGlobalVariable( "rpgValues");
int levelExperience = rpgValues.levels.get(unit.rank-1);
return (unit.experience >= levelExperience);
}


++and++

("DIALOG_MISSION_RESULTS_PROMOTED_LINE", unit.name), "arial11.xfn", NORMAL_FONT_SIZE, x1, promotedY + (space * count));
label1.setColor(0xffffffff);
object label2 = fsd.createLabel("promoted2" + i, rankName, "arial11.xfn", NORMAL_FONT_SIZE, label1.getPosition().x + label1.getTextWidth() + 6, promotedY + (space * count));
label2.setColor(0xffDBD795);
count++;
if (count > 15)
break;

---------------
Also, I added 3 new *.tga graphic files for the new ranks in the \\data\gui.new\ranks folder

named as:
rank13.tga
rank14.tga
rank15.tga

--------------
Everything worked beautifully up till Captain rank. The rank names showed up properly in the UI and the soldier was promoted at the experience values I specified.

The problem now is after the soldier receives 3850 experience, he's getting a promotion after every mission, but his new rank (which should be Major) is not registering properly. The game still shows him to be Captain and the next mission end he gets another promotion again. This process repeats until eventually the game is frozen in the promotion screen because "not all the points have been spent."

What have I missed in order to get the game to register and remember his rank promotion past rank 12 and to utilize the new rank graphics files I added?

Many thanks,
Alz


Alzikar
Posts: 2
Joined: Sun Jun 17, 2007 7:22 pm

RE: Modding Soldier's Ranks

Post by Alzikar »

Okay, I found something else which appears to be the indexing code responsible for increasing a soldier's rank by 1, if he has enough experience:

PromotionDialog.xscr

&nbsp;&nbsp;&nbsp; for (int i = 0; i < soldiers.size(); i++) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (soldiers.get( i ).rank < 15) soldiers.get( i ).rank += 1;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PromotionFormCreateSoldierButton( i );
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; promotionValues.add( makeListCopy(values) );


After making the above change, the game now crashes when I click on the soldier in the promotion screen with the following crash info:

[00:17:09.226] Error from frame call Invalid index 12 used while getting from vector(12)
[00:17:09.226]&nbsp;&nbsp;&nbsp;&nbsp; showMissionResults (globe\mission.xscr 210:70)
&nbsp;&nbsp;&nbsp; showMissionResults (globe\mission.xscr 210:60)
&nbsp;&nbsp;&nbsp; leaveMission (man.xscr 1105:27)
&nbsp;&nbsp;&nbsp; startComputerTurn (turnmanager.xscr 497:25)
&nbsp;&nbsp;&nbsp; endTurnOnClick (gui.xscr 1481:26)
&nbsp;&nbsp;&nbsp; handleInput (man.xscr 2175:29)

[00:17:23.450] Invalid index 12 used while getting from vector(12)
[00:17:23.450]&nbsp;&nbsp;&nbsp;&nbsp; PromotionFormShowUnit (globe\promotiondialog.xscr 193:51)
&nbsp;&nbsp;&nbsp; PromotionFormUnitButtonOnClick (globe\promotiondialog.xscr 340:26)

[00:17:23.450] Int values:1
Float values:4
String values:4
Bool values:2
Object values:2
List values:1
Null values:2

-------------

Any ideas?&nbsp;
GalacticOrigins
Posts: 220
Joined: Thu Mar 22, 2007 2:46 am
Location: Wolf 359

RE: Modding Soldier's Ranks

Post by GalacticOrigins »

If you change the rank numbers, you might run into a problem with some soldiers. The game will stop running if you cannot spend all of a soldier's Skill Points. If all skills are maximized, the game screen will not continue, since you must spend all Skill Points when a soldier is promoted. Therefore, unless you can get around this, there might be a problem.
Shaker
Posts: 8
Joined: Mon Jul 09, 2007 6:30 pm

RE: Modding Soldier's Ranks

Post by Shaker »

Alzikar,
I am having trouble installing the xbig extractor. Would you mind posting the values for the original 12 ranks?

Thanks
Shaker
Post Reply

Return to “Mods and Tweaks”