Jump to content

Modding details? Ask away!


Amineri

Recommended Posts

I have a shamefully basic question, but is there any way to see either an API database representation of the game's base classes or at least have a look at the source code? The ExampleWeapon example shows a lot of interdependent functionality without explaining what any of the functions do, or what other functions or templates might be called, or where to find them.

 

Let's say, for instance, that I want to change what Death From Above does fundamentally, say to what Damn Good Ground used to do back in the day. Clearly that's not going to work with just ini file editing, but I haven't the foggiest which classes I'm supposed to look at, how they work or even how to override an existing skill rather than adding a new one.

Source files are individually accessible in SDK > Development > Src > XComGame > Classes

 

You can also make a new "default project" in modbuddy, which will create a (large) folder with all the classes that so you can search the entire project for keywords.

Link to comment
Share on other sites

  • Replies 399
  • Created
  • Last Reply

Top Posters In This Topic

So I found out - Kelly is generated by TutorialSoldierAppearance which is set in XComGameData.ini (each body part separately) so I think she is not taken directly from character pool.

In theory I can create new array and then create soldier from that.

 

 

But I still have questions about scripts. Why does this script (I tool it from Load character pool) works for this mod but when I try to compile it project can't be built?

static event OnLoadedSavedGame()
{

    local CharacterPoolManager pool;
    local XComGameState_Unit poolUnit;
    local TDialogueBoxData kDialogData;
    local String dialogueText;
    local String dialogueTitle;

    dialogueText = "Test message";
    dialogueTitle = "Test message from Tomm";



    kDialogData.eType = eDialog_Normal;
    kDialogData.strTitle = dialogueTitle;
    kDialogData.strText = dialogueText;
    kDialogData.strAccept = "OK";
    Menu.Movie.Pres.UIRaiseDialog(kDialogData);
}

The problem is in last line - Menu.Movie.Pres.UIRaiseDialog(kDialogData); . It initiates message box, doesn't it?

I can't believe SDK doesn't have a script checker which tells me what line is wrong/

 

 

Link to comment
Share on other sites

Looking to create an XCOM time-attack mode, where you get a certain amount of minutes for each turn or possibly the whole mission + time for each move, like a chess clock.

 

Any pointers to how to structure this overall? Need to update a timer on screen every second, have to end the players turn if they run out of time, add time to the timer when a soldiers finishes moving. I wonder if it would be possible to enable the mulitplayer timer.

Link to comment
Share on other sites

Source files are individually accessible in SDK > Development > Src > XComGame > Classes

 

You can also make a new "default project" in modbuddy, which will create a (large) folder with all the classes that so you can search the entire project for keywords.

 

Aha! OK, I found the source code, thank you very much. It's very daunting the way everything is interconnected, but also strangely... Logical in the way everything is laid out. I found Death From Above itself, and it seems to be an extension of a conditional "proc" event with a single method in it which checks for more things than I expected it would need to. If I want to change that, I'll need to somehow override the template creation method for the Death From Above skill to do something else, which brings up another shameful question:

 

I don't actually know what language the ue files are written in. It looks like C#, some of the documentation mentions C++ but my primary programming experience is in neither - it's mostly Perl and Java. I can sort of read the code, but a few things confound me, such as the use of `HISTORY (I don't know what the ` operator means) and class constructors for each specific class. Clearly there have to be constructors and I've seen what I presume to be constructor calls (basically a method by the name of the class), but I've not seen what I can recognise as a constructor defined in the classes themselves.

 

The practice of including every single XcomGame class in user-created mods makes it very difficult to tell what other people have changed, if anything at all, since it's buried in the mountain of unaltered code from the base game. I know that's done for sake of being able to reference classes within the mod without worrying about file paths so I'm not complaining, it's just a little confusing, is all.

Link to comment
Share on other sites

 

Source files are individually accessible in SDK > Development > Src > XComGame > Classes

 

You can also make a new "default project" in modbuddy, which will create a (large) folder with all the classes that so you can search the entire project for keywords.

 

Aha! OK, I found the source code, thank you very much. It's very daunting the way everything is interconnected, but also strangely... Logical in the way everything is laid out. I found Death From Above itself, and it seems to be an extension of a conditional "proc" event with a single method in it which checks for more things than I expected it would need to. If I want to change that, I'll need to somehow override the template creation method for the Death From Above skill to do something else, which brings up another shameful question:

 

I don't actually know what language the ue files are written in. It looks like C#, some of the documentation mentions C++ but my primary programming experience is in neither - it's mostly Perl and Java. I can sort of read the code, but a few things confound me, such as the use of `HISTORY (I don't know what the ` operator means) and class constructors for each specific class. Clearly there have to be constructors and I've seen what I presume to be constructor calls (basically a method by the name of the class), but I've not seen what I can recognise as a constructor defined in the classes themselves.

 

The practice of including every single XcomGame class in user-created mods makes it very difficult to tell what other people have changed, if anything at all, since it's buried in the mountain of unaltered code from the base game. I know that's done for sake of being able to reference classes within the mod without worrying about file paths so I'm not complaining, it's just a little confusing, is all.

 

It's unrealscript. I didn't know anything about it either, just mimicked the syntax and structure of existing code.

 

The src > XComGame > Classes folder is marked as read-only and just for your reference, not actually part of the project. Classes you make for the project go in src > [mod name] > classes. Check the "Example Class Override" project for an example.

Link to comment
Share on other sites

 

I'm currently working on an alternative health display and this is what I've got right now.

<snip>

I'm having some problems getting the text to behave quite how I'd like it to. I can use UIText.SetTitle to get large text or I can use UIText.SetCenteredText to center the text, but I haven't found a way to do both at once.

 

Is there some way to freely style UIText or some other text related class I should be using instead?

 

 

You can use the class'UIUtilities_Text' static methods to apply html styling to your text. You can also nest them in order to add more tags (i.e. set title font/size as well as add centered html tags). Of course you can always add the html tags yourself, if you want :smile:.

 

After that, it's a matter if using the inherited UIPanel controls (SetPosition, SetX, SetY) to position it accordingly. The position is relative to the how you create your UIIcon or UIText object in the InitPanel(...) or InitText(...) method.

 

 

Oh, I see.

 

Can I use inline CSS in the HTML tags? I added a slightly offset, black, copy of the text to act as drop shadows. It'd be convenient if I could use CSS text-shadow instead.

Link to comment
Share on other sites

 

It's unrealscript. I didn't know anything about it either, just mimicked the syntax and structure of existing code.

 

Aha! OK, that would explain why it's so unfamiliar to me. I've done C++ back in the university and C# for Space Engineers Coding Blocks, but this looks like neither of those. "Unrealscript." That puts a name on the enemy and gives me something to work with. Thank you kindly :smile:

 

*edit*

And for the record, a token search now that I know what I'm searching for revealed that the ` is a "preprocessor" used to define code macros - simplifications to the extended into full code before compilations. The one that was really stumping me in the code files was always `HISTORY, which I now suspect is a shorthand macro for a more complicated method call. It's not in the UDK default macros list, so I presume it's XCOM specific, which means it must be defined somewhere in the class inheritance chain. I feel less lost now, thank you.

Edited by SteelRook
Link to comment
Share on other sites

 

Does anyone have a working example for overriding X2AbilityToHitCalc_StandardAim or a similar class? I've been trying, following the example template, and none of my subclass's functions are being called (no effect, no log output). There was one other poster in the thread who had the same problem with X2AbilityToHitCalc_Hacking, and at least a few others with problems getting their class overrides to do anything.

 

If you do a search through the source files for usages of X2AbilityToHitCalc_StandardAim (I use Notepad++), you'll find that the class is being explicitly specified in the weapon templates. Such as :

StandardAim = new class'X2AbilityToHitCalc_StandardAim';
StandardAim.bGuaranteedHit = true;
Template.AbilityToHitCalc = StandardAim;

from X2Ability_AdventMEC.CreateMicroMissilesAbility.

 

This is using new, so should be override-able, but it is being invoked when the game is launching, when the base-game templates are being loaded. Presumably this occurs prior to the mods being launched, so it's basically a sort of load-order issue. You'd want your class overrides to take place before these templates get loaded.

 

This is just a theory of mine, but could be confirmed by changing the DefaultEngine.ini to include your override definitions (implicitly making them part of the base game). I'm not quite sure when the relative timing of "config merging" versus "Template creation" occurs, since it's all deep down in the native exe ...

 

 

Tried adding the NonNativePackages and ModClassOverrides lines directly to DefaultEngine.ini and still no effect.

 

For starters, I have code in a class extending X2AbilityToHitCalc_StandardAim, overriding InternalRollForAbilityHit and GetHitChance, that should show Aim Assist modifiers in-game by moving the handling code from InternalRollForAbilityHit (well after GetHitChance is called and thus hidden) to the main body of GetHitChance, where I call AddModifier to insert Aim Assist effects like any other aim/crit/dodge modifier. Also plenty of log calls so that even if I screwed up somewhere there should at least be extra log output if my class is being used at all.

 

...and now I'm pretty lost as to how else to accomplish this.

Edited by werewolpertinger
Link to comment
Share on other sites

Amineri (or anyone else that would already know about this sort of code trick, btw)....

 

In the LWS_OfficerPack.. is there an indirect way to alter the default Abilities Training time of 8 days to any other values via a newly exposed config setting call?

I understand we still could just use the INSTANTTRAINING=false toggle already included -- but to me having control over that delay would be more appropriate in terms of difficulty levels (Veteran to Legend, etc) and their steep MIN/MAX curves.

 

I simply don't want to touch that UC code. :wink:

Edited by Zyxpsilon
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...