Mod Example: Inventory Item

From Avorion Wiki
Jump to: navigation, search

This mod introduces a simple inventory item that gives credits to a player on usage.

About[edit | edit source]

creditcard.lua[edit | edit source]

Represents the credit card item inventory item that can be added to the player's inventory.

  • item.stackable = true The item can be stacked in the inventory
  • item.depleteOnUse = true The item will be removed from the inventory after it was used
  • function create(item, rarity) The function that is called when a new object of this type is created by the game
  • function activate(item) The function that is called when the object is used by the player

modinfo.lua[edit | edit source]

  • serverSideOnly = false The mod adds a new inventory item to the game, and the client has to be able to display tooltips, so the client has to know about it. Also: Localization.
  • clientSideOnly = false Client side only is impossible, since new inventory items have to be created and added on the server.
  • saveGameAltering = true The mod adds a new script data/scripts/items/creditcard.lua whose path will be saved into the database. Once the mod is disabled, the script is no longer existant and the savegame will be slightly corrupted (not unplayable though).

Localization =[edit | edit source]

In the data/localization/ folder you can find an example for a German localization of texts that appear in the mod.

Workshop Link[edit | edit source]

See Also[edit | edit source]