rilke1987 Posted November 30, 2013 Share Posted November 30, 2013 You defined a new variable? An you call yourself a newbie... Could you, please, elaborate on that? Let me see... 0F 00 7D 42 00 00 26 The hex code above is "I=1", and following is my whole hex code of function GetPodCharArray, Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F 00000000 17 43 00 00 76 5F 00 00 00 00 00 00 04 43 00 00 . C . . v _ . . . . . . . C . .00000010 00 00 00 00 00 00 00 00 0B 43 00 00 00 00 00 00 . . . . . . . . . C . . . . . .00000020 9F 03 00 00 58 7F 00 00 67 01 00 00 F4 00 00 00 . . . . X . . . g . . . . . . .00000030 07 50 00 97 38 3A 35 3D 00 00 00 3F 00 00 00 00 . P . . 8 : 5 = . . . ? . . . .00000040 00 48 0B 43 00 00 38 3A 24 00 16 55 00 08 43 00 . H . C . . 8 : $ . . U . . C .00000050 00 1D 00 35 3D 00 00 00 3F 00 00 00 00 00 48 0B . . . 5 = . . . ? . . . . . H .00000060 43 00 00 16 07 C9 00 97 38 3A 35 3C 00 00 00 3F C . . . . . . . 8 : 5 < . . . ?00000070 00 00 00 00 00 48 0B 43 00 00 38 3A 24 00 16 0F . . . . . H . C . . 8 : $ . . .00000080 00 7D 42 00 00 26 07 C9 00 98 00 7D 42 00 00 2C . } B . . & . . . . . } B . . ,00000090 03 16 55 00 08 43 00 00 AD 00 35 3C 00 00 00 3F . . U . . C . . . . 5 < . . . ?000000A0 00 00 00 00 00 48 0B 43 00 00 16 A3 00 7D 42 00 . . . . . H . C . . . . . } B .000000B0 00 16 06 82 00 07 53 01 97 38 3A 35 3B 00 00 00 . . . . . . S . . 8 : 5 ; . . .000000C0 3F 00 00 00 00 00 48 0B 43 00 00 38 3A 24 00 16 ? . . . . . H . C . . 8 : $ . .000000D0 0F 00 7D 42 00 00 26 07 53 01 98 00 7D 42 00 00 . . } B . . & . S . . . } B . .000000E0 2C 02 16 55 00 08 43 00 00 1D 00 35 3B 00 00 00 , . . U . . C . . . . 5 ; . . .000000F0 3F 00 00 00 00 00 48 0B 43 00 00 16 A3 00 7D 42 ? . . . . . H . C . . . . . } B00000100 00 00 16 06 FB 00 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B . . . . . . . . . . . . . . . .00000110 0B 0B 0B 0B 0B 0B 0B 04 00 08 43 00 00 04 3A 09 . . . . . . . . . . C . . . : .00000120 43 00 00 53 00 00 00 02 01 42 00 70 3A 00 00 00 C . . S . . . . . B . p : . . .00000130 00 00 00 . . . Sorry for urgly pasting since I'm not so familiar with the forum system since I'm a Chinese. Link to comment Share on other sites More sharing options...
rilke1987 Posted November 30, 2013 Share Posted November 30, 2013 And this is the scrip to the hex code above,where variable "I" has been used to control the number of alien support 1 and 2. simulated function array<XGGameData.ECharacter> GetPodCharArray(out TAlienPod kPod, out array<XGGameData.EItemType> arrAltWeapon){ local array<XGGameData.ECharacter> arrEnemies; // End:0x50 if(kPod.eMain > 0) { arrEnemies.AddItem(kPod.eMain); } // End:0xC9 if(kPod.eSupport1 > 0) { I = 1; J0x82: // End:0xC9 [Loop If] if(I <= 3) { arrEnemies.AddItem(kPod.eSupport1); ++ I; // [Loop Continue] goto J0x82; } } // End:0x153 if(kPod.eSupport2 > 0) { I = 1; J0xFB: // End:0x153 [Loop If] if(I <= 2) { arrEnemies.AddItem(kPod.eSupport2); ++ I; // [Loop Continue] goto J0xFB; } } return arrEnemies; return ReturnValue;} Link to comment Share on other sites More sharing options...
rilke1987 Posted November 30, 2013 Share Posted November 30, 2013 (edited) According to the code above, I guess it's easy to control the number of aliens by change the value of "I" around J0X82 and J0XFB, for example, if you want each pod of 6 enemies, then "I" should be 1 in both sections. And still there's some spare code which in hex is "0B", so I think it's possible to make more change but such as a random number but I=rand(3) for example. Edited November 30, 2013 by rilke1987 Link to comment Share on other sites More sharing options...
wghost81 Posted November 30, 2013 Share Posted November 30, 2013 (edited) double-post... forum is glitching today... :sad: Edited November 30, 2013 by wghost81 Link to comment Share on other sites More sharing options...
wghost81 Posted November 30, 2013 Share Posted November 30, 2013 You haven't defined a new variable, you just "borrowed" it from other function: XComAlienPodManager.GetPodByName.I Technically, you can borrow variables from other functions, but you have to be sure you don't overwriting anything. So, using AltWeapon field is better, because you can be sure no other functions uses it. For more info see this thread: http://forums.nexusmods.com/index.php?/topic/993254-stealing-local-variables-from-other-functions/ Link to comment Share on other sites More sharing options...
Amineri Posted November 30, 2013 Author Share Posted November 30, 2013 (edited) Okay I think I understand now... Yes, it's possible to re-use local variable from other functions. However such variables cannot be used to pass data between functions. It is possible to hard-code in a specific larger number of aliens as you have done. My reason for using the altWeapon fields is to allow the determination of number of aliens/pod in the Strategy game section. Alien squad composition is all figured out in the XGStrategyAI.Determine<type>Squad functions. This is the point where various factors are known, such as the type of mission, whole alien squad composition, etc. So, I think it makes sense to define the pod size here and pass the information to the tactical game. Long War for example has an alien-research mechanic that controls the size of the pods. Edited November 30, 2013 by Amineri Link to comment Share on other sites More sharing options...
rilke1987 Posted November 30, 2013 Share Posted November 30, 2013 I just checked and Enemy Within hasn't made any changes to the 3 functions (at the unrealscript level) I modded in EU to handle the tactical side of increasing the maximum pod size. Of course the hex itself has changed because of the larger namelist/objectlist, so this will be one of my test cases uses my in-development tool to update. Another factor is that I had used the XGUnit class variable m_iSmokeGrenades to pass the leader level for leader customization, but now some Exalt units use that variable, so that will have to be reworked. I'm also curious about the "define a new variable thing" ^_^ I just checked and Enemy Within hasn't made any changes to the 3 functions (at the unrealscript level) I modded in EU to handle the tactical side of increasing the maximum pod size. Of course the hex itself has changed because of the larger namelist/objectlist, so this will be one of my test cases uses my in-development tool to update. Another factor is that I had used the XGUnit class variable m_iSmokeGrenades to pass the leader level for leader customization, but now some Exalt units use that variable, so that will have to be reworked. I'm also curious about the "define a new variable thing" ^_^ Ehhh....Now I'm not sure if I've a clear enough expression since truly rarely I post something in a English forum and most of my English is coming from games, moives and TV Shows.... I just checked some other functions and found a temp variable "I" has been often used to acheive some purposes like up limit or count of a foreach etc. So I thought why couldn't I just use the same temp variable since it would be never called by other funtion otherwhere for that they're temp.... Then I check the function GetPodByName by UE and found the index of local variable I is 17021(in hex 7D 42) and so be it. So....sorry...I guess it's now a "new" variable but I think sucn a way is better than to use a widely called variable or constant... I Link to comment Share on other sites More sharing options...
wghost81 Posted November 30, 2013 Share Posted November 30, 2013 (edited) There are at least two mods, which implement Larger Pods: http://xcom.nexusmods.com/mods/88 http://xcom.nexusmods.com/mods/404 You can study UPKs from those and see how Larger Pods are implemented in game. You see, as Amineri said, number of aliens per pod is not a local temp variable, it is set in some other functions (and even in other UPK) and passed to GetPodCharArray via AltWeapon field. You are defining pod size inside GetPodCharArray as local variable, so in your case pod size will be fixed: you'll always get pods of that size on any maps in any cases. And that's not good enough. Edited November 30, 2013 by wghost81 Link to comment Share on other sites More sharing options...
rilke1987 Posted November 30, 2013 Share Posted November 30, 2013 Okay I think I understand now... Yes, it's possible to re-use local variable from other functions. However such variables cannot be used to pass data between functions. It is possible to hard-code in a specific larger number of aliens as you have done. My reason for using the altWeapon fields is to allow the determination of number of aliens/pod in the Strategy game section. Alien squad composition is all figured out in the XGStrategyAI.Determine<type>Squad functions. This is the point where various factors are known, such as the type of mission, whole alien squad composition, etc. So, I think it makes sense to define the pod size here and pass the information to the tactical game. Long War for example has an alien-research mechanic that controls the size of the pods. Yes, and I've checked the XGStrategyAI.Determine<type>Squad functions and you're right. To be honest the first idea I increased the number of aliens is just to make the game more suitable for players like me who modified the DGC.INI...And untill a week ago I knew nothing about hex code edit of the game... It's this article which provided me a good sample for learning and now I think I could try something more complicated. Thanks guys and again I'm a newbie who might raise some silly question... Link to comment Share on other sites More sharing options...
wghost81 Posted November 30, 2013 Share Posted November 30, 2013 In fact, I started to work on Larger Alien Pods Mod adaptation for EW. So you may just wait for release. :smile: But, anyway, digging into the code is good for self-education. :smile: Link to comment Share on other sites More sharing options...
Recommended Posts