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

Bug Punitive Squadrons

Jingo7

Landlubber
Hello, not sure if this thread is the best to post this in, but the build has a problem with not encountering 'punitive squadrons' (boats that actively come after you if you've been bad), which I think detracts from enjoyment of the game.

I'm not a coder or nothing but it could be related to this:
In PROGRAM>Encounters>Encounters_map.c
Code:
    // try to make punitive squadron
    ref rMainCharacter = GetMainCharacter();
    int iReputation = sti(rMainCharacter.reputation);
    if(iReputation < 40 && iCharacterIndexAsEnemy != -1)    // FIX-ME
    {
        if(rand(100) < 40 * ((41 - iReputation) / 40))
        {
            iEncounterType = ENCOUNTER_TYPE_PUNITIVE_SQUADRON;
        }
    }
 
    // NK do this below:
    // find real encounter if not punitive
 
    // nation find
    int iNationsCanBe[MAX_NATIONS];
    int iNumNationsCanBe = 0;
    for (int i=0; i<NATIONS_QUANTITY; i++)
    {
        /*bool bCanBe = Encounter_CanNation(iEncounterType, i);
        if(!bCanBe) continue;*/
        if(iCharacterIndexAsEnemy != -1 && GetNationRelation2Character(i, iCharacterIndexAsEnemy) != RELATION_ENEMY) continue;
        if(i == iNearIslandNation && rand(2) == 1)
        {
            iNationsCanBe[0] = i;
            iNumNationsCanBe = 1;
            break;
        }
        iNationsCanBe[iNumNationsCanBe] = i;
        iNumNationsCanBe++;
    }
 
    if(iNumNationsCanBe == 0) return false;
 
    rEncounter.Nation = iNationsCanBe[rand(iNumNationsCanBe - 1)];
 
    // find real encounter if not punitive - NK use FindEncounter() 05-06-27
    if(iEncounterType == -1)
    {
        iEncounterType = FindEncounter(ENCOUNTER_WAR, sti(rEncounter.Nation)); if(iEncounterType == -1) return false;
 
Moved to a separate thread.

I'm not sure whether this is a bug or a feature, but it needs looking into either way.
 
A little while back Baste was working on a project to have dialogs on the loading screens.One of those dialogs mentions punitive squadrons if your reputation gets too low. This might have been a feature of the original game.
 
Did that ever work? If so, we must have done something wrong to break it. But so much was done that it'll be hard to pinpoint what it is that we did. :facepalm
 
personnally, I never had problems with it, its a stock game feature: enemy faction send as regulary as storms some punitives squadrons (happens ONLY on worldmap of course !)

if you use a faction flag, you will always have minimum pirates squadrons after you (I love it and it feels really a nice challenge)

note that fast ships can easily saves you (especially in early game)

if you use your personal flag, no punitives squadrons appear on worldmap !

and note that you can avoid any worldmap meeting by pressing "no" when it asks if you want to meet them in 3d sailing mode !
 
Are you saying that even in the modded game, they DO still work? As long as you're NOT using your personal flag?

And the ability to skip EVERY encounter on the worldmap really should be fixed; that was never intentional. :facepalm
 
they always worked, and thats good for rp purpose ! being hated by the enemies and take their punitive ships to make money or detroy them or flee for you life ! :)

about the ability to skip every encounter thats true that looks not intended (there is a skill mean to add to skip storms or encounter if i remember good) but i dont know where to look ^^
 
about the ability to skip every encounter thats true that looks not intended (there is a skill mean to add to skip storms or encounter if i remember good) but i dont know where to look ^^
I found it. The source appears to be in PROGRAM\MAXIMUS_functions.c . And apparently I have found that before:
Code:
void CalculateEncInfoData()
{
    ref mainCh = GetMainCharacter();
    mainCh.ShipEnc = "none";
    mainCh.CanEscape = 1; // PB: Why can we ALWAYS escape?
    EncRecalcReloadToSea();

    float modifier = 1.0;
    if(checkAttribute(mainCh,"Perks.List.ShipSpeedUp")) { if(sti(mainCh.Perks.List.ShipSpeedUp)) modifier += 0.2; }
    if(checkAttribute(mainCh,"Perks.List.ShipTurnRateUp")) { if(sti(mainCh.Perks.List.ShipTurnRateUp)) modifier += 0.15; }
    if(checkAttribute(mainCh,"Perks.List.SailingProfessional")) { if(sti(mainCh.Perks.List.SailingProfessional)) modifier += 0.65; }
    ref MyShipType = GetShipByType(GetCharacterShipType(mainCh));
    aref arship; makearef(arship, mainCh.ship);
    float SpeedMod = stf(GetLocalShipAttrib(arship, MyShipType, "SpeedRate")) / 12 / stf(mainCh.EncSpeed);
    float sailmod = sqrt(GetSummonSkillFromName(mainCh, SKILL_SAILING)) * 16 * modifier * SpeedMod;
    if(sti(sqrt(GetSummonSkillFromName(mainCh, SKILL_SNEAK)))!=0)
    {
        if( rand(100) / (sqrt(GetSummonSkillFromName(mainCh, SKILL_SNEAK)) * 3.2) > sailmod ) { mainCh.CanEscape = 0; }
    }
}
 
what if i change the line
Code:
mainCh.CanEscape = 1; // PB: Why can we ALWAYS escape?

into something like

Code:
if(*){mainCh.CanEscape = 1;}
else{mainCh.CanEscape = 0;}

replacing * with the character ability which should enable it ? EDIT: its the "sea wolf" ability

[out of subject] => where do we allow voice files and greetings file to a type or specific characters ? i tried to edit "greetings_english.c" but it seems it doesnt changes anything (restarting new storiline after change)
 
what if i change the line
Code:
mainCh.CanEscape = 1; // PB: Why can we ALWAYS escape?
into something like
Code:
if(*){mainCh.CanEscape = 1;}
else{mainCh.CanEscape = 0;}
That would at least allow us to check if this code is still what defines whether you can escape or not.
The idea is that the escape depends on the ship speeds so that you can't outrun a faster vessel than yours; but something somewhere is going wrong on that. :facepalm

[out of subject] => where do we allow voice files and greetings file to a type or specific characters ? i tried to edit "greetings_english.c" but it seems it doesnt changes anything (restarting new storiline after change)
Which character do you want to edit? You have to check his character init entry to see which greeting he uses.
 
=> i edited my last post (what * should looks like, the ability to check is if we have "sea wolf" or not)

EDIT1: should i do
Code:
 if(checkAttribute(mainCh,"Perks.List.SailingProfessional"))
? i am not sure i can write like that here

EDIT2: not working, i still can skip every encounter with
Code:
 if(checkAttribute(mainCh,"Perks.List.SailingProfessional")){mainCh.CanEscape = 1;}
    else{mainCh.CanEscape = 0;}
and
Code:
    if(checkAttribute(mainCh,"Perks.List.SailingProfessional")){
        if(sti(mainCh.Perks.List.SailingProfessional)){mainCh.CanEscape = 1;}
    }
    else{mainCh.CanEscape = 0;}

what did i do bad ? does the functions check if we have the abilities ?


EDIT3: uhm even with just
Code:
mainCh.CanEscape = 0;

i can escape everytime :modding

=> about the greetings i want to just changes female officers voices cause i see that dutch/french/english/pirate have 1 voice and port/spanish/quest characters have more than one, it could be more interesting to add more nice voices because more than one call you "captains" (example dutch have "hallo capitan" and "ja capitan" but dutch officer use only "hallo capitan")

i wanted especially to change danielle green and claire larousse voices (just editing, not adding new ones for both), but in game it doesnt seems to change

i also tested female voice to rys bloom (the one you meet in port royale) because even with woman clothes he is talking like a male (doesnt happens with non-quest officers)
 
PROBLEM FOUND! At the top of PROGRAM\INTERFACE\boal_map.c replace this:
Code:
    //SetNodeUSing("RAMKA",false);

    if(ENABLE_EXTRA_SOUNDS == 1) { PlaySound("sail_ho"); } // NK // bool added by KAM after build 11
With this:
Code:
    //SetNodeUSing("RAMKA",false);

    CalculateInfoData();
    if(ENABLE_EXTRA_SOUNDS == 1) { PlaySound("sail_ho"); } // NK // bool added by KAM after build 11
For some strange reason, this whole function had been bypassed and the code for it never got executed. This should help. :doff
 
oki thanks i go testing encounter now ;)

and hylie as i said, punitive squadrons happens ONLY with factiosn flag (pirate/port/spain/eng/fra/holl) but not personal ;)
 
PROBLEM FOUND! At the top of PROGRAM\INTERFACE\boal_map.c replace this:
Code:
    //SetNodeUSing("RAMKA",false);
 
    if(ENABLE_EXTRA_SOUNDS == 1) { PlaySound("sail_ho"); } // NK // bool added by KAM after build 11
With this:
Code:
    //SetNodeUSing("RAMKA",false);
 
    CalculateInfoData();
    if(ENABLE_EXTRA_SOUNDS == 1) { PlaySound("sail_ho"); } // NK // bool added by KAM after build 11
For some strange reason, this whole function had been bypassed and the code for it never got executed. This should help. :doff

that change FIXED EVERYTHING !

now the encounter skip code is TOTALLY working !

i first used a fast sloop upgraded to 18.89 speed ! i was allowed to skip nearly every punitive squadrons !

and then i just bought a class 3 (heavy warship 60-70 canons) not upgraded so with only around 12 speed and i wasnt able to skip most encounter ! (and when going to 3d sailing battle, thats true i was heavily sniped by fast frigates help by bigger warships)

fully working just cause of a line ! a must have for every players in next version !

so NO CHANGE NEEDED IN maximus_functions.c !!!!!!!!!!!! only the one i quoted in this post is needed HEAVILY !!




==============(out of subject)====================

1) about greetings_english.c does changing a line for example (i took that example randomly) (changing voice)

Code:
    makeref(tmpref, Greetings_Alias[n]);
    tmpref.id = "Gr_Jaoquin de masse";
    tmpref.minDistance = "0.45";
    tmpref.maxDistance = "50.0";
    tmpref.volume = "1.0";
    tmpref.files.l1.name = "VOICE\ENGLISH\Spa_m_a_003.wav";
    n++;

to

Code:
    makeref(tmpref, Greetings_Alias[n]);
    tmpref.id = "Gr_Jaoquin de masse";
    tmpref.minDistance = "0.45";
    tmpref.maxDistance = "50.0";
    tmpref.volume = "1.0";
    tmpref.files.l1.name = "VOICE\ENGLISH\Spa_m_a_002.wav"; //change wav test
    n++;

will change in game what the character say ? or does another file controls what characters must say ?

2) also does that type of change is meant to work ? (still same base example) (changing voice sex)

Code:
    makeref(tmpref, Greetings_Alias[n]);
    tmpref.id = "Gr_Jaoquin de masse";
    tmpref.minDistance = "0.45";
    tmpref.maxDistance = "50.0";
    tmpref.volume = "1.0";
    tmpref.files.l1.name = "VOICE\ENGLISH\Dut_f_a_009.wav"; //change wav test
    n++;

so i can change jaoquin model into woman model (and so he will have female voice) because quest chars can't "switch sex voice" when you change their sex model, but random officer switch voices depending on their model sex

3) also is that change: (adding voice)

Code:
    makeref(tmpref, Greetings_Alias[n]);
    tmpref.id = "Gr_Jaoquin de masse";
    tmpref.minDistance = "0.45";
    tmpref.maxDistance = "50.0";
    tmpref.volume = "1.0";
    tmpref.files.l1.name = "VOICE\ENGLISH\Spa_m_a_003.wav";
    tmpref.files.l2.name = "VOICE\ENGLISH\Spa_m_a_002.wav"; //add wav test
    n++;

is meant to work too ? are we able to add any voices we want that easy ?
 
Thanks for confirming that it works. I'm not sure why that was removed, but I suspect it was when Maximus was experimenting with using a dialog instead of an interface for the encounters.
I'm quite happy we FINALLY managed to track this one down and fix it for good.

Are you aware of any other old features that seem to have gone the way of the dodo for unknown reasons?
This one was a pretty quick fix in the end when I actually went to figure it out; maybe we can do that again...?

As for the sounds system, I know Pirate_KK rewrote it and I'm not 100% certain of what is and isn't included.
From what I understand, things should indeed work as you describe. But you will need to close and reopen the game for the change to take effect.
If it doesn't work on a savegame, try to reinitialize. If that still doesn't work, try to start a new game.

However, there are greetings ALSO in the old RESOURCE\INI\ALIASES\Greetings_alias.ini, which could be confusing things. :facepalm
 
so i perhaps need to look at the 2 greetings files, because when i modify only what i showed, it is not working even with restarting new storyline so the one in RESSOURCE is perhaps for something

also indeed im hunting these type of bugs and:


1) [voices] about the voices there is a number of them missing in game (rnot the most importants by the way):


in PROGRAM\sound\ALIAS\greetings_english.c

Code:
    makeref(tmpref, Greetings_Alias[n]);
    tmpref.id = "Gr_Drunk";
    tmpref.minDistance = "0.45";
    tmpref.maxDistance = "50.0";
    tmpref.files.l1.name = "trep\seaman\12.wav";
    tmpref.files.l2.name = "trep\seaman\13.wav";
    tmpref.files.l3.name = "trep\seaman\14.wav";
    tmpref.files.l4.name = "trep\seaman\16.wav";
    n++;
 
    makeref(tmpref, Greetings_Alias[n]);
    tmpref.id = "Gr_Brothel's mom";
    tmpref.minDistance = "0.45";
    tmpref.maxDistance = "50.0";
    tmpref.volume = "1.0";
    tmpref.files.l1.name = "VOICE\ENGLISH\whore_"+CharSex+"_1.wav";//MAXIMUS: sound from AOP
    tmpref.files.l2.name = "VOICE\ENGLISH\whore_"+CharSex+"_2.wav";//MAXIMUS: sound from AOP
    n++;

    makeref(tmpref, Greetings_Alias[n]);
    tmpref.id = "Gr_Wench";
    tmpref.minDistance = "0.45";
    tmpref.maxDistance = "50.0";
    tmpref.volume = "1.0";
    tmpref.files.l1.name = "trep\female-citizen\001.wav";
    tmpref.files.l2.name = "trep\female-citizen\002.wav";
    tmpref.files.l3.name = "trep\female-citizen\004.wav";
    tmpref.files.l4.name = "trep\female-citizen\009.wav";
    tmpref.files.l5.name = "trep\female-citizen\010.wav";
    tmpref.files.l6.name = "trep\female-citizen\017.wav";
    tmpref.files.l7.name = "trep\female-citizen\020.wav";
    tmpref.files.l8.name = "trep\female-citizen\021.wav";
    tmpref.files.l9.name = "trep\female-citizen\023.wav";
    tmpref.files.l10.name = "trep\female-citizen\025.wav";
    n++;

in RESOURCE\INI\ALIASES\Greetings_alias.ini we can see

Code:
;[Gr_drunk]
;minDistance = 5.0
;maxDistance = 50.0
;volume = 1.0

;[Gr_Brothel's mom]
;minDistance = 5.0
;maxDistance = 50.0
;volume = 1.0

;[Gr_Wench]
;minDistance = 5.0
;maxDistance = 50.0
;volume = 1.0

so i bet some were just deleted (in game it results that the mom says nothing, perhaps giving them some stock voices is enough as they are not "main" characters)



2) [initmodel] about CIII models, they seems all working exept that one


Code:
    if (USECIIIMODELS)
    {
        makeref(model,Models[n]);
        model.description    =  "Young man. Too young for serious fight, but his courage compensates the shortage of experience.";
        model.id            =  "Hero1"; 
        model.FaceId        =  323;
        model.nation        =  HOLLAND;
        model.price            =  2750;
        model.assigned        =  true;
        model.height        =  1.85;
        model.sex            =  "man";
        model.ani            =  "Blaze";
        model.status        =  "C_III"; // added as an identifier, for assigning another animation to the new models
        AssignModelType(isstart, &model, "Captains", 1.0);
        AssignModelTypeNation(isstart, &model, "Captains", 0.2, HOLLAND);
        AssignModelType(isstart, &model, OFFIC_TYPE_ABORDAGE, 1.0);
        AssignModelType(isstart, &model, OFFIC_TYPE_FIRSTMATE, 1.0);
        n++;
    }

so need to change it to:

Code:
/*    if (USECIIIMODELS)
    {
        makeref(model,Models[n]);
        model.description    =  "Young man. Too young for serious fight, but his courage compensates the shortage of experience.";
        model.id            =  "Hero1"; //ARF heavy errors in game
        model.FaceId        =  323;
        model.nation        =  HOLLAND;
        model.price            =  2750;
        model.assigned        =  true;
        model.height        =  1.85;
        model.sex            =  "man";
        model.ani            =  "Blaze";
        model.status        =  "C_III"; // added as an identifier, for assigning another animation to the new models
        AssignModelType(isstart, &model, "Captains", 1.0);
        AssignModelTypeNation(isstart, &model, "Captains", 0.2, HOLLAND);
        AssignModelType(isstart, &model, OFFIC_TYPE_ABORDAGE, 1.0);
        AssignModelType(isstart, &model, OFFIC_TYPE_FIRSTMATE, 1.0);
        n++;
    } */

as it was done for the other CIII bugged models

and as i said i tested a really long time the other and they seems working nice ! (and thats awesome to see more diversity in animations and people in town / crew / captains / shops / sitting animations / more...

it is far better to allow CIII models (some unbugged are allowed even without CIII models for quest purpose, so why not unlocking them all by default ? exept the one deleted already + the one i just quoted)

3) [skill items, just an information] i tested during a long time the max skills an item can gives, i have found that in internalsetting.h:
Code:
// Item skill increases
#define MAX_SKILL_INCREASE            4            // INT - The maximum number of skill points you can gain from items
[B]// Note: 100% untested[/B] [U][B]<= so i wanted to test[/B][/U]

and after much tests by changing number of skill of some items and much test number of that line, i discovered that the number allows the max skill points the item gives PER SKILL

for example if and item give 9 leadership and 9 melee and max is 4 it will give 4 of each skill (cause of conflict, it can gives less sometime)

but if you put 9 to max skill, the item will gives +9 to both skills ! (works on officers too of course)

its the same story if the item gives -x skill points :)


thats all at the moment ^^
 
Are you SURE Hero1 is the only one causing troubles? I thought there were more. Crazy part is:
They tend to work at first, but on the next location reload, the GM loading is bugged and you get a black screen. :modding

3. That sounds like exactly what it was coded to do. Thanks for confirming that it works. :doff
 
i still using every other CIII models and they seems to work (did entirely the main nataniel hawk quest with them) i really never met any bug with them (used everyone in crew, officer and as personal models, and also used as captains [boarded and killed "some" :D ], enemy/neutral citizen and crews => never got any crash or black screens)


so here is the exact list of every CIII models working great !

=> already allowed one (even if CIII is not allowed)
Devlin
Espinosa
Modyford
Morgan

=> the one only unlocked by CIII settings
BigPirate
Chard
Chard2
Chard3
Gaskon
Hero
Mansfield
Youngman



these do NOT work !

=> Ostin (already /*commented*/ in initmodel)
=> Hero1 (MUST BE /*COMMENTED*/ in initmodel as i have shown)


FOR CIII MODELS DIVERSITY ! :)

http://image.noelshack.com/fichiers/2013/12/1363625270-2013-03-18-00001.jpg
 
Back
Top