baseitem

BaseItem

BaseItem is the class you have to extend when scripting a new custom game item.

This will return the GameObject instance representing the item's Archetipus in game. It's set if the item is actually present on the scene (on the ground basically). Will return null if the item is in some inventory.

Returns the item's archetipus instance. It's set if the item is actually present on the scene (on the ground basically). Will return null if the item is in some inventory.

Returns a reference to the item's ui panel if currently open. Otherwise it will return null.

The items constant values to refer to quality levels of game items.

The items class, referring the custom class name to be instantiated when dealing with this item.

The id given to this kind of items

Its an alias to itemId

Will contain the item's sprite name as set in the json file.

Will conitain the Sprite object for this item.

Will contain the proxy sprite for this item, if any.

Will conitain the Sprite object for the proxy sprite of this item.

Will contain the PlayerEffect to activate when the item is equipped by the player.

Will contain the PlayerEffect to activate when the item is used by the player.

Will contain the time in game minutes before the items expires. 0 is for non expirating items.

Will contain the time in game absolute minutes (absolute minutes in game time from game starting) of the moment this object was first spawned.

In this properties there will be the id of any achivement to fire at the designated action, if any.

Effect modifiers to apply to PlayerEffects for this king of items. If any.

Will contain the initialization values for custom class properties defined by the user in the custom class extending the Base class.

Will contain the max number of items that can be stacked in a inventory slot.

The distance at which this item can be interacted with.

Will contain items spawned by the using of this item.

Will contain the quality value of this item

Will contain the physical path to the Sprites folder in the local machine.

Returns if the item is expirated or not.


This will return a Dictionary containing every stat and value of the item. Useful for displaying ui purposes.

This will spawn the item's gameobject to the floor.

Disposes of the object into nothingness.

Gets the item quality in a verbose manner.

This is called when the primary action (LMouse) is used on the item. Defaults to opening the item panel and it should not need to be overridden.

This is called when the player clicks with the secondary action button on the item. It can be implemented or not as the modder sees fit. It defaults to picking up the item. Most of the times it should not be overridden.

This is called to pick up an item to the player's inventory. Most of the times it should not be overridden unless you don't want to script an item that performs some action on pickup (a poisoned item maybe?).

Drop the item to the floor from whatever inventory is it in.

This is expected to be overridden most of the times. It manages what happens when a user uses an item.
It defaults to putting the item in the user equip inventory:

public virtual void UseItem(PlayerManager playerManager)
  {
      Utilities.UnlockAchievements(playerManager, achievementsOnUse);
      InventoryTransferService.TransferItem(this, playerManager.equipInventory, this.inventoryContext);
  }

Opens the item panel.

Disposes of the item panel.

Gets a readable, localized string representation of the countdown representing the expiration time.

May be overridden to make occur any action during expiration of the item (an explosion?).

Disposes of the item into nothingness.

Gets the PlayerEffect associated with the use action of the item. Can replace the effect id with the one of the item. Useful for displaying purposes.

Gets the PlayerEffect associated with the equip action of the item. Can replace the effect id with the one of the item. Useful for displaying purposes.

Returns a duplicate of this item.

If the item contains an inventory (like a container) this function must be overriddem returning the proper inventory.

TODO

You could leave a comment if you were logged in.
  • baseitem.txt
  • Last modified: 2019/11/04 14:30
  • by thorfinio