Home » MODDING HQ 1.13 » v1.13 Modding, Customising, Editing » v1.13 Time Capsule (How-to Library) » "How do I do that?" Adding a new character
book95.png  "How do I do that?" Adding a new character[message #349550] Sat, 15 April 2017 03:44
Flugente

 
Messages:3165
Registered:April 2009
Location: Germany
"How do I do that?" Adding a new character

Thanks to years of coding by many people, we can nowadays add many new things to our beloved game, but sadly, I is not always clear to a user what changes are required, and where.

This guide aims to clarify what files have to be altered/created in order to create new characters for the game. It works both for the Stable 2014 release (r7609 and sevenfm' subsequent exes) and the current unstable trunk (r8400 & GameDir r2363 at the time of this writing). Unless stated otherwise, assume a change works for both.
While many changes/files are optional, past experience has taught me that stating so has the tendency to confuse people. For this reason, assume that all changes I list here are mandatory. They aren't, but you'll be on the safe side with this.
This guide assume you are working on a non-modded 1.13 SCI installation, thus the changes will mostly be in /Data-1.13 subfolders. In case you are working in a mod, you might need to alter the paths accordingly.
Section 5 contains a link to .7z file with 2 mercs I've created, in case you need an example.

Now, before we jump in, a few definitions are necessary - because there can be quite the confusion on what 'character' actually means:

  • Person. At any time in the game, there can be up to 256 persons in the same sector (changed to up to 65K in my volatile releases. Persons are anybody who, well, moves/shoots/etc. in the game. This includes our mercenaries, the enemy team, civilians, militia, bloodcats, creatures, tanks, cows, crows... in the code they are called soldiers, but that would likely confuse people, as we mostly stuck that label the enemy team.
  • Character. By this I mean a person with a profile. Put simply, these are persons who have a face portrait and voiced dialogue. These have much more data than the more-or-less randomly generated enemy forces and civilians. We will practically focus on these, because there isn't much to do for the others anyway.
    Note: anybody under direct control of the player is a character. There have been requests to change that (mostly to control militia directly), but as non-characters have absolutely no personality, all the people who could code that regard that as a very bad idea, so we won't code that, so stop asking ;-)
    Note 2: There can only be up to 256 characters in the game total, as there can only be 256 profiles. This is not to be confused with the above limitation per sector (although the problem is identical). This might be changed, in, I don't know, a few years, but would again require extensive code changes.
  • PC (player character). Any character the player controls.
  • RPC (recruitable player character). Your mercenaries - anybody you can hire or create ingame falls under this category.
  • EPC (escortable player character). A few quest related characters (Maria, Joey, Skyrider...) can be directly controlled by the player at some point, but have 'limited functionality'. They aren't much use in combat (although they can be used as excellent suicide bombers) and are required to be escorted somewhere by quests.
  • IMP. These are the guys the player can create according to their own specification ingame. They are not premade - the player can choose their looks, voice etc. Part of this guide will look at how you can add new faces or voices for IMPs.
  • NPC (non-player character). All characters that aren't PC. Basically quest-people and shopkeepers in the game. Sometimes we also refer to non-characters this way, because we aren't that clear on definitions.
  • Profile. Most of the character data is stored in what we call a profile in TableData/MercProfiles.xml, the number of the profile is called the profile id and is used in all data we will edit.

This guide aims to explain how to create a new RPC, and how to create additional voices and faces for IMPs. Creating a new RPC will also yield most work required for NPCs, but I am not fully aware of all the quest/mapping work required for new quest NPCs, hopefully some modder might add these bits here later on.

1. Creating a face
Faces are numbered, every profile slot has a face. It follows that when creating a face, it would be wise to know the profile id beforehand, otherwise you'd have to rename the face later on.
The face data is stored in .STI files, we store most of our graphic data in that format. Use the STI editor or Tox' editor to edit these.
The face data is stored in /Data-1.13/faces for characters, but IMP faces are stored in /Data-1.13/IMPFaces. There are several subfolders containing face data. Some folders only contain the face in a single image in various resolutions, every time called 'your profile number'.STI:

  • 33FACE
  • 65FACE
  • BIGFACES

Other folders require several pictures in a library. This is a bit more tricky. Ingame, the face is supposed to move (mouth an eye movement), so what the game does is laying several pictures above each other. For example, these are the pictures for one of the stock IMP faces:
http://i.imgur.com/tXYSxW2.png
What happens later on is that the eye and mouth pics are layed on top of the first image. This requires x- and y-offsets - otherwise eye and mouth would be in the wrong position. Note these, we will add them to the xmls later.
We add this .STI library to several folders:

  • The folder itself
  • DESERTCAMO
  • URBANCAMO
  • WOODCAMO

As you've probably guessed, the CAMO folders contain the desert/urban/woodland camo sets. Even if you don't have camoed versions of faces, replace these - otherwise a PC will change his face once you put camo on them, which looks.. odd.

The FACESGEAR folder contains libraries with additional layers for certain face gear, like sunglasses. Edit the picture corresponding to the profile id to fit the face' proportions.

That was the face itself, we add corresponding xml entries later, as this differs between IMPs and other characters.

2. Creating a voice
A voiceset consists of several .ogg or .wav files that the game plays whenever a character speaks.
Note: In stable 2014 releases, a voiceset always has the same number as a profile id. So if you want to edit the voice of merc #87, alter the files that start '087_', and so on. In unstable releases after r8364, voicesets are now profile-independent. Any number between 0 and 2^32 can now be used to adress a voiceset, and several characters can use the same voice.
First of, you need to add the Battle sounds (short stuff, like character being hit, yelling 'yes# or 'no' etc.) to /Data-1.13/BattleSNDS. It looks like this:
http://i.imgur.com/SyQG0aF.png
In this case, 211 and 254 are the identifiers for the voicesets 211 and 254. To learn what a file should contain, just listen to one of the existing ones. If you've ever played the game, you should have a good idea when what is used.

Second, we need to add the spoken dialogue to /Data-1.13/Speech:
http://i.imgur.com/5QKNTTb.png
Now, this will be a bit tricky. Some of the dialogue is optional, and depends on the character itself. Dialogue that is used in regards with a characters buddies or hated ones is obviously only necessary when that character has buddies or hated ones, obviously. This gets even more complicated, as some dialogue numbers have different meanings - they differ between IMP, AIM merc, MERC merc and other RPCs. What is used when? As I don't intend to state that her for each file, you better take a look at existing voicesets and draw your own conclusions ;-). Anyway, here's the file list:
	// 0
	QUOTE_SEE_ENEMY = 0,
	QUOTE_SEE_ENEMY_VARIATION,
	QUOTE_IN_TROUBLE_SLASH_IN_BATTLE,
	QUOTE_SEE_CREATURE,
	QUOTE_FIRSTTIME_GAME_SEE_CREATURE,
	QUOTE_TRACES_OF_CREATURE_ATTACK,
	QUOTE_HEARD_SOMETHING,
	QUOTE_SMELLED_CREATURE,
	QUOTE_WEARY_SLASH_SUSPUCIOUS,
	QUOTE_WORRIED_ABOUT_CREATURE_PRESENCE,

	//10
	QUOTE_ATTACKED_BY_MULTIPLE_CREATURES,
	QUOTE_SPOTTED_SOMETHING_ONE,
	QUOTE_SPOTTED_SOMETHING_TWO,
	QUOTE_OUT_OF_AMMO,
	QUOTE_SERIOUSLY_WOUNDED,
	QUOTE_BUDDY_ONE_KILLED,
	QUOTE_BUDDY_TWO_KILLED,
	QUOTE_LEARNED_TO_LIKE_MERC_KILLED,
	QUOTE_FORGETFULL_SLASH_CONFUSED,
	QUOTE_JAMMED_GUN,

	//20
	QUOTE_UNDER_HEAVY_FIRE,
	QUOTE_TAKEN_A_BREATING,
	QUOTE_CLOSE_CALL,
	QUOTE_NO_LINE_OF_FIRE,
	QUOTE_STARTING_TO_BLEED,
	QUOTE_NEED_SLEEP,
	QUOTE_OUT_OF_BREATH,
	QUOTE_KILLED_AN_ENEMY,
	QUOTE_KILLED_A_CREATURE,
	QUOTE_HATED_MERC_ONE,

	//30
	QUOTE_HATED_MERC_TWO,
	QUOTE_LEARNED_TO_HATE_MERC,
	QUOTE_AIM_KILLED_MIKE,
	QUOTE_MERC_QUIT_LEARN_TO_HATE = QUOTE_AIM_KILLED_MIKE,
	QUOTE_HEADSHOT,
	QUOTE_PERSONALITY_TRAIT,
	QUOTE_ASSIGNMENT_COMPLETE,
	QUOTE_REFUSING_ORDER,
	QUOTE_KILLING_DEIDRANNA,
	QUOTE_KILLING_QUEEN,
	QUOTE_ANNOYING_PC,

	//40
	QUOTE_STARTING_TO_WHINE,
	QUOTE_NEGATIVE_COMPANY,
	QUOTE_AIR_RAID,
	QUOTE_WHINE_EQUIPMENT,
	QUOTE_SOCIAL_TRAIT,
	QUOTE_PASSING_DISLIKE,
	QUOTE_EXPERIENCE_GAIN,
	QUOTE_PRE_NOT_SMART,
	QUOTE_POST_NOT_SMART,
	QUOTE_HATED_1_ARRIVES,
	QUOTE_MERC_QUIT_HATED1 = QUOTE_HATED_1_ARRIVES,

	//50
	QUOTE_HATED_2_ARRIVES,
	QUOTE_MERC_QUIT_HATED2 = QUOTE_HATED_2_ARRIVES,
	QUOTE_BUDDY_1_GOOD,
	QUOTE_BUDDY_2_GOOD,
	QUOTE_LEARNED_TO_LIKE_WITNESSED,
	QUOTE_DELAY_CONTRACT_RENEWAL,
	QUOTE_NOT_GETTING_PAID = QUOTE_DELAY_CONTRACT_RENEWAL,
	QUOTE_AIM_SEEN_MIKE,
	QUOTE_PC_DROPPED_OMERTA = QUOTE_AIM_SEEN_MIKE,
	QUOTE_BLINDED,
	QUOTE_DEFINITE_CANT_DO,
	QUOTE_LISTEN_LIKABLE_PERSON,
	QUOTE_ENEMY_PRESENCE,

	//60
	QUOTE_WARNING_OUTSTANDING_ENEMY_AFTER_RT,
	QUOTE_FOUND_SOMETHING_SPECIAL,
	QUOTE_SATISFACTION_WITH_GUN_AFTER_KILL,
	QUOTE_SPOTTED_JOEY,
	QUOTE_RESPONSE_TO_MIGUEL_SLASH_QUOTE_MERC_OR_RPC_LETGO,
	QUOTE_SECTOR_SAFE,
	QUOTE_STUFF_MISSING_DRASSEN,
	QUOTE_KILLED_FACTORY_MANAGER,
	QUOTE_SPOTTED_BLOODCAT,
	QUOTE_END_GAME_COMMENT,
	
	//70
	QUOTE_ENEMY_RETREATED,
	QUOTE_GOING_TO_AUTO_SLEEP,
	QUOTE_WORK_UP_AND_RETURNING_TO_ASSIGNMENT, // woke up from auto sleep, going back to wo
	QUOTE_ME_TOO, // me too quote, in agreement with whatever the merc previous said
	QUOTE_USELESS_ITEM,
	QUOTE_BOOBYTRAP_ITEM,
	QUOTE_SUSPICIOUS_GROUND,
	QUOTE_DROWNING,
	QUOTE_MERC_REACHED_DESTINATION,
	QUOTE_SPARE2,

	//80
	QUOTE_REPUTATION_REFUSAL, //80
	QUOTE_NON_AIM_BUDDY_THREE_KILLED = QUOTE_REPUTATION_REFUSAL,
	QUOTE_DEATH_RATE_REFUSAL, //= 81,
	QUOTE_NON_AIM_BUDDY_FOUR_KILLED = QUOTE_DEATH_RATE_REFUSAL,
	QUOTE_LAME_REFUSAL, //= 82,
	QUOTE_NON_AIM_BUDDY_FIVE_KILLED = QUOTE_LAME_REFUSAL,	
	QUOTE_WONT_RENEW_CONTRACT_LAME_REFUSAL,	//=83,
	QUOTE_NON_AIM_HATED_MERC_THREE = QUOTE_WONT_RENEW_CONTRACT_LAME_REFUSAL,
	QUOTE_ANSWERING_MACHINE_MSG, //= 84,
	QUOTE_NON_AIM_HATED_MERC_FOUR = QUOTE_ANSWERING_MACHINE_MSG,
	QUOTE_DEPARTING_COMMENT_CONTRACT_NOT_RENEWED_OR_48_OR_MORE, //=85,
	QUOTE_NON_AIM_HATED_MERC_FIVE = QUOTE_DEPARTING_COMMENT_CONTRACT_NOT_RENEWED_OR_48_OR_MORE,
	QUOTE_HATE_MERC_1_ON_TEAM,// = 86,
	QUOTE_NON_AIM_BUDDY_3_GOOD = QUOTE_HATE_MERC_1_ON_TEAM,
	QUOTE_HATE_MERC_2_ON_TEAM,// = 87,
	QUOTE_NON_AIM_BUDDY_4_GOOD = QUOTE_HATE_MERC_2_ON_TEAM,
	QUOTE_LEARNED_TO_HATE_MERC_ON_TEAM,// = 88,
	QUOTE_NON_AIM_BUDDY_5_GOOD = QUOTE_LEARNED_TO_HATE_MERC_ON_TEAM,
	QUOTE_CONTRACTS_OVER,// = 89,
	QUOTE_MERC_QUIT_HATED3 = QUOTE_CONTRACTS_OVER,
	
	//90
	QUOTE_ACCEPT_CONTRACT_RENEWAL, // =90,
	QUOTE_MERC_QUIT_HATED4 = QUOTE_ACCEPT_CONTRACT_RENEWAL,
	QUOTE_CONTRACT_ACCEPTANCE,// =91,
	QUOTE_MERC_QUIT_HATED5 = QUOTE_CONTRACT_ACCEPTANCE,
	QUOTE_JOINING_CAUSE_BUDDY_1_ON_TEAM,// = 92,
	QUOTE_JOINING_CAUSE_BUDDY_2_ON_TEAM,// = 93,
	QUOTE_JOINING_CAUSE_LEARNED_TO_LIKE_BUDDY_ON_TEAM,// = 94,
	QUOTE_REFUSAL_RENEW_DUE_TO_MORALE,// = 95,
	QUOTE_PRECEDENT_TO_REPEATING_ONESELF,// = 96,
	QUOTE_REFUSAL_TO_JOIN_LACK_OF_FUNDS,// = 97,
	QUOTE_DEPART_COMMET_CONTRACT_NOT_RENEWED_OR_TERMINATED_UNDER_48,// = 98,
	QUOTE_DEATH_RATE_RENEWAL,

	//100
	QUOTE_HATE_MERC_1_ON_TEAM_WONT_RENEW,
	QUOTE_HATE_MERC_2_ON_TEAM_WONT_RENEW,
	QUOTE_LEARNED_TO_HATE_MERC_1_ON_TEAM_WONT_RENEW,
	QUOTE_RENEWING_CAUSE_BUDDY_1_ON_TEAM,
	QUOTE_RENEWING_CAUSE_BUDDY_2_ON_TEAM,
	QUOTE_RENEWING_CAUSE_LEARNED_TO_LIKE_BUDDY_ON_TEAM,
	QUOTE_PRECEDENT_TO_REPEATING_ONESELF_RENEW,
	QUOTE_RENEW_REFUSAL_DUE_TO_LACK_OF_FUNDS,
	QUOTE_GREETING,
	QUOTE_SMALL_TALK,

	//110
	QUOTE_IMPATIENT_QUOTE,					
	QUOTE_LENGTH_OF_CONTRACT,
	QUOTE_COMMENT_BEFORE_HANG_UP,
	QUOTE_PERSONALITY_BIAS_WITH_MERC_1,
	QUOTE_PERSONALITY_BIAS_WITH_MERC_2,
	QUOTE_MERC_LEAVING_ALSUCO_SOON,
	QUOTE_MERC_GONE_UP_IN_PRICE,
#ifdef JA2UB
	QUOTE_ENTER_SECTOR_WITH_FAN_1,
	QUOTE_ENTER_SECTOR_WITH_FAN_2,
#endif

	QUOTE_AIM_BUDDY_THREE_KILLED = 119,

	//120
	QUOTE_AIM_BUDDY_FOUR_KILLED,
	QUOTE_AIM_BUDDY_FIVE_KILLED,
	QUOTE_AIM_HATED_MERC_THREE,
	QUOTE_AIM_HATED_MERC_FOUR,
	QUOTE_AIM_HATED_MERC_FIVE,
	QUOTE_HATED_3_ARRIVES,
	QUOTE_HATED_4_ARRIVES,
	QUOTE_HATED_5_ARRIVES,
	QUOTE_AIM_BUDDY_3_GOOD,
	QUOTE_AIM_BUDDY_4_GOOD,
	
	//130
	QUOTE_AIM_BUDDY_5_GOOD,
	QUOTE_HATE_MERC_3_ON_TEAM,
	QUOTE_HATE_MERC_4_ON_TEAM,
	QUOTE_HATE_MERC_5_ON_TEAM,
	QUOTE_JOINING_CAUSE_BUDDY_3_ON_TEAM,
	QUOTE_JOINING_CAUSE_BUDDY_4_ON_TEAM,
	QUOTE_JOINING_CAUSE_BUDDY_5_ON_TEAM,
	QUOTE_HATE_MERC_3_ON_TEAM_WONT_RENEW,
	QUOTE_HATE_MERC_4_ON_TEAM_WONT_RENEW,
	QUOTE_HATE_MERC_5_ON_TEAM_WONT_RENEW,

	//140
	QUOTE_RENEWING_CAUSE_BUDDY_3_ON_TEAM,
	QUOTE_RENEWING_CAUSE_BUDDY_4_ON_TEAM,
	QUOTE_RENEWING_CAUSE_BUDDY_5_ON_TEAM,
	QUOTE_PERSONALITY_BIAS_WITH_MERC_3,
	QUOTE_PERSONALITY_BIAS_WITH_MERC_4,
	QUOTE_PERSONALITY_BIAS_WITH_MERC_5,

As a character can have 5 buddies and one learn to like, and 5 hated ones and one learn to hate, and each of these relations has 4 files, that's quite a lot of additional dialogue.
From my experience, this is the hardest part about creating new characters. Taking sounds from movies etc. is bad, because you have to cut everything, have a lot of material to cut in the first place, and there is always background noise. Video games work much better, depending on the game ripping the sounds can range from trivial to I used several undocumented russian hacking tools I found while google-translating the pages I found, making me feel slightly uncomfortable, and then I had to sift through 400 MB of converted .mp3 to find fitting sounds, so no, this is definetely not easy. Additionally, finding fitting sounds gets hard fast, depending on the source material.

Of course, all of this dialogue also has subtitles, and you need to add that too. This happens in /Data-1.13/MercEdt. In here you need to add a file like 'your profile id'.edt, with every line number in that file corresponding to a dialogue file. We use this obscure, impractical file format for this instead of .txt or .xml files because the creators were serious twats sometimes, and should fornicate with themselves in ways both insulting and anatomically unlikely (we also won't ever change that format, because that would involve work and violate someones workflow or whatever shit). To even edit this obscure format, grab one of the editors - like CommieEDT - from kermi or scheinworld's archive. And save often.

Did I mention I hate .edt files? They are in my top 100 list of things I hate about this game.

Anyway, now we've got a voiceset - time to put this thing to use.

3. Creating a RPC
This is the part where we create a new RPC with a face and voiceset. Because you've grown to hate the .edt format, you can now edit another one of those: Edit /Data-1.13/BinaryData/AIMBIOS.EDT for AIM mercs or /Data-1.13/BinaryData/MERCBIOS.EDT for MERC mercs to set their webpage data.

The rest happens in /Data-1.13/TableData:

  • Edit Email/EmailMercAvailable.xml for AIM and Email/EmailMercLevelUp.xml for MERC mercs.
  • In Inventory/MercStartingGear.xml, you set up a merc's starting gear kits.
  • In Sounds/SoundsProfiles.xml, we need an entry, too. Is this xml obviously pointless? Absolutely. Now stop asking questions.
  • In the folder itself, alter AIMAvailability.xml for AIM and MercAvailability.xml for MERC mercs. See the existing contents of those xmls to get an idea of what to do here.
  • Also, add entries for HiddenNames.xml and MercQuote.xml.
  • In MercProfiles.xml, fill in the important character data. You might find out that there aren't that many slots free, so good luck here. Slot 200 is used for internal code reasons, don't ever, EVER use that one!!!
    Note: You might have noticed that contrary to what I've said, we also somehow have slots here for our vehicles. This is the result of an atrocious hack Sirtech made that is both limiting, wasteful and a bitch to remove, so suck it up.
  • MercOpinions.xml contains the opinions of each character for each other character. You might want to edit that to make your character more of a person, especially regarding buddies and hated ones.
  • Backgrounds.xml contains a character's individual background. The number of a background is set in MercProfiles.xml via <usBackground> and does not have to equal the profile id (but doing so is logical, so do that).

Actually, now that we're here, lets have a closer look at MercProfiles.xml, shall we? Looking at existing entries and the explanations on top should clear most questions, but a few tags are extra-interesting:
<PROFILE>
		<uiIndex>5</uiIndex>				<- profile id
		<Type>1</Type>
		<zName>Trevor Colby</zName>
		<zNickname>Trevor</zNickname>
		<ubFaceIndex>5</ubFaceIndex>		<- face number
		<usVoiceIndex>5</usVoiceIndex>		<- voiceset
		<usEyesX>10</usEyesX>				<- eye coordinate from back when we created the face
		<usEyesY>8</usEyesY>
		<usMouthX>9</usMouthX>				<- mouth coordinate from back when we created the face
		<usMouthY>28</usMouthY>

Note: The <usVoiceIndex>-tag only exists in newer unstable relases - it is not present in unstable 2014 versions. You NEED to set this tag, otherwise your character will always use Barry Unger's voice.

To make matters worse, any changes to MercProfiles.xmlonly affect a newly created campaign[/b] - so you might end up starting quite a few one of those during testing.

And that's it. You now have a new character to blow up shit with.

4. Creating a new IMP slot

As you only create the IMPs during the game, they have no data set, so things are a bit different here. We need to edit less, but in different places:

  • In MercProfiles.xml, we need to reserve a slot for an IMP, there are already a few. If you've found one, note that number and add it under [Recruitment Settings] in Ja2_Options.ini, be sure to also alter the numbers there correctly.
  • IMP gear selection depends on what is set in Inventory/IMPItemChoices.xml, in case you want to alter that.
  • In Sounds/SoundsProfiles.xml, we need an entry, too. Is this xml obviously pointless? Absolutely. Now stop asking questions.
  • In the folder itself, alter IMPPortraits.xml. We set the face coordinates here, as well as a few default values for the IMP creation process.
  • Unstable relases only: IMPVoices.xml contains all voicesets that IMPs can use, so add a new voice here if you have one.
  • Also, add entries for HiddenNames.xml and MercQuote.xml.
  • Having any opinions set in MercOpinions.xml is kinda odd - make sure those are 0. Unless you want your IMP to have opinions on people, win which case - don't you really want a character instead?

Anyway, that should be all for a new IMP slot. Have fun and so on.

Hopefully, that should provide insight as to how to create new characters. I'm sure questions will still come up, which will likely be adressed in this thread.

5. Example

I've created mercs like this - here is an example for GameDir r2369. This contains 2 mercenaries - Cmdr. Shepard (#254) and Lara Croft (#211) - that were created via the above steps. Shepard's data also contains a face (which is just a copy of an existing IMP face) to teach you what is needed there.

[Updated on: Mon, 17 July 2017 00:58]




Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Previous Topic: 1.13 Map Editor Guide
Next Topic: "How does it work?" Part 6: Auto-Resolve
Goto Forum:
  


Current Time: Sat Nov 25 03:49:09 EET 2017

Total time taken to generate the page: 0.00991 seconds