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

Equipping a character

Peter Willemoes

Corsair
Storm Modder
I am playing around a bit with the console execution commands (Build14A8), searching the forums for old threads..its actually quite fun what you can do. But then I got stubborn, trying to learn how to control things in the game. I have troubles equipping my officers with the items I gave them.

I tried the following out of pure blindness:
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->ch.equip="commonarmor"; (nope)
ch.equip.commonarmor=1; (another nope)
EquipCharacterByItem(pchar, "conmonarmor"); (only equips me, not the NPC)
EquipCharacterByItem(ch, "commonarmor); (wont execute)
EquipNPCharacterByItem(ch, "commonarmor"); (won´t execute)<!--QuoteEnd--></div><!--QuoteEEnd-->
It seems, nothing works. Anyone out there who knows how to do this? I think it has to do something with GetPassengerIndex, like this (but that wont work either)
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->ch = CreateOfficer_Cheat("Huber_fra", 0, PORTUGAL, false);
SetOfficersIndex(pchar, -1, GetCharacterIndex(ch.id));
EquipCharacterByItem(GetOfficersIndex(pchar, -1, GetCharacterIndex(ch.id)), "commonarmor");<!--QuoteEnd--></div><!--QuoteEEnd-->

Also, I i.e. came from Nevis and changed location to Conceicao via the console (this works fine) But then I went to sea from Conceicao and ended up in the sea outside Nevis again?! This is not supposed to happen..
The location change lines looks like this:
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->DoQuestReloadToLocation("Conceicao_port", "reload", "reload2" ,"");
SetCharacterShipLocation(Pchar, "Conceicao_port");<!--QuoteEnd--></div><!--QuoteEEnd-->

I am probably just starring myself blind on these things. Anybody have a clue what I do wrong?
 
Alright, I just read the long thread "Sparrow Search Build14A8" from july-august, Pieter Boelen stating, that something is wrong with initial attemps going on/off the worldmap. Once you proceed playing, things go smoothly and the land-sea locators dont mess up. So that one´s not a big problem right now <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
Hi Peter,



<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->I tried the following out of pure blindness:

QUOTE
ch.equip="commonarmor"; (nope)
ch.equip.commonarmor=1; (another nope)
EquipCharacterByItem(pchar, "conmonarmor"); (only equips me, not the NPC)
EquipCharacterByItem(ch, "commonarmor); (wont execute)
EquipNPCharacterByItem(ch, "commonarmor"); (won´t execute)

It seems, nothing works. Anyone out there who knows how to do this? I think it has to do something with GetPassengerIndex, like this (but that wont work either)<!--QuoteEnd--></div><!--QuoteEEnd-->

Try giving them a different model id.

This is how the armor is given.... if your oficers don't have the different armor models ,there's no armor to show up
anyway. <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
------------------------------------------------------------------------------------------------------------------------
PROGRAM\models\initModel. c
--------------


i.e.......Pirat11.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    makeref(model,Models[n]);
    model.description =  "Don't cross me, mate!  Black boots, black trousers, long black coat, big black hat, black as me hair!  Black as me heart!";
    model.id       =  "Pirat11"; // PB: model switched with pirat11, so you run into him instead of the Barbossa look-a-like; NK 05-03-21 do this in code
    model.FaceId    = 53;
    model.nation      =  PIRATE;
    model.price       =  1600;
    model.assigned    =  true;
    AssignModelTypeNation(isstart, &model, "Captains", 1.0, PIRATE);
    AssignModelTypeNation(isstart, &model, "Land_Officers", 1.0, sti(model.nation));
    n++;

    // Armor Mod -->
    makeref(model,Models[n]);
    model.description =  "Don't cross me, mate!  Black boots, black trousers, long black coat with steel cuirass, big black hat, black as me hair!  Black as me heart!";
    model.id       =  "Pirat11_A1";
    model.FaceId    = "Pirat11";
    model.nation      =  BROKEN; // we autoassign it elsewhere
    model.price       =  1000;
    model.assigned    =  true;
    n++;

    makeref(model,Models[n]);
    model.description =  "Don't cross me, mate!  Black boots, black trousers, long black coat with engraved breastplate, big black hat, black as me hair!  Black as me heart!";
    model.id       =  "Pirat11_A2";
    model.FaceId    = "Pirat11";
    model.nation      =  BROKEN; // we autoassign it elsewhere
    model.price       =  4000;
    model.assigned    =  true;
    n++;

    makeref(model,Models[n]);
    model.description =  "Don't cross me, mate!  Black boots, black trousers, long black coat with gilded breastplate, big black hat, black as me hair!  Black as me heart!";
    model.id       =  "Pirat11_A3";
    model.FaceId    = "Pirat11";
    model.nation      =  BROKEN; // we autoassign it elsewhere
    model.price       =  15000;
    model.assigned    =  true;
    n++;
    // Armor Mod <--<!--c2--></div><!--ec2-->

<img src="style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
damski
 
Damski62!! <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> What a pleasant surprise, thanks for coming to aid.
I will make sure, the models I use have armor-models as well. And replace n with a specific integer. Things should be fine, then.
 
How is this?<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->                int rcPassengerID = GetOfficersIndex(mc, sti(1));
                if (sti(rcPassengerID) > -1)
                {
                    ref rcPassenger = GetCharacter(sti(rcPassengerID));
                    GiveItem2Character(rcPassenger, "commonarmor");
                    EquipCharacterByItem(rcPassenger, "commonarmor");
                    Log_SetStringToLog("Common armor equipped for " + rcPassenger.name + " " + rcPassenger.lastname + "!");
                }
                else
                {
                    Log_SetStringToLog(TranslateString("","Error updating passenger, is passenger") + " 1 " + XI_ConvertString("missing?"));
                }<!--c2--></div><!--ec2-->This code is mostly hyjacked from seadogs.c. <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
<!--quoteo(post=286227:date=Oct 26 2008, 10:47 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Oct 26 2008, 10:47 PM) <a href="index.php?act=findpost&pid=286227"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->How is this?<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->                int rcPassengerID = GetOfficersIndex(mc, sti(1));
                      if (sti(rcPassengerID) > -1)
                      {
                          ref rcPassenger = GetCharacter(sti(rcPassengerID));
                          GiveItem2Character(rcPassenger, "commonarmor");
                          EquipCharacterByItem(rcPassenger, "commonarmor");
                          Log_SetStringToLog("Common armor equipped for " + rcPassenger.name + " " + rcPassenger.lastname + "!");
                      }
                      else
                      {
                          Log_SetStringToLog(TranslateString("","Error updating passenger, is passenger") + " 1 " + XI_ConvertString("missing?"));
                      }<!--c2--></div><!--ec2-->This code is mostly hyjacked from seadogs.c. <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->

Thanks Pieter. My motivation for doing this, is to create an "instant action" kind of playermode, that will take you out on the bay for a quick ride with you most beloved ship, in a situation of your choice. PotC can be a "heavy" and timeconsuming game to pick up, if you only have like half an hour and always have to start from scratch or load a quest in which you no longer remember where you are. I think the console is a good choice for my lack of quest-skills.

I found, that setting the ref ch = CreateOfficer_Cheat(..) will do the job, and "ch" can be the index of the current developed character. Hence, the commands "ch.items.commonarmor= 1;" and "ch.equip.commonarmor=1;" will do the trick.

What I find hard to do, is to create another ship of mine and install officers in that ship as commanders, gunners, doctors etc. I tried several way of doing this, all failed:

This will give me a Schooner1 in Slot 1 and create a tartane named "ShipTwo" in slot 2, but I cant use it.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    GiveShip2Character(pchar,"Schooner1","ShipOne",HOLLAND,true,true);
        pchar.ShipSlot1.Type="Schooner2";
        pchar.ShipSlot1.Name="ShipTwo";
        pchar.ShipSlot2.Type=SHIP_NOTUSED;
          pchar.ShipSlot2.Name="NoName";
        pchar.ShipSlot3.Type=SHIP_NOTUSED;
        pchar.ShipSlot3.Name="NoName";<!--c2--></div><!--ec2-->

While it works with handing out equipment, ships can not be handed out to officers this way. Wont work (as it is)
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> GiveShip2Character(ch,"Schooner2","Cheri",HOLLAND,true,true);<!--c2--></div><!--ec2-->


Doing it the storyline-way does´nt work either:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    ch.Ship.Name = "Belette";
     ch.Ship.Type = "SuperiorWarship"; // Thomas the Terror
     ch.Ship.Stopped = true;
     // KNB ch.Ship.Cannons.Type = CANNON_TYPE_CANNON_LBS24;
     ch.ShipSlot1.Type=SHIP_NOTUSED;
     ch.ShipSlot1.Name="NoName";
     ch.ShipSlot2.Type=SHIP_NOTUSED;
     ch.ShipSlot2.Name="NoName";
     ch.ShipSlot3.Type=SHIP_NOTUSED;
     ch.ShipSlot3.Name="NoName";<!--c2--></div><!--ec2-->
So, maybe this is not possible at all? You think there is a way to create more than one ship via the console and install officers into them in one click?
 
Hmm... I never looked into the code related for having multiple ships.
You could give yourself a companion somehow though.
 
Check for example the Mary Wood dialog file for the companion code.
 
Great suggestion and find, Pieter. I finally found her definition file in taverns.c

I have another problem now, I think - my F12 key doesnt work anymore <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />
Any way I can remap this function to another key?
 
You mean your physical keyboard button doesn't work? You can reassign the buttons in PROGRAM\CONTROLS\DefaultControls.h
Reset the controls to default after you did that. And make sure you don't cause any double key assignments. <img src="style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
It's probably mainly the Mary Wood dialog file that you'll want to check.
 
I finally got it:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// Create my ship
// ------------------
    GiveShip2Character(pchar,"Schooner1","Cherie",PERSONAL_NATION,true,true);

// Create officer
// ------------------

    ch = CreateOfficer_Cheat(OFFIC_TYPE_NAVIGATOR, "Ladyinred", 0, PERSONAL_NATION, false);
    SetOfficersIndex(pchar, -1, GetCharacterIndex(ch.id)); //if not made officer, interaction is not possible
    SetCompanionIndex(pchar, -1, GetCharacterIndex(ch.id));//put her in the captain´s seat..
    SetCharacterRemovable(ch, true);
    ch.old.name = "Hulu";
    ch.old.lastname = "Bulu";
    ch.name = TranslateString("","Hulu");
    ch.lastname = TranslateString("","Bulu");
    ch.id    = "Hulu Bulu";
    ch.model= "Ladyinred";
    ch.headmodel = "h_Ladyinred";
    ch.sex = "woman";
    ch.nation = PERSONAL_NATION;    
    ch.skill.Leadership = "7";
    ch.skill.Fencing = "10";
    ch.skill.Sailing = "7";
    ch.skill.Accuracy = "8";
    ch.skill.Cannons = "9";
    ch.skill.Grappling = "5";
    ch.skill.Repair = "4";
    ch.skill.Defence = "10";
    ch.skill.Commerce = "2";
    ch.skill.Sneak = "8";
    ch.money = "500";
    ch.perks.list.BasicDefense = true;
    ch.perks.list.SharedExperience = true;
    ch.Ship.Name = "Morning Star";                //..in our new brigantine
    ch.Ship.Type = "Brigantina1";
    ch.ship.cargo.goods.BALLS = 1000;            //equip the ship
    GiveItem2Character(ch, "blade24");
    ch.equip.blade = "blade24";
    GiveItem2Character(ch, "pistol5");            //several ways to give
    ch.equip.gun = "pistol5";
    ch.items.commonarmor= true;                //and equip items
    ch.equip.commonarmor= 1;
    ch.Ship.Stopped = true;<!--c2--></div><!--ec2-->

Two new ships and 1 officer - installed as commander of ship two.

Of course, I still need to figure out to add officers to that ship. Also, they seem to come with equipment from somewhere out of my control.
 
CreateOfficer_Cheat might give your characters (semi-)random weapons.
 
This drove me nuts, not being able to do such a simple thing. The method became try and test, so it took me a week before I finally managed to do something, that is probably not something special. Buttom line is: if you want something NOT to be unique, DONT include a character.id="blahb blah"; <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

Thank you for helping me, Pieter <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
What do you mean by "unique" in this case...? <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
Sorry, that was cryptic.

Well, for trying to add the 3 companions, I used the data and variations over the example Mary Wood. But I could´nt add more than one to the -etOfficersIndex, at least I thought that. Checking for wrong calls and the functions handling the indexes with my not-so-fast-seeing-through-code "skills", made it take a week and I got a huge amount of useless inside-knowledge of almost every function in PotC, before I realised that this lille bit of data ch.id="Hulu Buluorsomething" caused it all <img src="style_emoticons/<#EMO_DIR#>/24.gif" style="vertical-align:middle" emoid=":rofl" border="0" alt="24.gif" />

If its included in the characterdatalist, its the only officer I can add.
 
Hmm... with a bit of luck, such inside knowledge would eventually prove to NOT be useless.
Indeed assigning the same ID to multiple characters might cause no end of troubles. <img src="style_emoticons/<#EMO_DIR#>/piratesing.gif" style="vertical-align:middle" emoid=":shock" border="0" alt="piratesing.gif" />
 
Thank you, I believe this autistic hunt with the devil for no purpose at all but being a controlfreak about setting up a character (using cheats) will lead to something..erh..usefull <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

I could spam some of the code I used, as a thank you, I guess <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />

Would you happen to know if there is one index, that can get to every character on both mine and my companions' ships?
This could maybe be related to LAI_GROUP_PLAYER, but I would´nt know how to use this for the purpose. No answer needed right away.
 
Back
Top