Skip to content
Palgia edited this page May 20, 2024 · 3 revisions

Before you start

SKItemCreator has functions to allow you to interact with objects or registering your own.

Please make sure that your skripts are loaded AFTER SkItemCreator. See below.

Register an item

You can register an item by setting an unique identifier. Your item will be loaded into SkItemCreator and will be available in /skic gui.

SKICRegisterItemManually(i: item, name: string)

Example:

on load:
   wait 3 ticks
   SKICRegisterItemManually(iron ingot named "blah", "cool_ingot")

When the skript is loaded, an iron ingot named "blah" with the ID "cool_ingot" will be loaded in SkItemCreator.

Why 'wait 3 ticks' ?
When SkItemCreator is loading, it waits a bit to let other plugins load before it (like ItemsAdder) and to let other skripts also load (Like SkRPG). So by waiting 3 ticks, you let SkItemCreator load fully.

Please note: Reloading SkItemCreator.sk will erase all loaded items including those loaded with the API. So you will need to reload YOUR skript to register your item again.

Get a Item ID

If you wish to get the internal ID of an item you can use this function:

SKICInternalNameOfItem(i: item) :: string:

This function will return the ID if it has one.

Example:

on right click holding a blaze rod:
   SKICInternalNameOfItem(tool of player) = "thunder_staff"
   strike lightning at target entity 

This example will check if the player is holding a blaze rod with the ID "thunder_staff". If true, it strikes a lightning at the targeted entity.

Get a Block ID

You can get and ID from a placed block, only if the block has save-nbt: true (see here).

SKICGetPlacedBlock(block: block) :: string:

This function will return the ID of the block if it has one.

Example:

on break of cobblestone:
   SKICGetPlacedBlock(event-block) = "fake_cobblestone"
   create explosion of force 2 at event-location

This script will check if a player breaks a cobblestone with the ID "fake_cobblestone". If true, it creates an explosion.

Item category

"Item-category" is a feature only useful with the API. This allows you to sort and categorize your objects.
Useful for class items, talismans, artifacts etc. See more here.

Get the category of an item

SKICItemCategoryOf(i: item) :: string:

Example:

on damage:
   attacker is a player
   tool of attacker is any sword
   SKICItemCategoryOf(tool of attacker) is not equal to "DAGGER":
      cancel event
      "&cYou can only fight with daggers!"

Get all items in a category

SKICAllItemsOfCategory(category: string) :: strings:

Example:

command /isincategory <string>:
   trigger:
      if SKICAllItemsOfCategory(arg 1) contains tool of player:
         send "&eYour item is in the category %arg 1%"
      else:
         send "&cYour item is not in this category"

This command will check if the tool the player is holding is in the specified category.

Define custom durability

SkItemCreator has a custom durability feature. See more here.

You can define the custom durability of an item by using this function:

SKICDurabilitySetBase(item: item, amount: integer) :: item:

This function will return your item with the custom durability and with a new lore line showing the durability.

Example:

on load:
   wait 3 ticks
   set {_item} to iron sword named "&dEpic sword"
   #This will define 100 durability for my sword
   set {_item} to SKICDurabilitySetBase({_item}, 100)
   #Then I can register it
   SKICRegisterItemManually({_item}, "epic_sword")

Add/Set/Remove/Repair durability

Set durability. Do not use this to define custom durability for registering.

SKICDurabilitySet(item: item, amount: integer) :: item:

Remove durability.

SKICDurabilityRemove(item: item, amount: integer) :: item:

Repair by an amount.

SKICDurabilityAdd(item: item, amount: integer) :: item:

Full repair.

SKICDurabilityFullRepair(item: item) :: item:

Get a item from ID

You can get an item from a provided ID, if it exists.

SKICGetItemFromID(id: string)

Example:

command /givemyingot:
   trigger:
      give SKICGetItemFromID("cool_ingot") to player

THE API WILL BE EXTENDED SOON.