Bertilsson Posted December 2, 2013 Share Posted December 2, 2013 (edited) Updated toolboks mod for Enemy Within Patch 1 MOD_NAME=Class probabilty mod for EW AUTHOR=Bertilsson DESCRIPTION=Allows custom percent based class probabilities when soldiers are promoted to squaddie rank. Version: 2.1 Compatible with XCOM Enemy Within Patch 1 UPK_FILE=XComStrategyGame.upk OFFSET=3544368 [MODDED_HEX] 4E 32 00 00 94 25 00 00 00 00 00 00 47 32 00 00 00 00 00 00 00 00 00 00 4E 32 00 00 00 00 00 00 6A 06 00 00 F0 B9 00 00 6E 01 00 00 17 01 00 00 0F 36 00 4C 32 00 00 2C 09 0F 10 2C 01 00 4C 32 00 00 92 2C 00 2C 19 16 0F 10 2C 02 00 4C 32 00 00 92 10 2C 01 00 4C 32 00 00 2C 19 16 0F 10 2C 03 00 4C 32 00 00 92 10 2C 02 00 4C 32 00 00 2C 19 16 0F 10 2C 04 00 4C 32 00 00 92 10 2C 03 00 4C 32 00 00 2C 19 16 0F 10 2C 05 00 4C 32 00 00 2C 64 0F 10 2C 06 00 4C 32 00 00 2C 64 0F 10 2C 07 00 4C 32 00 00 2C 64 0F 10 2C 08 00 4C 32 00 00 2C 64 0F 10 2C 00 00 4C 32 00 00 92 A7 10 2C 04 00 4C 32 00 00 16 2C 01 16 0F 00 4A 32 00 00 2C 01 07 60 01 96 00 4A 32 00 00 2C 05 16 07 52 01 98 10 2C 00 00 4C 32 00 00 10 00 4A 32 00 00 00 4C 32 00 00 16 07 4F 01 96 1B C5 12 00 00 00 00 00 00 38 3D 00 4A 32 00 00 16 10 92 00 4A 32 00 00 2C 04 16 00 4C 32 00 00 16 04 38 3D 00 4A 32 00 00 06 B3 00 A5 00 4A 32 00 00 16 06 DE 00 04 24 00 04 3A 4E 32 00 00 53 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 00 00 00 02 00 02 00 61 25 00 00 00 00 00 00 UPK_FILE=XComStrategyGame.upk OFFSET=3544438 [MODDED_HEX] {Change below hex value to modify probability percent for Sniper Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544459 [MODDED_HEX] {Change below hex value to modify probability percent for Heavy Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544480 [MODDED_HEX] {Change below hex value to modify probability percent for Support Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544501 [MODDED_HEX] {Change below hex value to modify probability percent for Assault Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544513 [MODDED_HEX] {Change below hex value to set max number of Snipers allowed in barracks - See bottom for conversion table} FF UPK_FILE=XComStrategyGame.upk OFFSET=3544524 [MODDED_HEX] {Change below hex value to set max number of Heavies allowed in barracks - See bottom for conversion table} FF UPK_FILE=XComStrategyGame.upk OFFSET=3544535 [MODDED_HEX] {Change below hex value to set max number of Supports allowed in barracks - See bottom for conversion table} FF UPK_FILE=XComStrategyGame.upk OFFSET=3544546 [MODDED_HEX] {Change below hex value to set max number of Assaults allowed in barracks - See bottom for conversion table} FF {Decimal to hexadecimal conversion table below 0 = 00 1 = 01 2 = 02 3 = 03 4 = 04 5 = 05 6 = 06 7 = 07 8 = 08 9 = 09 10 = 0A 11 = 0B 12 = 0C 13 = 0D 14 = 0E 15 = 0F 16 = 10 17 = 11 18 = 12 19 = 13 20 = 14 21 = 15 22 = 16 23 = 17 24 = 18 25 = 19 26 = 1A 27 = 1B 28 = 1C 29 = 1D 30 = 1E 31 = 1F 32 = 20 33 = 21 34 = 22 35 = 23 36 = 24 37 = 25 38 = 26 39 = 27 40 = 28 41 = 29 42 = 2A 43 = 2B 44 = 2C 45 = 2D 46 = 2E 47 = 2F 48 = 30 49 = 31 50 = 32 51 = 33 52 = 34 53 = 35 54 = 36 55 = 37 56 = 38 57 = 39 58 = 3A 59 = 3B 60 = 3C 61 = 3D 62 = 3E 63 = 3F 64 = 40 65 = 41 66 = 42 67 = 43 68 = 44 69 = 45 70 = 46 71 = 47 72 = 48 73 = 49 74 = 4A 75 = 4B 76 = 4C 77 = 4D 78 = 4E 79 = 4F 80 = 50 81 = 51 82 = 52 83 = 53 84 = 54 85 = 55 86 = 56 87 = 57 88 = 58 89 = 59 90 = 5A 91 = 5B 92 = 5C 93 = 5D 94 = 5E 95 = 5F 96 = 60 97 = 61 98 = 62 99 = 63 100= 64 255= FF } (The only thing needed to change was offsets += 573 decimal) Edited December 2, 2013 by Bertilsson Link to comment Share on other sites More sharing options...
GrimyBunyip Posted December 5, 2013 Share Posted December 5, 2013 Updated toolboks mod for Enemy Within Patch 1 MOD_NAME=Class probabilty mod for EW AUTHOR=Bertilsson DESCRIPTION=Allows custom percent based class probabilities when soldiers are promoted to squaddie rank. Version: 2.1 Compatible with XCOM Enemy Within Patch 1 UPK_FILE=XComStrategyGame.upk OFFSET=3544368 [MODDED_HEX] 4E 32 00 00 94 25 00 00 00 00 00 00 47 32 00 00 00 00 00 00 00 00 00 00 4E 32 00 00 00 00 00 00 6A 06 00 00 F0 B9 00 00 6E 01 00 00 17 01 00 00 0F 36 00 4C 32 00 00 2C 09 0F 10 2C 01 00 4C 32 00 00 92 2C 00 2C 19 16 0F 10 2C 02 00 4C 32 00 00 92 10 2C 01 00 4C 32 00 00 2C 19 16 0F 10 2C 03 00 4C 32 00 00 92 10 2C 02 00 4C 32 00 00 2C 19 16 0F 10 2C 04 00 4C 32 00 00 92 10 2C 03 00 4C 32 00 00 2C 19 16 0F 10 2C 05 00 4C 32 00 00 2C 64 0F 10 2C 06 00 4C 32 00 00 2C 64 0F 10 2C 07 00 4C 32 00 00 2C 64 0F 10 2C 08 00 4C 32 00 00 2C 64 0F 10 2C 00 00 4C 32 00 00 92 A7 10 2C 04 00 4C 32 00 00 16 2C 01 16 0F 00 4A 32 00 00 2C 01 07 60 01 96 00 4A 32 00 00 2C 05 16 07 52 01 98 10 2C 00 00 4C 32 00 00 10 00 4A 32 00 00 00 4C 32 00 00 16 07 4F 01 96 1B C5 12 00 00 00 00 00 00 38 3D 00 4A 32 00 00 16 10 92 00 4A 32 00 00 2C 04 16 00 4C 32 00 00 16 04 38 3D 00 4A 32 00 00 06 B3 00 A5 00 4A 32 00 00 16 06 DE 00 04 24 00 04 3A 4E 32 00 00 53 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 00 00 00 02 00 02 00 61 25 00 00 00 00 00 00 UPK_FILE=XComStrategyGame.upk OFFSET=3544438 [MODDED_HEX] {Change below hex value to modify probability percent for Sniper Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544459 [MODDED_HEX] {Change below hex value to modify probability percent for Heavy Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544480 [MODDED_HEX] {Change below hex value to modify probability percent for Support Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544501 [MODDED_HEX] {Change below hex value to modify probability percent for Assault Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544513 [MODDED_HEX] {Change below hex value to set max number of Snipers allowed in barracks - See bottom for conversion table} FF UPK_FILE=XComStrategyGame.upk OFFSET=3544524 [MODDED_HEX] {Change below hex value to set max number of Heavies allowed in barracks - See bottom for conversion table} FF UPK_FILE=XComStrategyGame.upk OFFSET=3544535 [MODDED_HEX] {Change below hex value to set max number of Supports allowed in barracks - See bottom for conversion table} FF UPK_FILE=XComStrategyGame.upk OFFSET=3544546 [MODDED_HEX] {Change below hex value to set max number of Assaults allowed in barracks - See bottom for conversion table} FF {Decimal to hexadecimal conversion table below 0 = 00 1 = 01 2 = 02 3 = 03 4 = 04 5 = 05 6 = 06 7 = 07 8 = 08 9 = 09 10 = 0A 11 = 0B 12 = 0C 13 = 0D 14 = 0E 15 = 0F 16 = 10 17 = 11 18 = 12 19 = 13 20 = 14 21 = 15 22 = 16 23 = 17 24 = 18 25 = 19 26 = 1A 27 = 1B 28 = 1C 29 = 1D 30 = 1E 31 = 1F 32 = 20 33 = 21 34 = 22 35 = 23 36 = 24 37 = 25 38 = 26 39 = 27 40 = 28 41 = 29 42 = 2A 43 = 2B 44 = 2C 45 = 2D 46 = 2E 47 = 2F 48 = 30 49 = 31 50 = 32 51 = 33 52 = 34 53 = 35 54 = 36 55 = 37 56 = 38 57 = 39 58 = 3A 59 = 3B 60 = 3C 61 = 3D 62 = 3E 63 = 3F 64 = 40 65 = 41 66 = 42 67 = 43 68 = 44 69 = 45 70 = 46 71 = 47 72 = 48 73 = 49 74 = 4A 75 = 4B 76 = 4C 77 = 4D 78 = 4E 79 = 4F 80 = 50 81 = 51 82 = 52 83 = 53 84 = 54 85 = 55 86 = 56 87 = 57 88 = 58 89 = 59 90 = 5A 91 = 5B 92 = 5C 93 = 5D 94 = 5E 95 = 5F 96 = 60 97 = 61 98 = 62 99 = 63 100= 64 255= FF } (The only thing needed to change was offsets += 573 decimal)Could you make a pseudorandom version like the one normally implemented in EW? The EW system first gives you 1 of each class.After that it creates a deck of 16 cards, 4 of each class. Discards 3 of them, and shuffles that deck of 13 cards. And those 13 cards make up your first 13 promotions. Just asking because my first playthrough with your mod, I got like 3 snipers and 1 assault after my first mission.Then like 4 more snipers after I promoted 8 rookies in march. Link to comment Share on other sites More sharing options...
Bertilsson Posted December 5, 2013 Share Posted December 5, 2013 Could you make a pseudorandom version like the one normally implemented in EW?The EW system first gives you 1 of each class.After that it creates a deck of 16 cards, 4 of each class. Discards 3 of them, and shuffles that deck of 13 cards. And those 13 cards make up your first 13 promotions. Just asking because my first playthrough with your mod, I got like 3 snipers and 1 assault after my first mission.Then like 4 more snipers after I promoted 8 rookies in march.I think that would pretty much defeat the purpose of the mod, and you already have the possibility to modify the EW standard "deck of cards", like for example 1 card each and only 1 random card removed, via ini-file. But just to make sure: You did recognize that the upper values represent probabilities and the bottom values max number of each class? If all classes had 25% chance each and you got 7 snipers out of a total of 8 it sounds like the probabilities are biased somehow and I probably need to run some more tests to verify that the random part of the mod is still working as it should. Link to comment Share on other sites More sharing options...
Hobbes77 Posted March 15, 2014 Share Posted March 15, 2014 Updated toolboks mod for Enemy Within Patch 1 MOD_NAME=Class probabilty mod for EW AUTHOR=Bertilsson DESCRIPTION=Allows custom percent based class probabilities when soldiers are promoted to squaddie rank. Version: 2.1 Compatible with XCOM Enemy Within Patch 1 UPK_FILE=XComStrategyGame.upk OFFSET=3544368 [MODDED_HEX] 4E 32 00 00 94 25 00 00 00 00 00 00 47 32 00 00 00 00 00 00 00 00 00 00 4E 32 00 00 00 00 00 00 6A 06 00 00 F0 B9 00 00 6E 01 00 00 17 01 00 00 0F 36 00 4C 32 00 00 2C 09 0F 10 2C 01 00 4C 32 00 00 92 2C 00 2C 19 16 0F 10 2C 02 00 4C 32 00 00 92 10 2C 01 00 4C 32 00 00 2C 19 16 0F 10 2C 03 00 4C 32 00 00 92 10 2C 02 00 4C 32 00 00 2C 19 16 0F 10 2C 04 00 4C 32 00 00 92 10 2C 03 00 4C 32 00 00 2C 19 16 0F 10 2C 05 00 4C 32 00 00 2C 64 0F 10 2C 06 00 4C 32 00 00 2C 64 0F 10 2C 07 00 4C 32 00 00 2C 64 0F 10 2C 08 00 4C 32 00 00 2C 64 0F 10 2C 00 00 4C 32 00 00 92 A7 10 2C 04 00 4C 32 00 00 16 2C 01 16 0F 00 4A 32 00 00 2C 01 07 60 01 96 00 4A 32 00 00 2C 05 16 07 52 01 98 10 2C 00 00 4C 32 00 00 10 00 4A 32 00 00 00 4C 32 00 00 16 07 4F 01 96 1B C5 12 00 00 00 00 00 00 38 3D 00 4A 32 00 00 16 10 92 00 4A 32 00 00 2C 04 16 00 4C 32 00 00 16 04 38 3D 00 4A 32 00 00 06 B3 00 A5 00 4A 32 00 00 16 06 DE 00 04 24 00 04 3A 4E 32 00 00 53 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 00 00 00 02 00 02 00 61 25 00 00 00 00 00 00 UPK_FILE=XComStrategyGame.upk OFFSET=3544438 [MODDED_HEX] {Change below hex value to modify probability percent for Sniper Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544459 [MODDED_HEX] {Change below hex value to modify probability percent for Heavy Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544480 [MODDED_HEX] {Change below hex value to modify probability percent for Support Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544501 [MODDED_HEX] {Change below hex value to modify probability percent for Assault Class - See bottom for conversion table} 19 UPK_FILE=XComStrategyGame.upk OFFSET=3544513 [MODDED_HEX] {Change below hex value to set max number of Snipers allowed in barracks - See bottom for conversion table} FF UPK_FILE=XComStrategyGame.upk OFFSET=3544524 [MODDED_HEX] {Change below hex value to set max number of Heavies allowed in barracks - See bottom for conversion table} FF UPK_FILE=XComStrategyGame.upk OFFSET=3544535 [MODDED_HEX] {Change below hex value to set max number of Supports allowed in barracks - See bottom for conversion table} FF UPK_FILE=XComStrategyGame.upk OFFSET=3544546 [MODDED_HEX] {Change below hex value to set max number of Assaults allowed in barracks - See bottom for conversion table} FF {Decimal to hexadecimal conversion table below 0 = 00 1 = 01 2 = 02 3 = 03 4 = 04 5 = 05 6 = 06 7 = 07 8 = 08 9 = 09 10 = 0A 11 = 0B 12 = 0C 13 = 0D 14 = 0E 15 = 0F 16 = 10 17 = 11 18 = 12 19 = 13 20 = 14 21 = 15 22 = 16 23 = 17 24 = 18 25 = 19 26 = 1A 27 = 1B 28 = 1C 29 = 1D 30 = 1E 31 = 1F 32 = 20 33 = 21 34 = 22 35 = 23 36 = 24 37 = 25 38 = 26 39 = 27 40 = 28 41 = 29 42 = 2A 43 = 2B 44 = 2C 45 = 2D 46 = 2E 47 = 2F 48 = 30 49 = 31 50 = 32 51 = 33 52 = 34 53 = 35 54 = 36 55 = 37 56 = 38 57 = 39 58 = 3A 59 = 3B 60 = 3C 61 = 3D 62 = 3E 63 = 3F 64 = 40 65 = 41 66 = 42 67 = 43 68 = 44 69 = 45 70 = 46 71 = 47 72 = 48 73 = 49 74 = 4A 75 = 4B 76 = 4C 77 = 4D 78 = 4E 79 = 4F 80 = 50 81 = 51 82 = 52 83 = 53 84 = 54 85 = 55 86 = 56 87 = 57 88 = 58 89 = 59 90 = 5A 91 = 5B 92 = 5C 93 = 5D 94 = 5E 95 = 5F 96 = 60 97 = 61 98 = 62 99 = 63 100= 64 255= FF } (The only thing needed to change was offsets += 573 decimal)Could you make a pseudorandom version like the one normally implemented in EW? The EW system first gives you 1 of each class.After that it creates a deck of 16 cards, 4 of each class. Discards 3 of them, and shuffles that deck of 13 cards. And those 13 cards make up your first 13 promotions. Just asking because my first playthrough with your mod, I got like 3 snipers and 1 assault after my first mission.Then like 4 more snipers after I promoted 8 rookies in march. I've just seen something that seems to indicate that there's something fishy going on with class assignment on vanilla EW, probably the latest patches broke something. Someone put a post on the 2K forums regarding getting only Snipers a couple of days ago. Then today, I got the first 4 promotions each of each class, but then the next 5 soldiers were all Supports. Link to comment Share on other sites More sharing options...
johnnylump Posted March 15, 2014 Share Posted March 15, 2014 We were seeing that in Long War and thinking it was something we did, but the code looked like it should be working. But no evidence the patches messed with this part of the code. Link to comment Share on other sites More sharing options...
wghost81 Posted March 15, 2014 Share Posted March 15, 2014 (edited) I've been trying to adjust class probability to my likings and finally got what I wanted. :smile: I made CreateClassWaitingList function to count for existing classes in barracks and adjust probability accordingly, so the more of the class X you have, the less probably you can get it for the next promotion. Uploaded it to "Interface and Gameplay Tweaks" mod. For anyone interested how it works: private final function CreateClassWaitingList() { local XGStrategySoldier I; local int J[5]; J[0] = 0; J[1] = 0; J[2] = 0; J[3] = 0; J[4] = 1; foreach m_arrSoldiers(I,) { if(INT(I.GetClass()) > 0 && INT(I.GetClass()) < 5) { ++ J[INT(I.GetClass()) - 1]; ++ J[4]; } } m_arrClassWaitingList.Length = 0; m_arrClassWaitingList.Add(4); m_arrClassWaitingList[0] = BYTE(J[4] - J[0] + 0); m_arrClassWaitingList[1] = BYTE(INT(m_arrClassWaitingList[0]) + J[4] - J[1] + 0); m_arrClassWaitingList[2] = BYTE(INT(m_arrClassWaitingList[1]) + J[4] - J[2] + 0); m_arrClassWaitingList[3] = BYTE(INT(m_arrClassWaitingList[2]) + J[4] - J[3] + 0); return; } +0 reserves the space for tweaking probabilities. function XComGame.XGTacticalGameCoreData.ESoldierClass PickAClass() { local XComGame.XGTacticalGameCoreData.ESoldierClass chosenClass; local int I; chosenClass = NeverGiven(); if(INT(chosenClass) != INT(0)) { return chosenClass; } CreateClassWaitingList(); I = Rand(INT(m_arrClassWaitingList[3])); if (I < INT(m_arrClassWaitingList[0])) return 1; // eSC_Sniper if (I < INT(m_arrClassWaitingList[1])) return 2; // eSC_HeavyWeapons if (I < INT(m_arrClassWaitingList[2])) return 3; // eSC_Support if (I < INT(m_arrClassWaitingList[3])) return 4; // eSC_Assault return 0; } Edited March 15, 2014 by wghost81 Link to comment Share on other sites More sharing options...
Recommended Posts