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

High Priority Change way shared XP works

It shouldn't be much more work and I like to have the Option open.
I will try to look at it today and else it will be tomorrow.
 
Included in here:

Mod Release - Levis' Stuff [Jan 12] | PiratesAhoy!

this is how it works now:

XP is either for party or officers (or player in some edge cases)

If it's for the party the system first determines all the captains in this party. for each of them the function is called again but for the officers group now.

If the function is called for officers it will determine all of the officers for the captain. If you are not the captain of this group it will find the captain and call it again for the officer group.

If called for officers and you are the captain of this group it will loop trough all passengers. It will skip passengers and only assign xp to real officers. If you are a officer it will check if you are contributing the skill the xp is given for. If so it will go on. Else it will check if ShareXP is active. if so it will go on also. Now it will call the function for each in the group PLAYER.

If the function is called for a Player the xp is multiplied with the right multipliers and given to the character.

or in code:

Code:
bool AddXP(ref chref, string expName, int _exp, string group)
{
    int cn,xp,cidx,i;
    float xpmult;
    bool LevelUp = false;
    //First catch some weird cases which shouldn't happen in the first place. let log if they do happen.
    if(!CheckAttribute(chref,"index")) { return false; if(DEBUG_EXPERIENCE>0) Trace("XP ERROR: Character "+GetMySimpleName(chref)+" has no index");}
    if(sti(chref.index)<0) { return false; if(DEBUG_EXPERIENCE>0){ Trace("XP ERROR: Character "+GetMySimpleName(chref)+" has index smaller than 0");} }
    if(_exp < 0) 
    { 
        _exp = -(_exp); 
        if(DEBUG_EXPERIENCE>0) Trace("XP ERROR: NEGATIVE XP CALL");
    }
    if(_exp == 0)
    {
        if(DEBUG_EXPERIENCE>0) Trace("XP ERROR: ZERO XP CALL");
        return false;
    }
   
    if(DEBUG_EXPERIENCE>1) Trace("XP LOG: Called AddXP for "+GetMySimpleName(chref)+" with skill: "+expName+" and xp: "+_exp+" and group: "+group);
   
    //Add a difficulty multiplier
    float diffmult = 1.0-((GetDifficulty()-1.0) / 6.0); //Let's make it a bit less dependent on difficulty
   
    //If we are only doing the player we can return here (for performance reasons)
    if(group == XP_GROUP_PLAYER) 
    {
        xpmult = GetXPmult(expName);
        xp = makeint(makefloat(_exp)*xpmult);
        if(AddXPtoChar(chref, expName, makeint(diffmult*xp))) LevelUp = true;
        return LevelUp;
    }
   
    //Check for shared experience
    bool SharedXP = GetOfficersPerkUsing(chref,"SharedExperience");
    if(DEBUG_EXPERIENCE>1) { if(SharedXP) Trace("XP LOG: SharedXP is active"); }
   
    //Now handle the officers
    if(group == XP_GROUP_OFFIC)
    {
        //First see if we are an officer or companion of a group.
        cidx = FindCaptainIndex(chref);
        if(cidx > -1)
        {
            if(DEBUG_EXPERIENCE>1) Trace("XP LOG: Captain found so let's check for captain instead");
            //We seem to be part of a larger party so let's check for the whole party
            if(AddXP(&Characters[cidx], expName, _exp, XP_GROUP_OFFIC)) LevelUp = true;
            return Levelup;
        }
        else
        {
            //Seems we are the captain so let's first assign some XP to ourself
            if(DEBUG_EXPERIENCE>1) Trace("XP LOG: Checking Officer captain with id "+chref.index);
            if(AddXP(chref, expName, _exp, XP_GROUP_PLAYER)) LevelUp = true;
            //If we are the captain then assign xp to the characters
            for(i=0; i < GetPassengersQuantity(chref); i++)
            {
                cn = GetPassenger(chref, i);
                if(DEBUG_EXPERIENCE>1) Trace("XP LOG: Checking Officer "+i+" with id "+cn);
                //Filter prisoned characters
                if(CheckAttribute(Characters[cn],"prisoned") && sti(Characters[cn].prisoned)) continue;
                //Check if this officer deserves the XP
                if (IsOfficerOf(&Characters[cn],chref))
                {
                    //We need to be an officer, passengers don't get any experience at all because they are only "passengers"
                    float skillmult = GetOfficerSkillFactor(&Characters[cn], expName) / 2; //this will make 100% skill contribution give 100% XP and 50% skill contribution give 50% XP
                    if(SharedXP || expName == "") skillmult = 1; //If SharedXP is active we should always have 100% XP
                    if(DEBUG_EXPERIENCE>1) Trace("XP LOG: skillmult = "+skillmult);
                    if(skillmult > 0)
                    {
                        if(AddXP(&Characters[cn], expName, makeint(_exp*skillmult), XP_GROUP_PLAYER)) LevelUp = true;
                    }
                }
                else
                {
                    DumpAttributes(&Characters[cn]);
                }
            }
        }
    }
   
    //Now handle the companions
    if(group == XP_GROUP_PARTY)
    {
        //Check if there is a leader of the group
        cidx = GetCompanionOf(chref);
        if(cidx > -1)
        {
            //If there is a leader let's call the function for him instead
            if(AddXP(&Characters[cidx], expName, _exp, XP_GROUP_PARTY)) LevelUp = true;
            return LevelUp;
        }
        else
        {
            //If we are the leader then give XP to the characters
            if(DEBUG_EXPERIENCE>1) Trace("XP LOG: Checking companions");
            if(GetCompanionQuantity(chref) > 0)
            {
                for(i=0; i < 4; i++)
                {
                    cn = GetCompanionIndex(chref, i);
                    if(DEBUG_EXPERIENCE>1) Trace("XP LOG: Checking Companion "+i+" with id "+cn);
                    //Filter prisoned characters
                    if(CheckAttribute(Characters[cn],"prisoned") && sti(Characters[cn].prisoned)) continue;
                    //Add multiplier for companions
                    xp = makeint(_exp*XP_GAIN_COMPANION);
                    //Now add the XP to the companion and maybe his officers
                    if(AddXP(&Characters[cn], expName, xp, XP_GROUP_OFFIC)) LevelUp = true;
                }
            }
        }
    }
    //returns true if there is a levelup somewhere
    return LevelUp;
}
 
@Grey Roger: Do you have any thoughts on this one?
After all, this was originally started based on your query about officers gaining XP prior to the player getting the "Shared XP" ability.

XP is either for party or officers (or player in some edge cases)
Do you mean "party" or "specific character"? If not, I'm not sure I quite understand....

If the function is called for officers it will determine all of the officers for the captain. If you are not the captain of this group it will find the captain and call it again for the officer group.
So if it gets called for a random character, it will try to find a captain for that character and then apply the function to ALL other characters assigned to that same captain?
 
I don't see why it has to be this complicated. In the stock game everyone got the XP they personally owned, and if the character had the perk "Shared Experience" then other active officers got a share of it as well. In the Build Mod active officers all got a share anyway, and a larger share if the character who earned it had "Shared Experience". I'd rather like that back, not least because it's how I train my officers in Melee.

Additionally, once again we seem to be considering a change to basic gameplay mechanics when we're supposed to be finishing off this version for a general release. So I'd suggest leaving it alone until the release is done, then consider messing with XP for the next version.
 
I don't see why it has to be this complicated. In the stock game everyone got the XP they personally owned, and if the character had the perk "Shared Experience" then other active officers got a share of it as well. In the Build Mod active officers all got a share anyway, and a larger share if the character who earned it had "Shared Experience". I'd rather like that back, not least because it's how I train my officers in Melee.
This post of yours is why we've been thinking about how this should be handled in the first place:
In the stock game, officers only gained a portion of your XP increase if you had the "Share Experience" perk.

For much of the history of the Build Mod, they'd get a little XP whenever you did, and a bigger portion if you had "Share Experience".

Now we seem to be back to stock behaviour. Playing with the 17th December update, I notice my officers gaining nothing, at least until I got "Share Experience". This tends to make officers less useful because while they're gaining nothing unless they killed someone or did something directly themselves, you're rising through the levels and gaining perks, to the point where you'll probably have all the important perks before the navigator, gunner and boatswain have earned their respective sets of perks. Having played various versions of PoTC back to the stock game, I know what "Share Experience" is for (in the stock game it was one of the first perks I got, and is likely to become so again). New players may not notice it lurking at the bottom of a now very long list of perks, let alone realise how important it is if you want your officers to progress.
You observed that your officers weren't getting ANY "Shared XP" anymore until you got the "Shared XP" perk yourself.
And as you didn't like that, something needed to be done. That "something" is this.
 
Do you mean "party" or "specific character"? If not, I'm not sure I quite understand....
Party = you + companions
Officers = you + shoreparty

So if it gets called for a random character, it will try to find a captain for that character and then apply the function to ALL other characters assigned to that same captain?
As you said. Although thinking about it more there is a logic flaw now which will prevent them from getting xp for fencing etc. Will fix that later today.
 
Party = you + companions
Officers = you + shoreparty
So the difference is whether the function gets called at sea or on shore?

Party = Player + Companions + Player Officers + Companion Officers = Everybody
Officers = Player + Shore Party = All characters ashore

Right?

As you said. Although thinking about it more there is a logic flaw now which will prevent them from getting xp for fencing etc. Will fix that later today.
My first impression would be that fencing shouldn't really be shared in the first place.
Unless we pretend that when you get Shared XP, all characters who gain fencing XP serve as "Fencing Instructors" for the other officers.

@Grey Roger indicates that he likes to train his officers in melee without actually having them involved in fights.
While that seems a bit counter-intuitive to me, it may become important later in the game.

Imagine hiring an officer with low fencing at a time when enemies are always relatively strong.
Then if they have to gain that XP themselves, you'd HAVE to take them into fights.
And when you do, they'll probably die instantly. So then some sort of "simulated fencing practice" does seem required.
 
If you want to help them gain fencing xp you need to get sharedxp.
No skill is excluded atm and not going to do that because also accuracy and defence are important in fighting, and if I make an exception for them also it is also wrong because they govern other things too.
 
If you want to help them gain fencing xp you need to get sharedxp.
That seems fair enough to me; provides a specific use for that skill, after all.
It then serves as that "simulated sword practice". :onya
 
Here is a newly update version. This should fix some of the logic fails so now it behaves as I said it should.
Place in PROGRAM\Characters\

@Pieter Boelen we could always add a dialog option to your officers where you can trainer them at a certain skill (if you are higher in that skill) but it will cost you. I would say it would cost you money. We might be able to later make this into a more immersive function with "trainers" or something like that but for now it would allow people to get theire officers up to a certain level if they want.
 

Attachments

  • Leveling.c
    58 KB · Views: 239
@Pieter Boelen we could always add a dialog option to your officers where you can trainer them at a certain skill (if you are higher in that skill) but it will cost you. I would say it would cost you money. We might be able to later make this into a more immersive function with "trainers" or something like that but for now it would allow people to get theire officers up to a certain level if they want.
But I think we shouldn't need that now. ;)
 
same here. Altough after the public release I do want to look into something like that eventually I think :).
Why bother? That would just be adding more micro-management. Plenty other things to take care of! :cheeky
 
Why bother? That would just be adding more micro-management. Plenty other things to take care of! :cheeky
Because I like character building ;).
But when I have time left I will make a topic about it, so at this rate that probably is somewhere in 2018 :p.
 
My first impression would be that fencing shouldn't really be shared in the first place.
Unless we pretend that when you get Shared XP, all characters who gain fencing XP serve as "Fencing Instructors" for the other officers.
Or unless we pretend that merely being present at a battle and watching what the veterans do helps a novice gain experience, the way soldiers become veterans in reality.

@Grey Roger indicates that he likes to train his officers in melee without actually having them involved in fights.
While that seems a bit counter-intuitive to me, it may become important later in the game.
No, I train them by having them involved in fights and looking after them.

Imagine hiring an officer with low fencing at a time when enemies are always relatively strong.
Then if they have to gain that XP themselves, you'd HAVE to take them into fights.
And when you do, they'll probably die instantly. So then some sort of "simulated fencing practice" does seem required.
That is exactly what I do - hire an officer with low "Melee", then take him into fights. Not boardings, he's been told to stay out of those; but he will be present when we run into thugs or highwaymen. I have high "Melee" skill at this point and so does at least one other officer, so between us we can keep the novice alive. He gets some XP for being in the party involved in the fight, and eventually his skill builds up to the point where he can be allowed into boardings.
 
Hmmm.... I see where you are getting at @Grey Roger could you please test with the latest Version is your way of "Training" them still works?
 
Hmmm.... I see where you are getting at @Grey Roger could you please test with the latest Version is your way of "Training" them still works?
If the officers-to-be-trained do participate in the fighting, they definitely get the XP for it. Right?
Or should the shore party, with Shared XP, get EXTRA fighting XP when other characters in the party gain it?
That might end up being a bit much....?
 
If the officers-to-be-trained do participate in the fighting, they definitely get the XP for it. Right?
Or should the shore party, with Shared XP, get EXTRA fighting XP when other characters in the party gain it?
That might end up being a bit much....?
If they participate they get XP. But if they just Keep theire distance and don't do anything they wont.
They will only get the melee XP which they gain themself by hitting enemies.

If you have SharedXP they will also get XP gained by others.
 
Back
Top