Difference between revisions of "Achievements"

From wiki
Jump to: navigation, search
(Initial commit.)
 
(Added a new Variable. (Well not new but not on the page new.))
 
(5 intermediate revisions by the same user not shown)
Line 45: Line 45:
 
</pre>
 
</pre>
  
This additional property adds a list of items that will be given to the player upon completion. This list of items actually follows [[Items#Universal Spawning Rules]], but in most cases you can use an item's code. There is one difference, which is that in this case it can take a value "quantity" in order to specify how many items to spawn. Note that Tiles and Clothing cannot be just a "code" and "quantity".
+
This additional property adds a list of items that will be given to the player upon completion. This list of items actually follows [[Items#How to Spawn an Item]], but in most cases you can use an item's code. There is one difference, which is that in this case it can take a value "quantity" in order to specify how many items to spawn. Note that Tiles and Clothing cannot be just a "code" and "quantity".
 +
 
  
 
With that you have created an achievement. Once you have content built, you can see this achievement in the inventory menu. Be sure to look at [[#Useful components]] to see what other types of achievements you can make.
 
With that you have created an achievement. Once you have content built, you can see this achievement in the inventory menu. Be sure to look at [[#Useful components]] to see what other types of achievements you can make.
Line 53: Line 54:
 
For Achievements, their components mainly specify ways of completing the achievement. The majority of achievements will have at least one of the following components;
 
For Achievements, their components mainly specify ways of completing the achievement. The majority of achievements will have at least one of the following components;
  
== [[Any Of Category Component]] ==
+
=== [[Any Of Category Component]] ===
 
This component is the main component in achievements. It is used to make the player collect a certain number of items. These items must have the categories that is listed in the component in order to count towards completion.
 
This component is the main component in achievements. It is used to make the player collect a certain number of items. These items must have the categories that is listed in the component in order to count towards completion.
  
Line 59: Line 60:
  
  
== [[Collect Items Component]] ==
+
=== [[Collect Items Component]] ===
This component is used to make the player collect a certain number of a specific item. This uses [[Items#Universal Spawning Rules|Spawned Items]] instead of categories to complete the achievement.
+
This component is used to make the player collect a certain number of a specific item. This uses [[Items#How to Spawn an Item|Spawned Items]] instead of categories to complete the achievement.
  
 
For more information on how to use the Collect Items Component, head to [[Collect Items Component#When and How to use]].
 
For more information on how to use the Collect Items Component, head to [[Collect Items Component#When and How to use]].
  
  
== [[Misc Component]] ==
+
=== [[Misc Component]] ===
 
This component is used to listen to any miscellaneous achievement triggers that the game might use. Certain actions will use this type of component, such as checking if the player threw a ball.
 
This component is used to listen to any miscellaneous achievement triggers that the game might use. Certain actions will use this type of component, such as checking if the player threw a ball.
  
Line 71: Line 72:
  
  
== [[Own Items Component]] ==
+
=== [[Own Items Component]] ===
 
This component is highly similar to [[Collect Items Component]] except that it only accepts codes, but allows specifying a number of items. This component is largely outdated but can still be used.
 
This component is highly similar to [[Collect Items Component]] except that it only accepts codes, but allows specifying a number of items. This component is largely outdated but can still be used.
  
Line 77: Line 78:
  
  
== [[Talk To Component]] ==
+
=== [[Talk To Component]] ===
 
This component is used to track who the player has talked to, and is mostly used as a way of directing the player towards finding information.
 
This component is used to track who the player has talked to, and is mostly used as a way of directing the player towards finding information.
  
Line 83: Line 84:
  
  
== [[Water Crop Component]] ==
+
=== [[Water Crop Component]] ===
 
This component is used to track how many tiles the player has watered. This was mostly used as a way to point the player towards watering tiles in the tutorial.
 
This component is used to track how many tiles the player has watered. This was mostly used as a way to point the player towards watering tiles in the tutorial.
  
Line 92: Line 93:
 
= Config Options =
 
= Config Options =
 
== "code" ==
 
== "code" ==
'''Valid options (String): <code>A unique string which achievement what this object is.</code>'''
+
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A unique string which achievement what this object is.</code>'''
  
 
'''Default Value:''' No default value is specified. Always need to provide your own.
 
'''Default Value:''' No default value is specified. Always need to provide your own.
Line 102: Line 103:
  
  
=== "icon" ===
+
== "icon" ==
'''Valid options (String): <code>A string which contains the path to an model file.</code>'''
+
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string which contains the path to an model file.</code>'''
  
 
'''Default Value:''' Either "icon" or "itemIcon" must be specified. If both are specified then "icon" is used before "itemIcon".
 
'''Default Value:''' Either "icon" or "itemIcon" must be specified. If both are specified then "icon" is used before "itemIcon".
Line 111: Line 112:
  
  
=== "itemIcon" ===  
+
== "itemIcon" ==  
'''Valid options (Spawned Item): <code>See [[Items#Universal Spawning Rules]] for more information.</code>'''
+
'''Valid options (Spawned Item): <code>See [[Items#How to Spawn an Item]] for more information.</code>'''
  
 
'''Default Value:''' Either "icon" or "itemIcon" must be specified. If both are specified then "icon" is used before "itemIcon".
 
'''Default Value:''' Either "icon" or "itemIcon" must be specified. If both are specified then "icon" is used before "itemIcon".
Line 120: Line 121:
  
  
=== "progressesWithoutRequirement" ===  
+
== "progressesWithoutRequirement" ==  
'''Valid options (Bool): <code>True or False</code>'''
+
'''Valid options ([[Modding_Key_Terms#Bool|Bool]]): <code>True or False</code>'''
  
 
'''Default Value:''' If not specified, will default to False.
 
'''Default Value:''' If not specified, will default to False.
Line 129: Line 130:
  
  
== "rewards" ==
+
== "public" ==  
'''Valid options (List of Spawn Item): <code>A list of Items to be spawned. See [[Items#Universal Spawning Rules]] for more information.</code>'''
+
'''Valid options ([[Modding_Key_Terms#Bool|Bool]]): <code>True or False</code>'''
  
'''Default Value:''' No default value is specified. Always need to provide your own.
+
'''Default Value:''' If not specified, will default to True.
  
  
These are the rewards that are given to the player once the achievement has been completed. Rewards are meant to be collected from Farm Fan.
+
This option specifies whether or not this achievement will be shown on the achievements page. Handy for not showing players certain achievements.
  
  
=== "slot" ===  
+
== "requirement" ==
'''Valid options (Vector 2 - Integer): <code>{"x": 0, "y": 0}</code>'''
+
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string which contains another Achievement's code.</code>'''
  
'''Default Value:''' No default value is specified. Always need to provide your own.
+
'''Default Value:''' If not specified, will not require another achievement. These achievements should have "starter" set to true.
  
  
This is used to specify the exact position this achievement will appear in the Achievement menu. This menu is located in the inventory screen.
+
This is the achievement that must be completed before this achievement can be completed.
  
  
=== "starter" ===  
+
== "rewards" ==
'''Valid options (Bool): <code>True or False</code>'''
+
'''Valid options ([[Modding_Key_Terms#List|List]] of Spawn Item): <code>A list of Items to be spawned. See [[Items#How to Spawn an Item]] for more information.</code>'''
  
'''Default Value:''' If not specified, will default to False.
+
'''Default Value:''' No default value is specified. Always need to provide your own.
  
  
This option is used to specify if this achievement will be unlocked at the start of the game.
+
These are the rewards that are given to the player once the achievement has been completed. Rewards are meant to be collected from Farm Fan.
  
  
== "sounds" ==
+
== "slot" ==
Sounds is a list of smaller JSON/Blob files which contain information on files. It is written as:
+
'''Valid options ([[Modding_Key_Terms#Vector 2|Vector 2]] - [[Modding_Key_Terms#Integer|Integer]]): <code>{"x": 0, "y": 0}</code>'''
<pre>{
+
  "sounds" : [
+
    {
+
      //Stuff here
+
    },
+
    {
+
      //Stuff here
+
    }
+
  ]
+
}</pre>
+
  
Each set contains the values below.
+
'''Default Value:''' No default value is specified. Always need to provide your own.
  
  
 +
This is used to specify the exact position this achievement will appear in the Achievement menu. This menu is located in the inventory screen.
  
  
=== "randomPitch" ===
+
== "starter" ==
'''Valid options (Vector 2 - Float): <code>{"x":-1.0, "y":1.0}</code>'''
+
'''Valid options ([[Modding_Key_Terms#Bool|Bool]]): <code>True or False</code>'''
  
'''Default Value:''' Can be omitted. If not specified, then pitch will not vary.
+
'''Default Value:''' If not specified, will default to False.
  
This option tells the game exactly to play the sound at a random pitch between two points, x (min) and y (max).
 
  
 
+
This option is used to specify if this achievement will be unlocked at the start of the game.
=== "randomVolume" ===
+
'''Valid options (Vector 2 - Float): <code>{"x":0.0, "y":1.0}</code>'''
+
 
+
'''Default Value:''' If this is specified, "volume" cannot be used. Only one of the two can, and must, be specified.
+
 
+
This option tells the game exactly to play the sound at a random volume between two points, x (min) and y (max).
+
 
+
 
+
=== "volume" ===
+
'''Valid options (Float): <code>A value between 0.0 and 1.0.</code>'''
+
 
+
'''Default Value:''' If "randomVolume" is specified, this cannot be used. Only one of the two can, and must, be specified.
+
 
+
 
+
This option tells the game exactly how loud to play the sound.
+

Latest revision as of 07:03, 18 March 2018

In Staxel, *.achievement files are used to specify any achievement that is in the game. These files include all the information needed to make the achievements including;

  • The icons for the achievement.
  • Positioning and required achievements in the UI.
  • How to complete the achievement.


Adding New Achievements to Staxel

Staxel allows you to easily add your own achievements into staxel without needing to touch any of Staxel's files.

While not as necessary for achievements, make sure to follow #Setting up for Mod Creation first. Once this is done, create a file with an ending of .achievement, and place the following into it.

{
  "code" : "staxel.achievement.Catch10Bug",
  "icon" : "staxel/gatherables/catchables/Bee.qb",
  "requirement" : "staxel.achievement.CatchBug",
  "slot" : {
    "x" : 60,
    "y" : 300
  },
  "anyOfCategory" : {
    "type" : "collectItems",
    "orCategories" : [ "bug", "insect" ],
    "quantity" : 10,
  }
}

Feel free to edit these values however you want. These value allow you to change how this achievement will react. Each of these properties are for a separate feature of the achievements. The first property, "code", is known as the identifier of this achievement. This is basically a unique name that the game can always rely on to find this achievement. The recommendation for this property is to make it the filepath to your file but replace "\" with ".", as the file path is always guaranteed to be unique. The second property "icon" is the path to a model file that the game will use as the icon for the game. Act like this is kinda like Tile#"voxels". "requirement" is the next property. This specifies what achievement needs to be completed before this achievement can be completed. Use the specific achievement's code here. "slot" is the next property. This property specifies the exact location of the achievement in the achievement menu.


The final property needs a little bit more explanation. Achievements are actually quite dumb by themselves. To get around this additional properties, known as Components, are added to the file. In the case of achievements, these extra components are used to specify how to unlock the achievement. In this case, the component that is most used is the Any Of Category Component, but others can be used. (See #Useful Components) In this case we only use 3 properties of "anyOfCategory". The first is "type", which specifies what type of action must be done in order to count. (Do you need to "collectItems" or "orderItems".) See the full list here. "orCategories" is used when looking at the items. If the item has at least one of the categories listed then it will be counted. If you want all categories to be on the item then use "andCategories" instead. The final property is "quantity" which lists out how many items of this type is needed before the achievement is completed.

If you want to have a reward you can add the following to the file;

"rewards": [
  {
    "code": "staxel.item.quest.BlueSocks",
    "quantity": 1
  }
]

This additional property adds a list of items that will be given to the player upon completion. This list of items actually follows Items#How to Spawn an Item, but in most cases you can use an item's code. There is one difference, which is that in this case it can take a value "quantity" in order to specify how many items to spawn. Note that Tiles and Clothing cannot be just a "code" and "quantity".


With that you have created an achievement. Once you have content built, you can see this achievement in the inventory menu. Be sure to look at #Useful components to see what other types of achievements you can make.


Useful components

For Achievements, their components mainly specify ways of completing the achievement. The majority of achievements will have at least one of the following components;

Any Of Category Component

This component is the main component in achievements. It is used to make the player collect a certain number of items. These items must have the categories that is listed in the component in order to count towards completion.

For more information on how to use the Any Of Category Component, head to Any Of Category Component#When and How to use.


Collect Items Component

This component is used to make the player collect a certain number of a specific item. This uses Spawned Items instead of categories to complete the achievement.

For more information on how to use the Collect Items Component, head to Collect Items Component#When and How to use.


Misc Component

This component is used to listen to any miscellaneous achievement triggers that the game might use. Certain actions will use this type of component, such as checking if the player threw a ball.

For more information on how to use the Misc Component, head to Misc Component#When and How to use.


Own Items Component

This component is highly similar to Collect Items Component except that it only accepts codes, but allows specifying a number of items. This component is largely outdated but can still be used.

For more information on how to use the Own Items Component, head to Own Items Component#When and How to use.


Talk To Component

This component is used to track who the player has talked to, and is mostly used as a way of directing the player towards finding information.

For more information on how to use the Talk To Component, head to Talk To Component#When and How to use.


Water Crop Component

This component is used to track how many tiles the player has watered. This was mostly used as a way to point the player towards watering tiles in the tutorial.

For more information on how to use the Water Crop Component, head to Water Crop Component#When and How to use.


Config Options

"code"

Valid options (String): A unique string which achievement what this object is.

Default Value: No default value is specified. Always need to provide your own.


This option is required to uniquely identify any object or resource. This string must be unique to all other codes, but does not have any other requirements.

For example: Having the code "mods.testachieve.achieve1" creates an object that has the handle "mods.testachieve.achieve1".


"icon"

Valid options (String): A string which contains the path to an model file.

Default Value: Either "icon" or "itemIcon" must be specified. If both are specified then "icon" is used before "itemIcon".


This option points to a model file. This model file will be displayed alongside the achievement in order to help the user identify the achievement.


"itemIcon"

Valid options (Spawned Item): See Items#How to Spawn an Item for more information.

Default Value: Either "icon" or "itemIcon" must be specified. If both are specified then "icon" is used before "itemIcon".


This option makes an item that is to be displayed. This item will be displayed alongside the achievement in order to help the user identify the achievement.


"progressesWithoutRequirement"

Valid options (Bool): True or False

Default Value: If not specified, will default to False.


This option specifies whether or not progress will start on this achievement before the achievement is fully unlocked. This is for the cases such as "Catch 10 Bugs", "Catch 20 Bugs" etc, where it would be weird to start the second achievement with "0/20 Bugs Found" rather than "10/20 Bugs Found".


"public"

Valid options (Bool): True or False

Default Value: If not specified, will default to True.


This option specifies whether or not this achievement will be shown on the achievements page. Handy for not showing players certain achievements.


"requirement"

Valid options (String): A string which contains another Achievement's code.

Default Value: If not specified, will not require another achievement. These achievements should have "starter" set to true.


This is the achievement that must be completed before this achievement can be completed.


"rewards"

Valid options (List of Spawn Item): A list of Items to be spawned. See Items#How to Spawn an Item for more information.

Default Value: No default value is specified. Always need to provide your own.


These are the rewards that are given to the player once the achievement has been completed. Rewards are meant to be collected from Farm Fan.


"slot"

Valid options (Vector 2 - Integer): {"x": 0, "y": 0}

Default Value: No default value is specified. Always need to provide your own.


This is used to specify the exact position this achievement will appear in the Achievement menu. This menu is located in the inventory screen.


"starter"

Valid options (Bool): True or False

Default Value: If not specified, will default to False.


This option is used to specify if this achievement will be unlocked at the start of the game.