Morgan1665
Landlubber
Hello to you all, I'm new, also I'm making my private mode (for myself), I just want it share some information for coding the game, because finding a coding tutorials for this game coding it's quite difficult (because it's russian), if you have a better idea about my codes then please share with me, I hope this my little tips
help the some people have a good day (Sorry about my poor english I'm not american or russian)....
First Tip:
Before adding more items to game, then you need to increase the
number of items quantity on the "items.h" file, code is #define ITEMS_QUANTITY 220,
220 are total present items in the "Age of Pirates 2\Program\ITEMS\initItems.c" (Original file), if you don't increase number then game reach the memory leak and new (Not overwrites!) items become stuck, never show up in the game, also at the error log file you get "initItems.c invalid index error something like a [size 220]" don't forget the increase the number, also don't increase too much just increase them how many items you add it
in the game.
Second Tip:
Also I have found it how add female heroes to game... I mean the "HeroDescribe.txt" file, well if we add the
female character to game and, if we set her gender value to "sex_4 {woman}", then we face the problem. Everybody saying for fix this problem just change to "sex_4 {man}" I say, Why? I track the files for find the codes, which files runing their scripts? Yes I found them at the "Age of Pirates 2\Program\scripts\PsHero.c" on the begining you see the code over there,
"if (GetNewMainCharacterParam("sex_" + n) == "man" && n != startHeroType)" are you notice the "man" value? if you change the "man" to "woman" only female chracters show up... So I just add it new "if" at the bottom. And here this:
Note: Watch out if you have no "YokoDias" then use the "Danielle", or whatever you like
And the my last Tip:
Adding female officers to game you just need to edit "Age of Pirates 2\Program\loc_ai\LAi_utilites.c" and find this line;
iCitizensQuantity = rand(6) - 3;
for (i = 0; i <iCitizensQuantity; i++)
blah blah something like that... Ok we need to write a new code here for both genders womans and mans (Unique of course)... So here this the my code:
Important note for the female names; FIXED
So our female officers here, officerF_1 to officerF_9 they're only spawn at the pirate locations (with this code female officers get their, female sound, female name, female gender and their own animation, looks perfect to me), Resc_5 is a man for some add on you know.... At the other nations location you find the default officers. (Don't worry they have man sound, gender, animation etc.) Before I forget, don't forget the edit facemaker file, otherwise your female officer interfaces won't work or show the default pictures. I hope you like it.
help the some people have a good day (Sorry about my poor english I'm not american or russian)....
First Tip:
Before adding more items to game, then you need to increase the
number of items quantity on the "items.h" file, code is #define ITEMS_QUANTITY 220,
220 are total present items in the "Age of Pirates 2\Program\ITEMS\initItems.c" (Original file), if you don't increase number then game reach the memory leak and new (Not overwrites!) items become stuck, never show up in the game, also at the error log file you get "initItems.c invalid index error something like a [size 220]" don't forget the increase the number, also don't increase too much just increase them how many items you add it
in the game.
Second Tip:
Also I have found it how add female heroes to game... I mean the "HeroDescribe.txt" file, well if we add the
female character to game and, if we set her gender value to "sex_4 {woman}", then we face the problem. Everybody saying for fix this problem just change to "sex_4 {man}" I say, Why? I track the files for find the codes, which files runing their scripts? Yes I found them at the "Age of Pirates 2\Program\scripts\PsHero.c" on the begining you see the code over there,
"if (GetNewMainCharacterParam("sex_" + n) == "man" && n != startHeroType)" are you notice the "man" value? if you change the "man" to "woman" only female chracters show up... So I just add it new "if" at the bottom. And here this:
Note: Watch out if you have no "YokoDias" then use the "Danielle", or whatever you like
Code:
PsHeroQty = 0; // ãëîáàëüíàÿ ïåğåìåííàÿ
for (n=1; n<=heroQty; n++)
{
if (GetNewMainCharacterParam("sex_" + n) == "man" && n != startHeroType) // òîêî ìóæèêè
{
PsHeroQty++;
ch = GetCharacter(NPC_GenerateCharacter("PsHero_" + PsHeroQty, "off_hol_2", "man", "man", 5, PIRATE, -1, true));
ch.PGGAi.HeroNum = n; // íîìåğ â ôàéëå
ch.reputation = 2 + rand(86);
ch.RebirthPhantom = true; // íå òåğåòü ôàíòîìà-ìíîãîäíåâêó (ñ -1), åñëè óìåğ
setNewMainCharacter(ch, n);
ch.Dialog.Filename = "pgg_dialog.c";
ch.greeting = "Gr_PsHero";
//navy -->
ch.SaveItemsForDead = true; //ñîõğàíÿåì âñå âåùè
ch.DontClearDead = true; // íå óáèğàòü òğóï ÷åğåç 200ñ
ch.DontRansackCaptain = true; //êâåñòîâûå íå ñäàşòñÿ
ch.AlwaysSandbankManeuver = true; // òóïûì çàïğåò òîíóòü îá áåğåã
ch.perks.list.ByWorker = "1";
ch.perks.list.ShipEscape = "1";
ch.loyality = 10 + rand(10); //ëîÿëüíîñòü
if (sti(ch.reputation) > 41)
{
ch.alignment = "good";
}
else
{
ch.alignment = "bad";
}
ch.HoldEquip = true; //íå îòäàâàòü îğóæèå
ch.PGGAi = true; // ïğèçíàê, ÷òî ÏÃÃ
ch.PGGAi.IsPGG = true; // â äàííûé ìîìåíò íå îôèöåğ ÃÃ
ch.PGGAi.location = "land"; // ãäå ñóøà-ìîğå
ch.PGGAi.location.town = PGG_FindRandomTownByNation(sti(ch.nation));
//navy <--
SetFantomParamFromRank(ch, 1 + rand(3), true); //ãåíåğèì ñòàòû TO_DO íà îòäåëüíî ñïåöèàë è ıìóëÿòîğ ñêèëîâ
trace("PGG " + GetFullName(ch) + " starting rank " + sti(ch.rank));
}
// Here this new if begining for fix to spawn your own hero clone! I use the two if section because I
// already use the "skeleton" gender too for some special case. With this two "if" section game dosen't spawn
// the our skeleton gender in game, only you can use it.
if (GetNewMainCharacterParam("sex_" + n) == "woman" && n != startHeroType)
{
PsHeroQty++;
ch = GetCharacter(NPC_GenerateCharacter("PsHero_" + PsHeroQty, "YokoDias", "woman", "YokoDias", 5, PIRATE, -1, true));
ch.PGGAi.HeroNum = n; // íîìåğ â ôàéëå
ch.reputation = 2 + rand(86);
ch.RebirthPhantom = true; // íå òåğåòü ôàíòîìà-ìíîãîäíåâêó (ñ -1), åñëè óìåğ
setNewMainCharacter(ch, n);
ch.Dialog.Filename = "pgg_dialog.c";
ch.greeting = "Gr_PsHero";
//navy -->
ch.SaveItemsForDead = true; //ñîõğàíÿåì âñå âåùè
ch.DontClearDead = true; // íå óáèğàòü òğóï ÷åğåç 200ñ
ch.DontRansackCaptain = true; //êâåñòîâûå íå ñäàşòñÿ
ch.AlwaysSandbankManeuver = true; // òóïûì çàïğåò òîíóòü îá áåğåã
ch.perks.list.ByWorker = "1";
ch.perks.list.ShipEscape = "1";
ch.loyality = 10 + rand(10); //ëîÿëüíîñòü
if (sti(ch.reputation) > 41)
{
ch.alignment = "good";
}
else
{
ch.alignment = "bad";
}
ch.HoldEquip = true; //íå îòäàâàòü îğóæèå
ch.PGGAi = true; // ïğèçíàê, ÷òî ÏÃÃ
ch.PGGAi.IsPGG = true; // â äàííûé ìîìåíò íå îôèöåğ ÃÃ
ch.PGGAi.location = "land"; // ãäå ñóøà-ìîğå
ch.PGGAi.location.town = PGG_FindRandomTownByNation(sti(ch.nation));
//navy <--
SetFantomParamFromRank(ch, 1 + rand(3), true); //ãåíåğèì ñòàòû TO_DO íà îòäåëüíî ñïåöèàë è ıìóëÿòîğ ñêèëîâ
trace("PGG " + GetFullName(ch) + " starting rank " + sti(ch.rank));
}
}
And the my last Tip:
Adding female officers to game you just need to edit "Age of Pirates 2\Program\loc_ai\LAi_utilites.c" and find this line;
iCitizensQuantity = rand(6) - 3;
for (i = 0; i <iCitizensQuantity; i++)
blah blah something like that... Ok we need to write a new code here for both genders womans and mans (Unique of course)... So here this the my code:
Important note for the female names; FIXED
Code:
iCitizensQuantity = rand(6) - 3;
for (i = 0; i <iCitizensQuantity; i++)
{
iChar = NPC_GeneratePhantomCharacter("pofficer", iNation, MAN, 1);
chr = &characters[iChar];
if(iNation == PIRATE)
{
chr.model = "OfficerF_"+(rand(8)+1);
chr.sex = "woman";
SetRandomNameToCharacter(chr);
chr.greeting = "Gr_Danielle";
}
else
{
chr.model = RandPhraseSimple("Officer_"+(rand(11)+1), "Resc_5");
chr.greeting = "Gr_Officer";
}
if (chr.model == "OfficerF_1" || chr.model == "OfficerF_2" || chr.model == "OfficerF_3" || chr.model == "OfficerF_4")
{
chr.model.animation = "victoria";
}
if (chr.model == "OfficerF_5")
{
chr.model.animation = "Angellica";
}
if (chr.model == "OfficerF_6")
{
chr.model.animation = "Danielle";
}
if (chr.model == "OfficerF_7" || chr.model == "OfficerF_8" || chr.model == "OfficerF_9")
{
chr.model.animation = "woman3_ab";
}
FaceMaker(chr);
SetOfficerParam(chr, rand(4));
sTemp = PlaceCharacter(chr, "sit", "random_free");
ReSitCharacterOnFree(chr, loc.id, sTemp);
LAi_SetSitType(chr);
chr.dialog.filename = "Enc_Officer_dialog.c";
chr.dialog.currentnode = "first time";
if (sti(Colonies[iColony].HeroOwn) == true)
{
LAi_group_MoveCharacter(chr, LAI_GROUP_PLAYER_OWN);
}
else
{
LAi_group_MoveCharacter(chr, slai_group);
}
}
So our female officers here, officerF_1 to officerF_9 they're only spawn at the pirate locations (with this code female officers get their, female sound, female name, female gender and their own animation, looks perfect to me), Resc_5 is a man for some add on you know.... At the other nations location you find the default officers. (Don't worry they have man sound, gender, animation etc.) Before I forget, don't forget the edit facemaker file, otherwise your female officer interfaces won't work or show the default pictures. I hope you like it.