traenol Posted March 5, 2016 Share Posted March 5, 2016 (edited) I also found where the function CreateLootDrop is used and tried overriding there. No luck either. Are there some functions that can't be overridden? or am I doing this the wrong way? Please help static function CreateLootDrop(XComGameState NewGameState, const out array<XComGameState_Item> LootItems, Lootable LootSource, bool bExpireLoot) This is a static function, and as such cannot be overridden. The class is native, and also cannot be overridden. There is a thread regarding building a custom cooked files to replace the base game functionality that will allow us to modify things like this ... but they will be mods that are basically 'highlander'(there can be only one). Something I have been pondering over is working on a full rewrite of the base code that we can change to expose as many static and hard coded data points as possible so modders have a common base they can use as a dependency for their mod to work. This however is a major undertaking and will most likely take months to complete(if myself or someone else decides to do it). Edit- Apparently my c++ knowledge of the way inheritance works is not completely valid for unrealscript. I have no idea what the rules are for it at this point without going deeper into the unrealscript, which will take time I guess. Edited March 5, 2016 by traenol Link to comment Share on other sites More sharing options...
davidlallen Posted March 5, 2016 Share Posted March 5, 2016 I think there are a number of intermediate level people all struggling with the details of uc, including myself. One thing I have learned is that if you are extending a class, you must keep the same config and dependson as the original, or the game will ignore your extension. Furthermore, if there is a class which is declared native(core), then you probably have to "cook" in order to extend the class, which is generally way too much trouble to be worth it. See the pinned resource thread for a guide about cooking. Since XComGameState_LootDrop has native(core), this may not be a good approach. Unfortunately the callers that I found for CreateLootDrop are also native(core). To me, this doesn't seem like such a built-in thing to be native(core), but what do I know really. :sad: There are a few mods at steam workshop that deal with loot; maybe one of them has a lead? Many of them may just be ini file mods, without any uc at all. Link to comment Share on other sites More sharing options...
Amineri Posted March 5, 2016 Share Posted March 5, 2016 One thing I have learned is that if you are extending a class, you must keep the same config and dependson as the original, or the game will ignore your extension. I don't think that this is true at all, at least it hasn't been in my experience. As an example, in the LW_OfficerPack mod, I define a class : class X2Ability_OfficerAbilitySet extends X2Ability config (LW_OfficerPack); The class this is extending is : class X2Ability extends X2DataSet config(GameCore) native(Core) dependson(XComGameStateContext_Ability); And it works just fine, with me :Changing the config from GameCore to LW_OfficerPack Removing the native(Core) parameter Removing the dependson(XComGameStateContext_Ability) parameterIn the first case, the new Config parameter only applies to new config variable defined in the extended class, not to any config variables defined in the parent class, which still draw from GameCore. So in my X2Ability_OfficerAbilitySet class, I define : var config float BaseCommandRange; and this variable is configured in the XComLW_OfficerPack.ini. However, in the parent X2Ability class, the variable : var private const config float MaxProjectileMissOffset_Standard; still draws from the DefaultGameCore.ini / XComGameCore.ini config files. -------- On the second point, I don't need to have the native(Core) parameter, because none of my functions are native (that is, none of them get routed to execute within XCom2.exe). In the X2Ability class, however, there is : //This method generates a miss location that attempts avoid hitting other units, obstacles near to the shooter, etc. native static function Vector FindOptimalMissLocation(XComGameStateContext AbilityContext, bool bDebug); Therefore it needs the native(Core) parameter. Note that I could override this native function with a non-native version (which can even call the native super) without problem, and without adding the native parameter to my class override definition. The syntax would look like : //This overrides a native function with an unrealscript one static function Vector FindOptimalMissLocation(XComGameStateContext AbilityContext, bool bDebug){ { Vector ReturnVec; ReturnVec = super.FindOptimalMissLocation(AbilityContext, bDebug); // Do stuff you want to do here return ReturnVec; } ----------------- On the third point, I don't need a dependson parameter, because the function being depended on is in XComGame, which is automatically built before my mod is built, so the build order is already guaranteed. You really only need to use dependson within your own mods, if one class defines an enum or struct that another class in your mod uses. Using dependson guarantees that one is built before the other, so that the enum/struct entries are added to the compile tables. Link to comment Share on other sites More sharing options...
RCSub Posted March 6, 2016 Author Share Posted March 6, 2016 By overriding the X2Action_lootDropMarker class, I am now able to extend the timer. But there is one problem, by increasing the TimedLootPerMission ini parameter to more than 2, tehre is sometimes more than 1 loot spot (which is fine), but the number on each of them is always the same. The individual loot is still correctly removed when it's timer runs out, but the shown timer is wrong unless the loot times out at the same time. Link to comment Share on other sites More sharing options...
davidlallen Posted March 6, 2016 Share Posted March 6, 2016 Interesting. I bet that is a bug in the base game, which never was detected because there are so rarely two loot drops from the same fight. Link to comment Share on other sites More sharing options...
quarelin Posted January 21, 2017 Share Posted January 21, 2017 Sorry for necro-ing the topic but i came with an alternate solution to the loot timer.In DefaultGameCore.ini there is a line :LOOT_RANGE=192 (seems to be the distance you have to be from the loot to pick it up)Depending on much you increase that number , you can basically pick the loot from across the map . Link to comment Share on other sites More sharing options...
Oakenbrain Posted January 24, 2017 Share Posted January 24, 2017 Nercoing, but... I found where problem is. This function uses local object of same class here: local XComGameState_LootDrop LootDrop; and here, even with casting: LootDrop = XComGameState_LootDrop(NewGameState.CreateStateObject(class'XComGameState_LootDrop')); So, when overriding, it should be local XComGameState_Mod_LootDrop LootDrop; and LootDrop = XComGameState_Mod_LootDrop(NewGameState.CreateStateObject(class'XComGameState_Mod_LootDrop')); to work. Workes fine for me. Link to comment Share on other sites More sharing options...
Recommended Posts