wghost81 Posted September 6, 2014 Author Share Posted September 6, 2014 (edited) I've started with Player, but XCom player is a cursor. :smile: It has no inventory and can't pickup items. :smile: We can make mutators 'tick', as DLC mods do, but then they'll be no different from Mod objects. We can try to start thinking of situations we potentially like to mod with mutators and inject additional function calls into relevant code. For example, if we want to replace XGAIBehavior subclasses, we could modify XGAIPlayer.GetBehaviorClass function:simulated function class<XGAIBehavior> GetBehaviorClass(XGGameData.EPawnType eAlienType) { return class'Engine'.static.GetCurrentWorldInfo().Game.BaseMutator.CheckAIReplacement(AlienTypeToBehaviorClass(eAlienType)); } We should also create our own base XComMutator class, which will handle all common XCom specific operations (like UTMutator handles UT specific operations):class XComMutator extends Mutator; function class<XGAIBehavior> CheckAIReplacement(class<XGAIBehavior> Other) { local class<XGAIBehavior> Result; if (XComMutator(NextMutator) != None) Result = XComMutator(NextMutator).CheckAIReplacement(Other); if (Result == none) Result = Other; return Result; } Edited September 6, 2014 by wghost81 Link to comment Share on other sites More sharing options...
wghost81 Posted September 11, 2014 Author Share Posted September 11, 2014 After initial disappointment I decided to return to Mutators R&D. That's what I found so far. I've subclasses Engine Mutator class with XComMutator to fit our needs and decided to "mutate" PostLevelLoaded function to allow for post-loading map modifications. I was unable to add my code to base function XGBattle.PostLevelLoaded. Although XGBattle_SP.PostLevelLoaded calls for super.PostLevelLoaded, my code is simply ignored. XGBattle_SP.PostLevelLoaded accepted my code, but I was unable to "smuggle" new XComMutator.PostLevelLoading function into XComGame.upk package by adding new Import Entries: game crashed while trying to execute my code. But I was able to call for Mutator.Mutate function by adding missing "Mutate" name to NameTable. Since Mutate has two arguments: string and PlayerController reference, I've passed "XGBattle_SP.PostLevelLoaded" string to Mutate call and re-wrote XComMutator.Mutate as function Mutate(string MutateString, PlayerController Sender) { if (MutateString == "XGBattle_SP.PostLevelLoaded") { PostLevelLoaded(Sender); } super.Mutate(MutateString, Sender); } simulated function PostLevelLoaded(PlayerController Sender) { if ( XComMutator(NextMutator) != None ) XComMutator(NextMutator).PostLevelLoaded(Sender); } Then I subclasses XComMutator with new XComLZMutator class: class XComLZMutator extends XComMutator; simulated function PostLevelLoaded(PlayerController Sender) { `Log("XComLZMutator: PostLevelLoaded"); } After running the game log file showed [0016.53] ScriptLog: XComLZMutator: PostLevelLoaded line. To enable `Log macro I used DEBUG compiler switch: UDK.exe make -DEBUG Finally, some debugging possibility opened. :smile: BTW, UEExplorer decompiles this macro as LogInternal("XComLZMutator: PostLevelLoaded"); But tokens view has three lines: (000/000) [41 64 00 00 00 42 00 00 00 A3 05 00 00 20] DI(14/14) (00E/00E) [E7 1F 58 43 6F 6D 4C 5A 4D 75 74 61 74 6F 72 3A 20 50 6F 73 74 4C 65 76 65 6C 4C 6F 61 64 65 64 00 4A 16 41 64 00 00 00 42 00 00 00 D0 05 00 00 40] NF(49/49) -> SC(32/32) -> NP(1/1) -> EFP(1/1) LogInternal("XComLZMutator: PostLevelLoaded") (031/031) [41 64 00 00 00 42 00 00 00 D0 05 00 00 40] DI(14/14) Link to comment Share on other sites More sharing options...
wghost81 Posted September 11, 2014 Author Share Posted September 11, 2014 And another bit of good news: I was able to add entirely new config file and initialize my new Mutator subclass with it: [0012.95] ScriptLog: XComLZMutator: PostLevelLoaded [0012.95] ScriptLog: XComLZMutator: LZArray.Length = 2 [0012.95] ScriptLog: XComLZMutator: Data.MapName = URB_Bar [0012.95] ScriptLog: XComLZMutator: Data.MapName = EWI_MeldTutorial Link to comment Share on other sites More sharing options...
dubiousintent Posted September 12, 2014 Share Posted September 12, 2014 Splendid progress. As usual, you have to bootstrap everything for yourself because Firaxis didn't implement support. But at least they left you a hook to get started from. Such a pain to have to re-invent the wheel. But I bet you're learning tons. -Dubious- Link to comment Share on other sites More sharing options...
wghost81 Posted September 12, 2014 Author Share Posted September 12, 2014 Yes, I've learned a lot in a past few days. :smile: So, I was able to make random LZ mod using mutators. I'm still polishing the code to automatically rotate LZ and camera, but the core part is already working. I will make an "XCOM Mutators starter kit" and write an instructions on how to start modding XCOM with mutators after LZ mod will be finished. Link to comment Share on other sites More sharing options...
wghost81 Posted September 12, 2014 Author Share Posted September 12, 2014 (edited) I have a legal rights question. Since UDK XCOM scripting requires at least dummy XCOM uc sources to be created, anyone who wants to make his own XCOM mutator, will need those files. To make things easier, we could share those dummy files via github, for example, for anyone to use and update. But do we have a right to publish XCOM content? If it's not an exact content, but non-functional script sources, obtained from the original XCOM resources by decompiling and manual editing? I think it's time to ask Firaxis for those files. :smile: UT unrealscript sources are public. Those files are needed by any coder to make his own mutators to the UT game. XCOM will require the same thing. Those files can be original Firaxis sources or dummy files re-created by the community. First option is certainly better. :smile: Edited September 12, 2014 by wghost81 Link to comment Share on other sites More sharing options...
amanasleep Posted September 12, 2014 Share Posted September 12, 2014 I have a legal rights question. Since UDK XCOM scripting requires at least dummy XCOM uc sources to be created, anyone who wants to make his own XCOM mutator, will need those files. To make things easier, we could share those dummy files via github, for example, for anyone to use and update. But do we have a right to publish XCOM content? If it's not an exact content, but non-functional script sources, obtained from the original XCOM resources by decompiling and manual editing? I think it's time to ask Firaxis for those files. :smile: UT unrealscript sources are public. Those files are needed by any coder to make his own mutators to the UT game. XCOM will require the same thing. Those files can be original Firaxis sources or dummy files re-created by the community. First option is certainly better. :smile: This dialogue could be started with a Direct Message through Twitter to Jake Solomon. I think a direct request from Johnnylump in particular would be considered seriously. Link to comment Share on other sites More sharing options...
wghost81 Posted September 12, 2014 Author Share Posted September 12, 2014 (edited) Somehow I seriously doubt that Firaxis will let us have even unrealscript sources. But I'm interested if we could share dummy scripts within the community without their lawyers coming at us. :smile: I don't have twitter account, but here is a message for Jake Solomon: "We found a way to use Unreal Engine mutators mechanism to insert our mods into the game. We also found a way to use UDK make comandlet to compile XCOM scripts and make our own script packages. But to do so, we'll need either actual unrealscript XCOM sources (.uc) or dummy non-functional scripts we can create using decompiled resources. Question is: can we legally share those with community via github? Can we hope Firaxis will let us have actual .uc source files someday?" Edited September 12, 2014 by wghost81 Link to comment Share on other sites More sharing options...
Krazyguy75 Posted September 12, 2014 Share Posted September 12, 2014 Somehow I seriously doubt that Firaxis will let us have even unrealscript sources. But I'm interested if we could share dummy scripts within the community without their lawyers coming at us. :smile: I don't have twitter account, but here is a message for Jake Solomon:"We found a way to use Unreal Engine mutators mechanism to insert our mods into the game. We also found a way to use UDK make comandlet to compile XCOM scripts and make our own script packages. But to do so, we'll need either actual unrealscript XCOM sources (.uc) or dummy non-functional scripts we can create using decompiled resources. Question is: can we legally share those with community via github? Can we hope Firaxis will let us have actual .uc source files someday?" Too long for twitter :| I'll try to paraphrase. Link to comment Share on other sites More sharing options...
dubiousintent Posted September 12, 2014 Share Posted September 12, 2014 Definitely worth the attempt. Soloman in particular has been very publicly supportive of the modding community. It's when the lawyers' get involved that things get "uncomfortable". Never hurts to ask and get the official position on record in a murky situation like this. -Dubious- Link to comment Share on other sites More sharing options...
Recommended Posts