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

Officers experience

bltooff

Landlubber
I want to change exp points to my Officers, coz they get too few points when my exp up. i have no idea how get it. maybe it`s in the program\characters\CharacterUtilite.c

-----------------------------------------------------------------------------------

<i>void AddPartyExp(ref _refCharacter,int _exp)
{
AddCharacterExp(_refCharacter, _exp);
int cn,i;
for(i=0; i<PASSENGERS_MAX; i++)
{
cn = GetPassenger(_refCharacter,i);
if( cn<0 ) break;
if(isPrisonedChar(&characters[cn]) == false)
{
AddCharacterExp(GetCharacter(cn),(_exp / 10));
}
}
for(i=1; i<4; i++)
{
cn = GetOfficersIndex(_refCharacter,i);
if(cn!=-1) {
AddCharacterExp(GetCharacter(cn),(_exp / 10));
}
}
for(i=1; i<COMPANION_MAX; i++)
{
cn = GetCompanionIndex(_refCharacter,i);
if(cn!=-1) {
AddCharacterExp(GetCharacter(cn),(_exp / 10));
}
}
}</i>
--------------------------------------------------------------------------------------------------------------------

when i get perks "genius" , Officers get only 10% from my exp points ,....good to be change it to 50%.
 
Did you get this from the mod ?


change all the values to 50 ( after backing up the file ) .

Before doing anything ...use the cheat command expbooster...count how many it takes or just write down the change in experience under the officers name .

Change the value in the file to 50


Go back and use the cheat .

see any difference ?



I did ....passenger with 92912 exp went to 93132...after changing to 50.

same passenger after changing back to 10 went to 94912 from 92912


So I changed it to 1.0


92912 went to 103912


But herein lies the problem ....if your officers go up in levels they go down in loyalty.

You will destroy the balance( what little there is ) .

Further above is a " loyalty index for morale" make all values equal " fanatic ?


Or is there another way?


I have been crying for a trainer to tame the officers with...but it falls on deaf ears.

But hey ...maybe you can keep them at sea and let them collect some paychecks to get loyalty up....something broke in the game because you rarely end up at sea for 30 days and it takes a good many paychecks to RAISE loyalty.


I say make them all have only one loyaly..fanativc ..period no matter what ...do away with that stupid broken aspect of the game . If it was defined better and was easier to implement and use it would have been interesting...and a decent part of the game ...but as it is its broken and stupid.



BTW way your answer is not to change it to 50 but to 1.0 if you want them to gain more exp...but prepare yourself for the consequences .
 
I played around with this, setting the xp to different levels. I'm using version 1.41 with Supermod(update 3). I've found that setting the "getofficerindex" line does nothing. My latest attempt was to set the xp up so that passengers got 10%, officers 20%, and companions 30% (base, add 10% for Mentor). I was trying to reflect that ship captains ought to get more xp for what they do than people who just are along for the ride. I found out, not only that "mentor" doesn't seem to work at all, but the "getofficerindex" makes no change in any experience for any character. "Getpassenger" seems to be the experience gain for both the officers and the passengers.

All that being told, I set passenger xp to 30%, and Companion xp to 40% (the 20% and 30% plus mentor) or _exp / 3.33 and _exp / 2.5 respectively. The one thing I did not notice was loyalty problems. In my most current game, I'm playing on Captain difficulty and did not have a botswain or leadership skills. By the time I was lvl 5, most of the officers I picked up at lvl 1 (the officers were lvl 1) were fanatical loyalty. Only 2 months had passed, and I even missed a paycheck.

Any of you mod types know why the mentor perk doesn't work, or perhaps can tell me if I'm misunderstanding the "getpassenger" and "getofficerindex" variables?
 
Just to update I made it impossible almost for my officers to quit...unless I turn pirate ..I did not change that.
 
<!--quoteo(post=177907:date=Jan 4 2007, 04:14 PM:name=Tokyo Breakfast)--><div class='quotetop'>QUOTE(Tokyo Breakfast @ Jan 4 2007, 04:14 PM) [snapback]177907[/snapback]</div><div class='quotemain'><!--quotec-->[...] I've found that setting the "getofficerindex" line does nothing. My latest attempt was to set the xp up so that passengers got 10%, officers 20%, and companions 30% (base, add 10% for Mentor). [...]<!--QuoteEnd--></div><!--QuoteEEnd-->

GetOfficerIndex is called within a loop counting from 1 to 3:
for(i=1; i<4; i++)

So this could be only for the fighters then, as you can have three of them, but this is more guessing than knowing.
Can anyone tell more to this?

========

The 'mentor' perk is taken into account in AddCharacterExperience - but be aware, that this multiplies the exp by 2 in reality!
Well, this is fine, if using 10 %, so this will result in 20 %, but if you take other values, you have to consider this then!

And it works, but only for those officers without job or employed as "fighter"!!!

I suppose GetNotQuestCharacter() to cause the problem, it might not deliver the expected result. I'll have a try later (currently I ruined my installation of AoP while testing...).

If you're right and officers are considered as passengers, you might still get them different values. Probably you will have to make the difference exactly here, in AddCharacterExperience().

I'll have to put an eye on the isfree-attribute, whatever this might be for (imprisonment or unemployment?).


By the way, why do you calculate the value by division? You use floating point values anyway (!) (in c/c++, you would have to convert the result to int before - but the scripts for AoP seem to be more tolerant). Multiplication is certainly more efficient (*0.3, *0.4), or you stay in the int-range (val = val*3/10). Could be that two int operations are still more efficient than one for floating point numbers...
 
Ok, game running again. Had a closer look at the scripts and performed some tests.

Result: 'officers' in the terms of the scripts means those officers (in terms of game) who are employed as fighters (who can be up to three).

And I got the 'mentor' perk finally to work as expected:

In program\characters\CharacterUtilite.c you find a method int AddCharacterExp(ref, int).

Replace this part of code (the dots at the beginning are just for indenting, as whitespaces are eaten by the forum...):

<!--coloro:#FFFF00--><span style="color:#FFFF00"><!--/coloro--><!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->
if(CheckCharacterPerk(pchar, "Teacher") )
{
...int icn = GetPassengerNumber(pchar, sti(_refCharacter.index));
...if( icn != -1)
...{
......if(GetNotQuestPassenger(pchar, icn) != -1)
......{
.........if(isPrisonedChar(_refCharacter) == false)
.........{
............ _exp = _exp * 2.0;
.........}
......}
...}
}
<!--fontc--></span><!--/fontc-->
<!--colorc--></span><!--/colorc-->

with this (I left out the dots this time so you can copy and paste):

<!--coloro:#FFFF00--><span style="color:#FFFF00"><!--/coloro--><!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->
if(pchar.id != _refCharacter.id)
{
if(CheckCharacterPerk(pchar, "Teacher") )
{
if(isPrisonedChar(_refCharacter) == false)
{
if(CheckAttribute(_refCharacter, "isquest") == false)
{
_exp = _exp * 2.0;
}
}
}
}
<!--fontc--></span><!--/fontc--><!--colorc--></span><!--/colorc-->

Important: In void AddPartyExp(ref, int) you have to remove or comment out this part of code:

<!--coloro:#FFFF00--><span style="color:#FFFF00"><!--/coloro--><!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->
for(i=1; i<4; i++)
{
cn = GetOfficersIndex(_refCharacter,i);
if(cn!=-1)
{
AddCharacterExp(GetCharacter(cn),(_exp / 10));
}
}
<!--fontc--></span><!--/fontc--><!--colorc--></span><!--/colorc-->
(*)

Else the fighters will get the exp twice (so the mentor perk would give those officers 20% extra exp, too).

<!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->This is not the same for companions!<!--colorc--></span><!--/colorc-->


Explanations to my code::

this is to avoid that the mentor perk affecting the main character, too
(replaces getting the passenger number and check for -1, as this is much easier)
<!--coloro:#FFFF00--><span style="color:#FFFF00"><!--/coloro--><!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->if(pchar.id != _refCharacter.id)
{<!--fontc--></span><!--/fontc--><!--colorc--></span><!--/colorc-->
check for the mentor perk, as had before
<!--coloro:#FFFF00--><span style="color:#FFFF00"><!--/coloro--><!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->...if(CheckCharacterPerk(pchar, "Teacher") )
...{<!--fontc--></span><!--/fontc--><!--colorc--></span><!--/colorc-->
check for imprisonment, as had before
<!--coloro:#FFFF00--><span style="color:#FFFF00"><!--/coloro--><!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->......if(isPrisonedChar(_refCharacter) == false)
......{<!--fontc--></span><!--/fontc--><!--colorc--></span><!--/colorc-->
this check replaces the GetNotQuestPassenger-Check! This was the critical point,
as in this method passengers with the attribute "isfree" (those seem to be the employed officers)
are NOT recognized - here I have to admit an error before, when I said that the perk works for fighters - they
probably got double experience from the code part above (*)
<!--coloro:#FFFF00--><span style="color:#FFFF00"><!--/coloro--> <!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->.........if(CheckAttribute(_refCharacter, "isquest") == false)
.........{
............ _exp = _exp * 2.0;
.........}
......}
...}
}<!--fontc--></span><!--/fontc--><!--colorc--></span><!--/colorc-->
 
<!--quoteo(post=177907:date=Jan 4 2007, 04:14 PM:name=Tokyo Breakfast)--><div class='quotetop'>QUOTE(Tokyo Breakfast @ Jan 4 2007, 04:14 PM) [snapback]177907[/snapback]</div><div class='quotemain'><!--quotec-->I played around with this, setting the xp to different levels. I'm using version 1.41 with Supermod(update 3). I've found that setting the "getofficerindex" line does nothing. My latest attempt was to set the xp up so that passengers got 10%, officers 20%, and companions 30% (base, add 10% for Mentor). I was trying to reflect that ship captains ought to get more xp for what they do than people who just are along for the ride. I found out, not only that "mentor" doesn't seem to work at all, but the "getofficerindex" makes no change in any experience for any character. "Getpassenger" seems to be the experience gain for both the officers and the passengers.

All that being told, I set passenger xp to 30%, and Companion xp to 40% (the 20% and 30% plus mentor) or _exp / 3.33 and _exp / 2.5 respectively. The one thing I did not notice was loyalty problems. In my most current game, I'm playing on Captain difficulty and did not have a botswain or leadership skills. By the time I was lvl 5, most of the officers I picked up at lvl 1 (the officers were lvl 1) were fanatical loyalty. Only 2 months had passed, and I even missed a paycheck.

Any of you mod types know why the mentor perk doesn't work, or perhaps can tell me if I'm misunderstanding the "getpassenger" and "getofficerindex" variables?<!--QuoteEnd--></div><!--QuoteEEnd-->

This is a nice idea, but to me the values appear too high, I personally use 10 % , 15 % and 20 %. Managed to get a solution (code below is with 10 %, 20 % and 30 %), some first tests looked fine (when applying this, do not forget to remove the officer part in AddPartyExp(); see my post before!):

<!--coloro:#FFFF00--><span style="color:#FFFF00"><!--/coloro--><!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->
if(CheckCharacterPerk(_refCharacter, "Student"))
{
_exp = _exp * 1.1;
}

int origExp = _exp;

if(pchar.id != _refCharacter.id)
{
if(CheckAttribute(_refCharacter, "isfree") == true)
{
_exp = _exp * 2;
}
else
{
if(IsCompanion(_refCharacter))
{
_exp = _exp * 3;
}
}
if(CheckCharacterPerk(pchar, "Teacher") )
{
if(isPrisonedChar(_refCharacter) == false)
{
if(CheckAttribute(_refCharacter, "isquest") == false)
{
_exp = _exp + origExp;
}
}
}
}
<!--fontc--></span><!--/fontc-->
<!--colorc--></span><!--/colorc-->

I remember the original value of _exp so this represents the original 10 %. On mentor perk, this original value is then added. There is now one philosophic question: Shall we add on these additional 10 % of the mentor perk the student bonus of the officer, too, or not???

The implementation above does so, as the original implementation did this, too. If we do not want this, we simply have to put the first two parts of the code the other way round:

<!--coloro:#FFFF00--><span style="color:#FFFF00"><!--/coloro--><!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->
int origExp = _exp;

if(CheckCharacterPerk(_refCharacter, "Student"))
{
_exp = _exp * 1.1;
}
<!--fontc--></span><!--/fontc--><!--colorc--></span><!--/colorc-->
 
Back
Top