• 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: High cost of ship maintenance on a new mission for TEHO.

JTem

Freebooter
Staff member
Storm Modder
Hello colleagues.:ahoy

I would like to know the code where the amount of ship maintenance is programmed.:read

A colleague has created a new mission for the TEHO and I can't test it because of the high cost.:shrug
 
Hello colleagues.:ahoy

I would like to know the code where the amount of ship maintenance is programmed.:read

A colleague has created a new mission for the TEHO and I can't test it because of the high cost.:shrug
time_events.c not sure but atleast there is the whole crew salary etc

EDIT: mayby in Crew.c that looks like it would affect the upkeep of the crew
Code:
int GetSalaryForShip(ref chref)
{
    int i, cn, iMax;
    ref mchref, offref;
    int nPaymentQ = 0;
    float fExp;
    mchref = GetMainCharacter();

    float nLeaderShip = GetSummonSkillFromNameToOld(mchref,SKILL_LEADERSHIP);
    float nCommerce   = GetSummonSkillFromNameToOld(mchref,SKILL_COMMERCE);

    float shClass = GetCharacterShipClass(chref);
    if (shClass   < 1) shClass   = 6;
    if (!GetRemovable(chref) && sti(chref.index) != GetMainCharacterIndex()) return 0; // считаем только своих, а то вских сопровождаемых кормить!!!
      
    // экипаж
    fExp = (GetCrewExp(chref, "Sailors") + GetCrewExp(chref, "Cannoners") + GetCrewExp(chref, "Soldiers")) / 100.00; // средний коэф опыта 0..3
    nPaymentQ += makeint( fExp * stf((0.5 + MOD_SKILL_ENEMY_RATE/5.0)*200*GetCrewQuantity(chref))/stf(shClass) * (1.05 - (nLeaderShip + nCommerce)/ 40.0) );
  
    // теперь самого капитана и его офицеров (тут  главный герой не считается) так что пассажиров и оффицеров ниже
    if(sti(chref.index) != GetMainCharacterIndex())
    {
        nPaymentQ += makeint(GetMoneyForOfficer(chref)*2/(nLeaderShip + nCommerce) );
        // офицеры
        for(i = 1; i < 4; i++)  // в к3 нет офов у компаньона :(
        {
            cn = GetOfficersIndex(chref, i);
            if( cn > 0 )
            {
                offref = GetCharacter(cn);
                if (GetRemovable(offref)) // считаем только своих, а то вских сопровождаемых кормить!!!
                {
                    nPaymentQ += makeint(GetMoneyForOfficerFull(offref));
                }
            }
        }
    }
    if(sti(chref.index) == GetMainCharacterIndex()) // все пассажиры и офицеры для гл героя
    {
        iMax = GetPassengersQuantity(mchref);
        for(i=0; i < iMax; i++)
        {
            cn = GetPassenger(mchref,i);
            if(cn != -1)
            {
                if(!IsCompanion(GetCharacter(cn)))
                {
                    offref = GetCharacter(cn);
                    if (GetRemovable(offref)) // считаем только своих, а то вских сопровождаемых кормить!!!
                    {
                        if(CheckAttribute(offref,"prisoned"))
                        {
                            if(sti(offref.prisoned)==true) continue;
                        }
                        nPaymentQ += makeint(GetMoneyForOfficerFull(offref));
                    }
                }
            }
        }
    }
    return nPaymentQ;
}
// boal новый учет зп <--
EDIT 2: sry no clue
 
Last edited:
time_events.c not sure but atleast there is the whole crew salary etc

EDIT: mayby in Crew.c that looks like it would affect the upkeep of the crew
Code:
int GetSalaryForShip(ref chref)
{
    int i, cn, iMax;
    ref mchref, offref;
    int nPaymentQ = 0;
    float fExp;
    mchref = GetMainCharacter();

    float nLeaderShip = GetSummonSkillFromNameToOld(mchref,SKILL_LEADERSHIP);
    float nCommerce   = GetSummonSkillFromNameToOld(mchref,SKILL_COMMERCE);

    float shClass = GetCharacterShipClass(chref);
    if (shClass   < 1) shClass   = 6;
    if (!GetRemovable(chref) && sti(chref.index) != GetMainCharacterIndex()) return 0; // считаем только своих, а то вских сопровождаемых кормить!!!
     
    // экипаж
    fExp = (GetCrewExp(chref, "Sailors") + GetCrewExp(chref, "Cannoners") + GetCrewExp(chref, "Soldiers")) / 100.00; // средний коэф опыта 0..3
    nPaymentQ += makeint( fExp * stf((0.5 + MOD_SKILL_ENEMY_RATE/5.0)*200*GetCrewQuantity(chref))/stf(shClass) * (1.05 - (nLeaderShip + nCommerce)/ 40.0) );
 
    // теперь самого капитана и его офицеров (тут  главный герой не считается) так что пассажиров и оффицеров ниже
    if(sti(chref.index) != GetMainCharacterIndex())
    {
        nPaymentQ += makeint(GetMoneyForOfficer(chref)*2/(nLeaderShip + nCommerce) );
        // офицеры
        for(i = 1; i < 4; i++)  // в к3 нет офов у компаньона :(
        {
            cn = GetOfficersIndex(chref, i);
            if( cn > 0 )
            {
                offref = GetCharacter(cn);
                if (GetRemovable(offref)) // считаем только своих, а то вских сопровождаемых кормить!!!
                {
                    nPaymentQ += makeint(GetMoneyForOfficerFull(offref));
                }
            }
        }
    }
    if(sti(chref.index) == GetMainCharacterIndex()) // все пассажиры и офицеры для гл героя
    {
        iMax = GetPassengersQuantity(mchref);
        for(i=0; i < iMax; i++)
        {
            cn = GetPassenger(mchref,i);
            if(cn != -1)
            {
                if(!IsCompanion(GetCharacter(cn)))
                {
                    offref = GetCharacter(cn);
                    if (GetRemovable(offref)) // считаем только своих, а то вских сопровождаемых кормить!!!
                    {
                        if(CheckAttribute(offref,"prisoned"))
                        {
                            if(sti(offref.prisoned)==true) continue;
                        }
                        nPaymentQ += makeint(GetMoneyForOfficerFull(offref));
                    }
                }
            }
        }
    }
    return nPaymentQ;
}
// boal новый учет зп <--
EDIT 2: sry no clue

Thank you very much for your answer, I would really like to be able to test this mission.

The colleague who created it can't do it and with my limited knowledge I'm not sure about it.
 
so as i sayed earlier scripts/Crew.c and u want to edit this line:
Code:
    nPaymentQ += makeint( fExp * stf((0.5 + MOD_SKILL_ENEMY_RATE/5.0)*200*GetCrewQuantity(chref))/stf(shClass) * (1.05 - (nLeaderShip + nCommerce)/ 40.0) );
now to the numbers and how to balance it, didnt spend muche time or thinking bout that but i did edited this line of code for a test and it worked
here i posted the vanila lnie of code, this will only affect crew wages, not officer wages and/or ship repair costs in the file above this line is a line that increases the wages aswell based on ur ship, wchich rank it is, so only adjusting that one number shuld alread have an impact on salarys in general
ship repair cost are calculated diffrently based on ship rank base ship cost, + in general i think the game difficulty shuld have something to do as how muche everything shuld cost more but saddly forgotten to check that one:p so i will check it mayby tonight and will post my findings

On a side note if u using Hooks mod then the file scripts/Crew.c is aswell in the mod so edit that one included in hes mod, so that the mod properly works

EDIT: the value *200* in middle of that line i guess its the base peso payment per crew member be4 that is the formula on increasing the wages based on ur crew exp if thay landlubers or sea dogs, and behind the 200 is the formula of cre quantity and ship class to further increase the wages then a small debuff based on ur leadership and trade skills.... so if u want to do it on fast without going into math, change the 200 to 100 u will lower the wages ~half, if ur crew will still be to greedy cut it to 50 or even 0, for mod testing ur crew can do some charity work
 
Last edited:
so as i sayed earlier scripts/Crew.c and u want to edit this line:
Code:
    nPaymentQ += makeint( fExp * stf((0.5 + MOD_SKILL_ENEMY_RATE/5.0)*200*GetCrewQuantity(chref))/stf(shClass) * (1.05 - (nLeaderShip + nCommerce)/ 40.0) );
now to the numbers and how to balance it, didnt spend muche time or thinking bout that but i did edited this line of code for a test and it worked
here i posted the vanila lnie of code, this will only affect crew wages, not officer wages and/or ship repair costs in the file above this line is a line that increases the wages aswell based on ur ship, wchich rank it is, so only adjusting that one number shuld alread have an impact on salarys in general
ship repair cost are calculated diffrently based on ship rank base ship cost, + in general i think the game difficulty shuld have something to do as how muche everything shuld cost more but saddly forgotten to check that one:p so i will check it mayby tonight and will post my findings

On a side note if u using Hooks mod then the file scripts/Crew.c is aswell in the mod so edit that one included in hes mod, so that the mod properly works

EDIT: the value *200* in middle of that line i guess its the base peso payment per crew member be4 that is the formula on increasing the wages based on ur crew exp if thay landlubers or sea dogs, and behind the 200 is the formula of cre quantity and ship class to further increase the wages then a small debuff based on ur leadership and trade skills.... so if u want to do it on fast without going into math, change the 200 to 100 u will lower the wages ~half, if ur crew will still be to greedy cut it to 50 or even 0, for mod testing ur crew can do some charity work

Thank you very much for the tip, I will try it.:cheers
 
...EDIT: the value *200* in middle of that line i guess its the base peso payment per crew member be4 that is the formula on increasing the wages based on ur crew exp if thay landlubers or sea dogs, and behind the 200 is the formula of cre quantity and ship class to further increase the wages then a small debuff based on ur leadership and trade skills.... so if u want to do it on fast without going into math, change the 200 to 100 u will lower the wages ~half, if ur crew will still be to greedy cut it to 50 or even 0, for mod testing ur crew can do some charity work
I like the sound of that... "charity work" xD:woot:guns:
 
You welcome

pls let me know if that helped or was more or less that what u where looking for, ty

:ahoy
Sorry, I'm testing it and it seems to work correctly, I leave you a couple of screenshots with the maintenance cost and the change in the code.

Thanks to your help I can continue testing this new mission, I want to make a video with the gameplay in the future... :cheers


Captura de pantalla (151).png Captura de pantalla (152).png
 
Just wanted to add a ref. regarding officer wages.
Open scripts/Crew.c with notepad++. In line 80 " (if (CheckAttribute(Npchar, "Payment") && makeint(Npchar.Payment) == true) " if you set end value to false removes officer wage alltogether. Since its script this can be turned on/off without starting a new game.
 
Just wanted to add a ref. regarding officer wages.
Open scripts/Crew.c with notepad++. In line 80 " (if (CheckAttribute(Npchar, "Payment") && makeint(Npchar.Payment) == true) " if you set end value to false removes officer wage alltogether. Since its script this can be turned on/off without starting a new game.
Thank you very much for your help.
 
Back
Top