• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Solved Creating new Predefined Characters?

TheGenericSmith

Landlubber
Hello!

After going through the list of predefined characters for freeplay or anything else, it dawned on me that if I could create some of my own based on pre-existing models, that would be really nice.

Any advice?
 
All you need to do is to add some extra lines in PROGRAM\Models\initModels.c .
Find the model ID for a character that is in the list to find what is needed to add more.

Of course by using the configuration options, you can create any character you want because you're not forced to choose one of the pre-defined ones.
 
If you want to add them only to a storyline, go to your storyline \ characters \ init \ TempQuest.c
Copy the text of an existing template and paste it.
Here you can change.
I think there is a line:
Code:
ch.model = "";
Entre between "" the name of the model.
And here:
Code:
ch.id        = "";
the Model ID (can be invented)
 
In "PROGRAM\Models\initModels.c", find the model you want to use and copy its block. For example, let's start with "9JdPor":
Code:
   model.description   =  "I remember Jack Sparrow as a polished Officer of the Portuguese Navy.";
   model.id       =  "9JdPor";
   model.FaceId       =  277;
   model.nation       =  PORTUGAL;
   model.price       =  5000;
   model.assigned       =  true;
   AssignModelTypeNation(isstart, model, "Captains", 1.0, PORTUGAL);
   AssignModelType(isstart, model, OFFIC_TYPE_FIRSTMATE, 1.0);
   AssignModelType(isstart, model, OFFIC_TYPE_QMASTER, 1.0);
   AddCharacterModel(model);
Change the "model.id" - all characters must have their own unique ID. Change the "model.description" line, also add "model.name" and "model.lastname" to make your character distinct. Also, delete the "AssignModelType" lines - those control how a character can appear in random encounters, possibly on the street, possibly as officers for hire in taverns.
Code:
   model.description   =  "A Portuguese naval officer who bears merely a passing resemblance to a famous pirate.";
   model.id       =  "FdeAlmeida";
   model.FaceId       =  277;
   model.nation       =  PORTUGAL;
   model.price       =  5000;
   model.assigned       =  true;
   model.name = "Francisco";
   model.lastname = "de Almeida";
   AddCharacterModel(model);
Once you've done all the stuff which I'll get to in a moment to set up the actual character model, this definition will allow you to find the character in the FreePlay character selection menu by setting the fame level to "Named". You can add more lines to customise the character further. If you add "model.storytitle" and "model.storytext" lines, he'll now appear in character selection among the more select group of "Specific" characters. You can give him a ship. You can set the year, and even the day and month, when his game will start. You can define what type of character he will be - a list of them can be found in "PROGRAM\Dialog_Func.c", look for the "#define PLAYER_TYPE" lines. You can choose which flags he'll use.
model.description = "A Portuguese naval officer who bears merely a passing resemblance to a famous pirate.";
model.id = "FdeAlmeida";
model.FaceId = 277;
model.nation = PORTUGAL;
model.price = 5000;
model.assigned = true;
model.name = "Francisco";
model.lastname = "de Almeida";
model.storytitle = "The Portuguese Armada";
model.storytext = "As was customary for men in your social circle, you joined the military at an early age. You have fought in conflicts in different parts of Morocco and Spain on the side of the Castilians. Now in the Caribbean, Spain is again your ally. But you never know what the future might bring!";
model.playertype = PLAYER_TYPE_NAVAL_OFFICER;
model.Flags.Pirate = 23;
model.Flags.Personal = 27;
model.ship = "Polacca_N";
model.shipname = "Lebre";
model.date.year = 1505;
AddCharacterModel(model);[/code]That's the definition for Francisco de Almeida, which you'll find already in "initModels.c".

Now you need to set up the model. As this is simply a renamed version of an existing model, all you need to do is go into "RESOURCE\Models\Characters", make a copy of the original model, and name it to match what you put in "model.id". In this case, you'd copy "9JdPor.gm" and name the copy "FdeAlmeida.gm". Next, go into "RESOURCE\Models\Heads" and do the same - these are the models used by the talking head animation you see when you talk to someone, and occasionally you talk to yourself during some sidequests, in which case you'll see your own talking head. So, copy "h_9JdPor.gm" and name the copy "h_FdeAlmeida.gm". You also need to go into "RESOURCE\animation\heads" and again, find the file for the original model, copy it, and name the copy to match "model.id" - in this case, a copy of "h_9JdPor.ani" becomes "h_FdeAlmeida.ani".

Edit "RESOURCE\INI\TEXTS\ENGLISH\models_description.txt". Add a line to match your "model.description" line, e.g. for this one:
Code:
A Portuguese naval officer who bears merely a passing resemblance to a famous pirate.{A Portuguese naval officer who bears merely a passing resemblance to a famous pirate.}

It's also possible to give the character his own interface picture - "FdeAlmeida" actually uses faceid 96, which is based on a painting of the real person, for example. If you want to do this, you'll need some sort of picture editing software such as Photoshop or GIMP, and in that case I can tell you what you need to do. Or you can customise the character's appearance. Otherwise, this should give you plenty to work with...
 
Change the "model.id" - all characters must have their own unique ID.
For the sake of simplicity, I think unless you want to add a custom portrait too, you can just use the existing initModels.c entry without a need to copy anything.
That's what I did with Josiah Peabody as well.
 
That works as long as you only want to use the model for that character. If you want someone else to use the "USA_cpt_18" model, or if anyone else has their own favourite American captain, he's going to need a different ID. Personally, as an absolute minimum I'd make a copy of "USA_cpt_18", give him a new ID, then copy his model, head model and head animation. That way the generic model remains generic and you have the foundation for a more complete character if you want to add more details later.
 
If you want someone else to use the "USA_cpt_18" model, or if anyone else has their own favourite American captain, he's going to need a different ID.
Perfectly true.
But until someone actually does, which may never happen, it saves a fair bit of trouble. ;)
Anyway, I don't mind either way.
 
Mostly the reason I wanted to do this was to create a character based off of Admiral John Jervis. A lot of this makes sense, but I feel adding in the different commands of a custom naval officer is a bit different?
 
Mostly the reason I wanted to do this was to create a character based off of Admiral John Jervis. A lot of this makes sense, but I feel adding in the different commands of a custom naval officer is a bit different?
Adding pre-defined commands for a naval officer is relatively easy too.
File to edit is PROGRAM\NK.c .
 
It's also possible to give the character his own interface picture - "FdeAlmeida" actually uses faceid 96, which is based on a painting of the real person, for example. If you want to do this, you'll need some sort of picture editing software such as Photoshop or GIMP, and in that case I can tell you what you need to do. Or you can customise the character's appearance. Otherwise, this should give you plenty to work with...

For using a custom interface picture, how would I go about doing that?
 
@TheGenericSmith: Interface portrait files are found in "RESOURCE\Textures\INTERFACES\PORTRAITS". In there are three sub-folders: "64", "128" and "256". These contain the pictures at 64x64, 128x128 and 256x256 resolutions respectively. The files are all named "face_xxx.tga.tx", where "xxx" is a three digit number. Almost all the numbers up to 567 are taken, so your new one will need to be at least number 568.

Edit "RESOURCE\INI\INTERFACES\pictures.ini". Find this block:
Code:
[FACE128_567]
sTextureName   = portraits\128\face_567.tga
wTextureWidth   = 128
wTextureHeight   = 128
picture = face,0,0,128,128
Copy it, paste it, and change the "567" to "568" (or whichever other number you intend to use).

Also in each of the three sub-folders of "RESOURCE\Textures\INTERFACES\PORTRAITS", you'll find a file "face_blank.psd". This is a file for use with Photoshop. If you have this, making the portraits is easy - open your chosen picture, clip it to a square, resize it to 256x256, then copy the whole thing into the 256x256 version of "face_blank.psd" and make sure the new layer is below the existing layer which contains the frame. Save the result in TARGA format as "face_568.tga", then use TX Convertor to change it to "face_568.tga.tx". Do the same for the 128x128 and 64x64 versions.

If you don't have Photoshop, GIMP should work as well, and it's freeware. In any other picture-editing program, if it doesn't recognise Photoshop format files then you'll need to use TX Convertor to convert any existing portrait file to .tga format. Read it into your program, then paste your own picture on top of it. Clip away bits of your picture to expose the frame. Then save the result as TARGA format and use TX Convertor to change it to .tga.tx format.
 
Back
Top