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:
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);
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:
ITEM ADDING ERROR: id already exist
ITEM ADDED at 806 total items now: 807
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:
Now you can assign more properties to the item.
genitm.name = "Patrol Schedule #sisland# version #dversion#";
genitm.describe = "Patrolling schedule for #sisland#.";
genitm.island = sisland.name;
genitm.version = sisland.Smuggling.patrolversion;
You can add other variables to by just adding them like this.