Jump to content
ℹ️ Intermittent Download History issues ×

Where does the "Generate new character bio" code live?


serratemplar

Recommended Posts

So, I just made and published my first mod for anything ever; it's a random nickname button (and first, last name, and country too) .

It's incomplete though, because it doesn't update the character bio to reflect the changed name.

The short fix (hack) for this would be to (try and) fetch the data from it (not sure how) and then string replace the new name in...but that runs into the same issue as just trying to spawn an entirely new one.

The only code I've seen anywhere that actually writes to the bio is in UICustomize_Info:

simulated function AS_SetCharacterBio(string title, string bio)
{
	MC.BeginFunctionOp("setCharacterBio");
	MC.QueueString(title);
	MC.QueueString(bio);
	MC.EndOp();
}

MC is a member of UIPanel and of type UIMCController...where MC seems to stand for "Movie Clip", i.e. Flash-ville. UIMCController's purpose, per it's header comment, is:

Provides a low level API to communicate with Flash Panel.MovieClips


SO I've been grepping over and over trying to find any usage of "setCharacterBio" (or anything with "characterbio" or "bio") and even just calls to SetFunctionOp()...to no avail. I think that the bio generation is currently out of our reach. But, maybe you know better; I'd really appreciate anybody pointing me to it if they do.

Thanks in advance.

Here's the mod:
http://steamcommunity.com/sharedfiles/filedetails/?id=630738292

ADDENDUM: I'm a C++ guy; I know zero Flash. :\ That might come up here.

Edited by serratemplar
Link to comment
Share on other sites

I found it! Right under my nose in XComGameState_Unit:

function GenerateBackground(optional string ForceBackgroundStory)

The word background is used more often in the UI code to talk about literal backgrounds (to panels and screens) and, also, I am a bit of a bonehead that must've looked at this function several times without recognizing it was precisely a thing I'd need later.

 

I'm in business! Thanks so much for your help, davidallen: I'd just about thrown in the towel prematurely there. Random Bio button incoming!

Link to comment
Share on other sites

Eventually I'll need to find out how to tweak that script to link age with which Bio it chooses. (No more war vets who were 5 years old when the invasion happened)

 

 

Is the listing of XGParam in that part? I need a way to pull Last name and other information to place inside my Background mod. At work so I can't check.

Edited by Gaming_Geek
Link to comment
Share on other sites

I saw your post over on 2K which prompted me to root around a bit for that. XGParamTag is its own class and it's used just about anywhere the code wants to read in text and deal with (you guessed it) tags.

 

I don't actually see where those specific tags ("FirstName" and "CountryName") are defined though. :\ My guess is they're hidden in the Flash layer, as that's where the Background story stuff really seems to live. If they're in the Unreal Script, I've so far failed to find them.

 

If I were you I'd just try "LastName" and see if you get lucky. I wouldn't expect "NickName" to work (since Rookies come in with backgrounds and without nicknames) but it might. (That would straight up break my code though, haha. :) )

Link to comment
Share on other sites

Actually, this may be a nonstarter. :\ Once again, under my nose, in the GenerateBackground function...

if(BackgroundStory != "")
{		
	LocTag.StrValue0 = GetCountryTemplate().DisplayNameWithArticleLower;
	LocTag.StrValue1 = GetFirstName();
	strBackground $= "\n\n" $ `XEXPAND.ExpandString(BackgroundStory);
}

It doesn't even check for any tags other than Country or FirstName.

 

I think the only way for you to do this (to include last names) would be to actually write a Screen Listener that generates a bio and forces it in via that function. Doing that would allow you to create a custom tag, I bet.

Link to comment
Share on other sites

Actually, this may be a nonstarter. :\ Once again, under my nose, in the GenerateBackground function...

if(BackgroundStory != "")
{		
	LocTag.StrValue0 = GetCountryTemplate().DisplayNameWithArticleLower;
	LocTag.StrValue1 = GetFirstName();
	strBackground $= "\n\n" $ `XEXPAND.ExpandString(BackgroundStory);
}

It doesn't even check for any tags other than Country or FirstName.

 

I think the only way for you to do this (to include last names) would be to actually write a Screen Listener that generates a bio and forces it in via that function. Doing that would allow you to create a custom tag, I bet.

 

...I BET if I tweaked that to add new StrValue's it would work. ....hell, that's EXACTLY what I would need to modify to set specific background stories to age limits!

 

Thank you!

Link to comment
Share on other sites

Also THANK YOU for the mod, as that'll make testing my stuff so much easier. :D

 

 

BTW, you might want to check your Src/XComGame/Classes folder. I don't think you need all those UC's included in your mod, looks like it's a bunch of the default ones.

 

Never mind, I'm an idiot. :pinch:

Edited by Gaming_Geek
Link to comment
Share on other sites

...I BET if I tweaked that to add new StrValue's it would work. ....hell, that's EXACTLY what I would need to modify to set specific background stories to age limits!

I think you might have an easier time making a button like mine have a custom generator that can access the soldier's info from inside (the XComGameState_Unit instance) rather than injecting or overriding that code.

 

Injecting custom code into that core class (if it's possible, I don't think it is without doing some really extreme overhauling) will reduce compatibility with other mods; I really think that's why they're pushing the Listener class thing as those will tend to play more nicely than straight up overrides. (My mod's hitting precisely this problem right now as the popular ImportFromCharacterPool mod makes its own instance of UICustomize_Info and my mod and it trip right over each other since my listener responds both to the stock Customization Info menu and the one from this mod.)

 

Extending (and overriding that function) might be doable, but I don't know quite where you'd convince the game to use your function instead of its for Background generation.

 

All that said, I could be 100% wrong, haha.

 

I'd be very curious to know how you manage to do this; I'd no doubt learn something. :) Good luck!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...