• 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!

Doubts about modding CoAS

Josuviz

Landlubber
Greetings higher Capitans! this Spanish pirate need help from your knowledge, once again... lol.

Problem: I am working on Spanish Mod, and i want add new NPCs, but I havent found the key to do it...
Initially, I looked into the files from this folder "Age of Pirates 2\Program\characters\init". I found some interesting lines like these in the file called "StoryCharacters.C":
//////////////////=====>>>> Ìàãè÷åñêèé êâåñò Àñêîëüäà.
makeref(ch,Characters[n]); // Àñêîëüä
ch.name = xiDStr("Ascold");
ch.lastname = "";
ch.id = "Ascold";
ch.model = "Corsair1_2";
ch.model.animation = "man";
ch.sex = "man";
ch.location = "BasTer_houseSp1";
ch.location.group = "sit";
ch.location.locator = "sit1";
ch.Dialog.Filename = "Quest\Ascold.c";
ch.nation = PIRATE;
ch.rank = 38;
ch.reputation = "15";
SetSelfSkill(ch, 90, 90, 90, 70, 90);
SetShipSkill(ch, 20, 90, 10, 10, 10, 20, 10, 10, 50);
LAi_NoRebirthDisable(ch); // âîñêðåñòü ïðè óáèåíèè
LAi_SetSitType(ch);
LAi_SetLoginTime(ch, 0.0, 24.0);
LAi_SetHP(ch, 200.0, 200.0);
LAi_SetImmortal(ch, true);
ch.greeting = "Gr_Ascold";
n = n+1;
I recognized quickly this information about Ascold. I thought that adding new lines in the same file, i would be able to add new NPCs in the game, and i did a test. I copied the lines about morgan in the same file, and pasted it below:
//============== Ãåíðè Ìîðãàí! Âñåì òðåïåòàòü. =================
makeref(ch,Characters[n]);
ch.name = xiDStr("Henry");
ch.lastname = xiDStr("Morgan");
ch.id = "Henry Morgan";
ch.model = "Morgan";
ch.model.animation = "man";
ch.sex = "man";
ch.location = "PortRoyal_houseS1";
ch.location.group = "sit";
ch.location.locator = "sit2";

ch.Dialog.Filename = "Quest\Morgan.c";
ch.nation = PIRATE;
GiveItem2Character(ch, GUN_COMMON);
ch.equip.gun = GUN_COMMON;
GiveItem2Character(ch, "blade27");// ñàáëÿ Ìîðãàíà
ch.equip.blade = "blade27";
// ==> Êîðàáëèê Ìîðãàíó äåëàåì ñ õîðîøèìè ïóøêàìè
ch.Abordage.Enable = false; // ÍÅËÜÇß!
ch.Ship.Name = "Elisabett";
ch.Ship.Type = GenerateShip(SHIP_FRIGATE, true);
ch.Ship.Stopped = true;
ch.Ship.Cannons.Type = CANNON_TYPE_CANNON_LBS48;
SetCrewQuantityFull(ch);
Fantom_SetBalls(ch, "pirate");
ch.rank = 45;
SetRandSPECIAL(ch);
SetSelfSkill(ch, 90, 90, 90, 60, 70);
SetShipSkill(ch, 100, 10, 100, 100, 90, 60, 80, 90, 50);
ch.money = "50000";
SetCharacterPerk(ch, "FastReload");
SetCharacterPerk(ch, "HullDamageUp");
SetCharacterPerk(ch, "SailsDamageUp");
SetCharacterPerk(ch, "CrewDamageUp");
SetCharacterPerk(ch, "CriticalShoot");
SetCharacterPerk(ch, "LongRangeShoot");
SetCharacterPerk(ch, "CannonProfessional");
SetCharacterPerk(ch, "ShipDefenseProfessional");
SetCharacterPerk(ch, "ShipSpeedUp");
SetCharacterPerk(ch, "ShipTurnRateUp");
SetCharacterPerk(ch, "SwordplayProfessional");
SetCharacterPerk(ch, "AdvancedDefense");
SetCharacterPerk(ch, "CriticalHit");
SetCharacterPerk(ch, "Sliding");
LAi_NoRebirthDisable(ch);
LAi_RebirthOldName(ch);
LAi_SetHuberType(ch);
ch.standUp = true; //âñòàâàòü è íàïàäàòü íà âðàãà
LAi_group_MoveCharacter(ch, "ENGLAND_CITIZENS");
LAi_SetLoginTime(ch, 0.0, 24.0);
LAi_SetImmortal(ch, true);
LAi_SetHP(ch, 230.0, 230.0);
ch.greeting = "Gr_Morgan";
n = n + 1;
So, I edited the highlighted blue lines...
(...)
ch.location = "BasTer_houseSp1";
ch.location.group = "barmen";
ch.location.locator = "stay";

(...)

This new information was taken from other files in the folder mentioned previously. I created a new game, and i went to BasTer... this was the result:
HayqueJoderse.jpg

Henry talked with me as well as his clon in Port Royal (xDDDD).

And now, i have a problem. If i make a new test in other place, it doesnt work (My first test was lucky?). I tried in several houses in Belize and in the lighthouse in Tortuga, but my Clon NPC doesnt appears!. I Know that the solution is in those lines, but I dont know where I can take information about the locators and the location groups...

I've been thinking that may there be a solution using Coords. but i dont know how can I do it. Came this point, i dont know how continue... If someone of you know how do it, please, Can you explain me it? THANKS so much! ;)

(Sorry for the grammatical mistakes)
 
You should be able to change the locators to be visible. Search in PROGRAM\Locations\locations_loader.c for some lines that begin with VisibleLocatorsGroup .
Remove the /* and */ around them or the // in front of them, then load your game and you should see spheres indicating the spots you can place characters on.
 
You should be able to change the locators to be visible. Search in PROGRAM\Locations\locations_loader.c for some lines that begin with VisibleLocatorsGroup .
Remove the /* and */ around them or the // in front of them, then load your game and you should see spheres indicating the spots you can place characters on.
Ok, thanks pieter, now I can see the spheres... but i'm not sure to have it done well... the lines have this disposition
(...)
VisibleLocatorsGroup("torchlightes_o", 0.1, 15.0, 55, 0, 0, 255);
VisibleLocatorsGroup("candles", 1.0, 15.0, 255, 255, 255, 55);
VisibleLocatorsGroup("candles_medium", 1.0, 15.0, 255, 255, 255, 55);
VisibleLocatorsGroup("chandeliers", 1.0, 15.0, 255, 128, 0, 128);
VisibleLocatorsGroup("torchlightes", 1.0, 15.0, 255, 255, 155, 0);
VisibleLocatorsGroup("outside", 1.0, 15.0, 255, 155, 155, 255);
VisibleLocatorsGroup("fonar", 1.0, 15.0, 255, 155, 255, 155);
VisibleLocatorsGroup("heaters", 1.0, 15.0, 255, 155, 255, 155);
VisibleLocatorsGroup("incas_light", 1.0, 15.0, 255, 155, 255, 255);
VisibleLocatorsGroup("incas_sky", 1.0, 15.0, 255, 0, 255, 255);
(...)

And I edited a clon NPC...

(...)
makeref(ch,Characters[n]); // Ëþáîâü ïîíèìàøü...
ch.name = "Pepita";
ch.lastname = "Rodriguez";
ch.id = "Isabella";
ch.model = "Waitress3";
ch.sex = "woman";
ch.model.animation = "towngirl";
ch.location = "Mayak6";
ch.location.group = "fonar";
ch.location.locator = "fonar2";
(...)

I wrote "fonar" and "fonar2", because I thought that would appear below the fonar, but isnt so. What have I done wrong?

thanks again...
 
Stupid CoAS! :whipa
Those are the wrong types of locators. I'm used to working with PotC, which does have the right types of locators set up in there.
Try adding these lines into the file:
Code:
		VisibleLocatorsGroup("officers", 1.0, 15.0, 55, 0, 55, 0);
VisibleLocatorsGroup("rld", 1.0, 15.0, 55, 0, 55, 0);
VisibleLocatorsGroup("box", 1.0, 15.0, 55, 0, 55, 0);
VisibleLocatorsGroup("reload", 1.0, 15.0, 55, 0, 55, 0);

VisibleLocatorsGroup("Merchant", 1.0, 15.0, 105, 0, 55, 25);
VisibleLocatorsGroup("camera", 1.0, 15.0, 155, 0, 55, 55);
VisibleLocatorsGroup("characters", 1.0, 15.0, 55, 55, 0, 0);
VisibleLocatorsGroup("goto", 1.0, 15.0, 55, 55, 0, 0);
VisibleLocatorsGroup("sit", 1.0, 15.0, 55, 55, 0, 0);
VisibleLocatorsGroup("item", 1.0, 15.0, 55, 55, 0, 55);
These are the types you can use for placing characters (minus box, camera and item).
Reload, characters and goto are always good choices for putting characters on.
 
Thanks pieter, now I see the GOTOs, OFFICERs... etc...

But i've tried to set up a NPC but doesn't work... the last attempt was this:

(...)
makeref(ch,Characters[n]); // Àñêîëüä
ch.name = xiDStr("Ascold");
ch.lastname = "";
ch.id = "Ascold";
ch.model = "Corsair1_2";
ch.model.animation = "man";
ch.sex = "man";
ch.location = "BasTer_houseSp1";
ch.location.group = "reload";
ch.location.locator = "reload2";

ch.Dialog.Filename = "Quest\Ascold.c";
ch.nation = PIRATE;
ch.rank = 38;
ch.reputation = "15";
SetSelfSkill(ch, 90, 90, 90, 70, 90);
SetShipSkill(ch, 20, 90, 10, 10, 10, 20, 10, 10, 50);
LAi_NoRebirthDisable(ch); // âîñêðåñòü ïðè óáèåíèè
LAi_SetSitType(ch);
LAi_SetLoginTime(ch, 0.0, 24.0);
LAi_SetHP(ch, 200.0, 200.0);
LAi_SetImmortal(ch, true);
ch.greeting = "Gr_Ascold";
n = n+1;
(...)

This NPC would be a Ascold's clon, in his own house, but isnt the same place.

Should I try do it with another kind of NPC?
Should I try edit the Guadaloupe file, instead StoryCharacters?... I will try to find a solution.

EDIT: I found it!!! hahaha

I erased "xiDStr" in ch.name and edited the guadeloupe file instead of StoryCharacters, and finally appeared th e NPC where i Wanted. Now, the NPC, doesnt talk me, but that is another story...

Thanks so much Pieter!!!!
 
Also, locators can be made visible via press F11 -> Installation -> Locators Show

just turn ON debug mode in ..\program\_mod_on_off.h
and edit
#define MOD_BETTATESTMODE "On" // On -DEV version; Test - TST ver; Off - relize (by default)
 
That's great, ugeen; that IS easier! :woot
Yes it was, thanks Ugeen. (!)

josuviz said:
(...) Now, the NPC, doesnt talk me, but that is another story... (...)
Phew..., now, i dont know how to do that. Thanks to several tests, i know that the "ch.Dialog.Filename" is related with "ch.id", because for example, if I edit only one of these lines, the NPC doesnt talk with me.
By the contrast, if I edit for example the first line writing "ch.id ="Isabella" " and the second, writing "ch.Dialog.Filename = "Quest\Isabella\Isabella.c" " , the NPC talks with me perfectly (Isabella's conversation).

Then, i think that i need to create a new char's id, and connect it with a new dialog file, but i have searched unsuccesfully in the game folder a file about the chars's id. Actually, i found some files like "LSC_Q2Utilite.c" but i am not sure whether what im doing is a right way to make a "talkative NPC". (XD)

I wouldnt like be a nuisance, asking so much, but.., Do someone of you know what I must to do in order to my NPC talks with my PChar? I will be very grateful for a explanation. Thanks for all and whether someone of you werent able to understand my poor english, please, ask my a better explanation.
 
Every character needs a unique id, this is used to make the character do stuff via code, the dialogs used actually can be the same :shrug (the only place you need to worry about the id to begin with is the characters init entry)
 
The character ID doesn't matter at all, as long as it isn't already used by any other characters in the game.
To get a properly talking character, you just need to assign the correct Dialog.Filename .
The dialog file should be in PROGRAM\DIALOGS . If it is in a subfolder of that folder,
you probably need to indicate that in the Dialog.Filename also.

It's also recommended to enable error logging:
- Open "engine.ini" in your main game folder.
- Find the "debuginfo = 0" line and change it to "debuginfo = 1".
- Find the "runtimelog = 0" line and change it to "runtimelog = 1".
- Find the "tracefilesoff = 1" line and change it to "tracefilesoff = 0".
- Start the game and wait until the error occurs.
- Now find compile.log, system.log and the possible error.log in your main game folder.
It should look like this:
Code:
tracefilesoff = 0
[script]
debuginfo = 1
codefiles = 0
runtimelog = 1

Once you've done this, an error.log will be generated if something goes wrong and it'll usually contain a hint on where you have to search to fix something.
 
Every character needs a unique id, this is used to make the character do stuff via code, the dialogs used actually can be the same :shrug (the only place you need to worry about the id to begin with is the characters init entry)
OMG!!!!! Finally I got it. Thanks.

I read your comment and i wasn't sure to have understood completely... but never mind, i wanted to do some tests more with that new info.
I had to play always a new game to see the new changes. The faster way to came to tortuga's lighthouse -where my NPC was- was using the mode beta (ON), press F11, edit the text box on the top (mayak6, reload, reload1_back) and press acept. I was using this method since the Ugeen's comment. The first tests, didn't work... finally i wanted to start from the begining, in order to know exactly what was wrong in my edited file. I tested one more time with the last succesful edited file, but what a surprise! Didn't work either! (AAAAAAAARRRRGHHHHH !"·$%&/()=?¿|@#~€¬ What is the f****** problem noW!, ...F***!, bang, bang...!).

When the SWAT left my house, (...hahahaha, it's a joke...; ... ; ...only came the policemen, XDDDD), i knew the problem was different. And, what could be more? and i thought on the "F11-system-StartGate" (xD). I did a only change, the "ch.id" (and the location, of course). I came to lighthouse using "F11", but I went to Tortuga's exit-town, and returned to Tortuga's lighthouse. AND THEN, the NPC talked with me without problem...

Thanks again Cpt Maggee, thanks pirates!!


EDIT: Oh! i didnt realize of your comment, Pieter. Im sure that new information helps me a lot. Thank Pieter. Greetings!
 
Back
Top