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

New Horizons Adding Items During Game

  • Views Views: 1,029
  • Last updated Last updated:

Navigation

      Capturing Colonies
         A girl won in a card game
         Artois Voysey (Quest)
         Cargo for Thomas O'Reily
         Church Protection
         Edgar Attwood Adventures
         Escort Vigila Mendes Ship
         Hard Labors of an Assassin
         Help The Boatswain
         Help the Church
         Help the Lady
         Hire A Sailor - Rys Bloom
         Nigel Blythe (Quest)
         Patric and the Idols
         Rescue Peter Bloods Crew
         Sabine Matton
         Saga of the Blacque Family
         Saving Toff's Daughter
         Search for Peter Bloods Ship
         Silver for Cartagena
         Sink the Pirate Corvette
         Sinking The Vogelstruijs
         Smuggling for Thomas O'Reily
         The Silver Train
         Zaid Murro's Problems
      Smuggling
      Treasure Quests
         Lost Treasure on Cuba
         Lost Treasure on Guadeloupe
  • Adding New Items During Game
    Go back to modding

    Since BETA 3.3 there is an option to add a new item in the game while the game has already started.
    This can be done with the following function:

    Code:

    int itemindex = findemptyItem();
    string id = "nameoftheitem"
    AddItem(itemindex,id, "", 13, 7, 0.05, 3, 0000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1);

    All the numbers after the first 3 arguments are the same as in the iteminit for InitItem.
    The function findemtyItem() will return a id of an unused slot where the item can go in.
    The item ID can be anything you want as long as it isn't used yet.
    When the ID already exist a error message will be posted in the compile.log saying:
    Code:

    ITEM ADDING ERROR: id already exist

    else it will post something like this:
    Code:

    ITEM ADDED at 806 total items now: 807

    As you see it gives the total number of items and the Index at which it was added.

    You can use variables in the Item Name and description.
    To do that you first need to get the Item after you made it.
    You can do this with the following command:
    Code:

    ref genitm;
    makeref(genitm,Items[itemindex]);
    The itemindex in here is the one we found and added the item to in the code snipped above.
    Now you can assign more properties to the item.
    Like this:
    Code:

    genitm.name = "Patrol Schedule #sisland# version #dversion#";
    genitm.describe = "Patrolling schedule for #sisland#.";
    genitm.island = sisland.name;
    genitm.version = sisland.Smuggling.patrolversion;
    Now when the item shows up somewhere it will use the island and version which are set to the item in the name and description.
    You can add other variables to by just adding them like this.
Back
Top