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

Specific for Officers improvements.

this was the idea i had about officer interface just edit of the passenger interface ive made a screen of and edited.


Officer_interface_idea.jpg

first 9 slots officers the upper part of skill is the individual the lower is the crew overall
1 slot for each role exept thugs they have 2

the 3 slots to the left are captains and their skill

and pieter i like the idea of taking a crewmember and making him usefull as an officer.

<img src="style_emoticons/<#EMO_DIR#>/guns.gif" style="vertical-align:middle" emoid=":2guns" border="0" alt="guns.gif" />
 
anyone who has some info on making an additional tab for the char interface part.

perhaps it should be put under the ship´s log section so it has a little use until the real plans about it get going if there are any??
 
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->How about countering the lack of hireable officers by being able to promote crewmembers to officers?
They'll start out with REAL low skills (0 or could we even make them <i>negative</i>?) but they'll learn eventually.
The Auto Skill System should also make sure that officers gain experience mainly in the areas related to their job.<!--QuoteEnd--></div><!--QuoteEEnd-->

can the officer create be run from the dialog then its just adding an promote dialog and classes.
but that ill need help doing alot off help i sem to go blind when i have to code and such on my own im so much better at looking at others work and have ideas.

but if someone can assist me with some info on how to create the interface.
 
<img src="style_emoticons/<#EMO_DIR#>/guns.gif" style="vertical-align:middle" emoid=":2guns" border="0" alt="guns.gif" />
From a simple virtual sailor


in : Modding subforum
title : Officer system


<img src="style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" /> , fellow PotC modders,

As you might know, I have been doing some experiments on changing the officer system.
Here is an overview on what I've done.

My first goal was to answer this question : is it possible, in PotC, to change the officer system so that it looks/works similar to Seadogs or AOP system?
This would requires several changes :

- twart the limitation of the three-officers-at-the-time system.
- make so that officers contribute only to certain skills & perks, depending on their speciality.

I've packed up my experimental code into something you guys can look at ; it's on the FTP, in my folder. (new_officer_system.rar)




<img src="style_emoticons/<#EMO_DIR#>/readon.gif" style="vertical-align:middle" emoid=":mm" border="0" alt="readon.gif" /> First thing to notice : I've created a new file, officers.c, that contains the most important part of the code.

* InitOfficersType() function, that creates all kind of officer you can have on your ship
* functions to assign/remove a character to those different positions in your ship
* two rewritten functions that deal with party skills/perks



Here's a typical part of InitOfficersType :

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    //Carpenter
    makeref(officer, Officer_type[n]);
    officer.name = "Carpenter";
    officer.skill.Leadership = 0;
    officer.skill.Fencing = 0;
    officer.skill.Sailing = 0;
    officer.skill.Accuracy = 0;
    officer.skill.Cannons = 0;
    officer.skill.Grappling = 0;    
    officer.skill.Repair = 1;
    officer.skill.Defence = 0;
    officer.skill.Commerce = 0;
    officer.skill.Sneak = 0;
    officer.perk.LightRepair = 1;
    officer.perk.InstantRepair = 1;
    n++;<!--c2--></div><!--ec2-->

This one will contribute only to repair skill, LightRepair, and InstantRepair perks.
Please note that I've added an officer called 'captain' who deals with all skills, and all perks.

The functions that assign/remove an officer are not very elaborated : it just stores the index number of that character as a .Ship.Officers.[officer_type name] attribute of the character that haves the ship.

The two rewritten functions are GetSummonSkillFromName from PROGRAM\Characters\CharacterUtilite.c, and GetOfficersPerkUsing from PROGRAM\INTERFACE\Perks\perks.c.
I'll quickly show you how they looked like :

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->int GetSummonSkillFromName(ref _refCharacter, string skillName)
{
    int sumSkill = GetCharacterSkill(_refCharacter,skillName);
    int i,cn,curSkill;
    for(i=1;i<4;i++)
    {
        cn = GetOfficersIndex(&_refCharacter,i);
        if(cn!=-1)
        {
            curSkill = GetCharacterSkill(GetCharacter(cn),skillName);
            if(sumSkill<curSkill)
            {
                sumSkill = curSkill;
            }
        }
    }
    return sumSkill;
}<!--c2--></div><!--ec2-->

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->bool GetOfficersPerkUsing(ref chref, string perkName)
    {
        for(int i=0; i<4; i++)
        {
            int cn = GetOfficersIndex(chref,i);
            if(cn<0) {continue;}
            if( GetCharacterPerkUsing(&Characters[cn], perkName) ) {return true;}
        }
        return false;
    }<!--c2--></div><!--ec2-->

And here is how I changed them : in stead of checking you plus the three other guys in the three available slots, now it checks if some officers are supposed to help you with this skill/perks, than gets the index of this officer if you got one, than checks if his skill is higher or if he has the perk.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    int GetSummonSkillFromName(ref _refCharacter, string skillName)
    {
        int sumSkill = GetCharacterSkill(_refCharacter,skillName);
        int i,cn,curSkill,n;

        for (n = 0; n < MAX_OFFICER_TYPES; n++)
        {
            ref officer;
            makeref(officer, Officer_type[n]);
    
            if(CheckAttribute(officer, "skill." + (skillName)) && sti(officer.skill.(skillName)) > 0)
            {    
                string _post = officer.name;
                cn = Get_ship_OfficersIndex(&_refCharacter, _post);
                if(cn!=-1)
                {
                curSkill = GetCharacterSkill(GetCharacter(cn), skillName);
                if(sumSkill<curSkill) sumSkill = curSkill;
                }
                
            }
        }
    return sumSkill;
    }

    bool GetOfficersPerkUsing(ref chref, string perkName)
    {
        for (int n = 0; n < MAX_OFFICER_TYPES; n++)
        {
            ref officer;
            makeref(officer, Officer_type[n]);

            if(CheckAttribute(officer, "perk." + (perkName)))
            {
                string _post = officer.name;
                int cn = Get_ship_OfficersIndex(&chref, _post);

                if(cn<0) {continue;}
                if( GetCharacterPerkUsing(&Characters[cn], perkName) ) {return true;}
            }
        }
        return false;
    }<!--c2--></div><!--ec2-->


My conclusion is that it is pretty much fesable to change the current system into this kind. It would requires other things I haven't done yet : function that removes the stored id of the character if he dies, an of course a proper interface in which you could assign/remove them.
Some more care should be put to InitOfficersType, to chose carefully which officer helps with which skill/perk.



Now for some extra notes - for example, while playing with GetSummonSkillFromName and GetOfficersPerkUsing with some LogIt()s, I noticed a bunch of weird things.

- when I hit some character, it runs GetSummonSkillFromName without giving a skill name..
- two perks that don't exist are checked all the time, 'charisma' and 'witcharm'.
- perk 'sharedexperience' represent 90% of all asked perks. I think we'd have to look at this one more carefully.
- Instantrepair perk code is repetitive.
- your old saves will not be compatible with my changes : you'll be able to load them, but not to save again (CTD). So while you're testing this code, it's better to start a new game.


Any comments are welcomed. Be sure to use winmerge if you want to try the .rar file, as I haven't got the latest alpha version.

To set an officer to a given position, you must use dialog links ('changing' his role aboard).
 
<!--quoteo(post=315804:date=Apr 25 2009, 09:02 PM:name=LamAnd)--><div class='quotetop'>QUOTE (LamAnd @ Apr 25 2009, 09:02 PM) <a href="index.php?act=findpost&pid=315804"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->can the officer create be run from the dialog then its just adding an promote dialog and classes.
but that ill need help doing alot off help i sem to go blind when i have to code and such on my own im so much better at looking at others work and have ideas.<!--QuoteEnd--></div><!--QuoteEEnd-->The random crewmembers on yor ship's deck get the "Crewmember_" dialogs from PROGRAM\DIALOGS.
case "enlist_me" in the Enc_Walker.c dialog file contains code for making somebody a random officer.
You'd need to copy that code into the "Crewmember_" dialog file, make sure that the hired officer is NOT a good one and possibly allow you to choose his officer type right there in the dialog.
 
Back
Top