Mutable

From RPG Creation Kit
Jump to navigation Jump to search
Mutable_FirstMainQuest_Goto in the cell "Virrihael (0,1)".

Mutables are a special kind of Object in the RPG Creation Kit that allow to show/hide GameObjects in base of the state of the mutable, that is represented by a simple value true or false.

They are saved on the Save File and they serve two important purposes:

  • Transforming an Object into another. For example, there are 2 models of the same statue, one that has the statue intact, the other one broken - after a quest the statue has to be broken - the Mutable allows to remember when the intact statue needs to be active and when it needs to be replaced by the broken one.
  • Enabling/Disabling GameObjects while having their state saved on the save file.


The important thing to notice is that you can mutate a Mutable anytime, anywhere, and you can also revert its state to its original state (and mutate again) an undefined amount of times.

Most of the Mutables in the Demo are used in conjunction with the Goto elements, to ensure that they are used once and then disabled forever.

Let's analyze the Mutable_FirstMainQuest_Goto, in the Cell "Virrihael (0,1)".

Elements:

  • GUID Str: represents the ID of the Mutable and the string you will use to reference it.
  • Normal Object: the Object that needs to be active if the Mutable is not mutated (means isMutated is false)
  • MutatedObject: the Object that needs to be active if the Mutable is mutated.
  • isMutated: represent the state of the mutable.


When isMutated is false, "Normal Object" is enabled and "Mutated Object" is disabled.

When isMutated is true, "Normal Object" is disabled and "Mutated Object" is enabled.

The fields can be null, means you can hide the Normal Object without having to enable a Mutated Object (and back).


In our Mutable_FirstMainQuest_Goto Mutable we have that the Normal Object FirstMainQuest_Goto is enabled by default, and our use of the Mutable is to disable it once it runs the first time.


You can also use it the other way around, you can have a GameObject disabled by default and enable it by using a Mutable.