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

Tutorial MODDING TIP - How to Remove Equipment from Officers and Give Them New Weapons

TheBlackKnight

Corsaire Flibustier
Storm Modder
Pirate Legend
All,

This came up recently by a player who wanted to upgrade his officers equipment to something completely different in CoAS but could not do so as the game intelligence "chooses" the best equipment, and you cannot force them to unequip weapons after you give them weapons in game.
This commonly happens when a weapon may have a wider weapon damage range, and lowest damage is smaller than the weapon you want him/her to use.

This is generally true for most officer models and many hero models, and can also be overridden via code (and always allow you to unequip them yourself), but that is another topic altogether.

SO, here is another mystery of the Akella script game code revealed for Storm Modders and Players...

This requires creating a console.c script to override the game.
This is not a "bug" fix, but gives you some more control over your character's officers.
Open up your text editor and use the following text:

void ExecuteConsole()
{
ref chr = GetCharacter(sti(pchar.Fellows.Passengers.navigator));
int i;
int limit;

Log_SetStringToLog("Executed Console");

TakenItems(chr, "pistol31", -1)


Log_SetStringToLog("Officer Item Removed!!!");
}

This is ONLY an example of removing 1 Corsaire Captain's Pistol from the Navigator Officer (on land only) from GOF Eras.

Save the file as console.c

Key Points in the script code:
1) chr = <<<Defines the character you want to check

2) pchar.Fellows.Passengers.navigator <<< Defines which Player Officer you want to check
The following codes and titles are used for the default game officers:
fighter1, fighter2, fighter3, navigator, boatswain, cannoner, doctor, treasurer, carpenter
Insert the one you want to access in the code

3) TakenItems(chr, "pistol31", -1) <<<Defines which character (that you established above), the item you want to modify or add from items_describe.txt from the resources/text/russian, and quantity to add or remove
You need to know the item code from its description properly from the mod you are using and it must be able to be generated "in world", in order for this to work.

Start your game, load your game, press "F4".

If you write the console.c script as described, the console will report the action as completed, "Officer Item Removed!!!"

Then check the inventory and the item/weapon will be gone from the officer character, and you can continue the game normally with no ill effects and give him/her new equipment that you want.

Due to the way the the console actions works, the game will not recognize the new weapon as added to officer's inventory as a weapon until you give and take the weapon TWICE, because you removed the weapon from the officer's inventory out of game world engine context.
After you give him/her the weapon the SECOND time, the officer will then re-equip the weapon as their new "effects".

This code should NOT be used with Humphrey Douglas or any musketoon officer as this WILL break your game due to animation file errors with the loss of a weapon.

Cheers!
 
Last edited:
Back
Top