Jump to content
Aveyond Studios Community
Sign in to follow this  
Ant

Add or edit a variable in a hero object

Recommended Posts

What is a variable?

A hero object can have variables. A variable is a value that can change while a game is being played. For example, you could use a variable to monitor the health of a monster in the game. And if the health for the monster is 0, you could use this information to change the state of the monster from alive to dead.   

Variables on a hero object can be accessed and changed by other hero objects via actions. These are the default variables available in HeroKit. If you want, you can also create your own.

Variable Types:

Spoiler

Integers 
A whole number. 

Floats 
A number that can have a decimal point. 

Bools 
A value that can be true or false. 

Strings 
Letters, words, sentences. 

Game Objects 
A game object. You can only assign a game object to this variable when the game is running.

Hero Objects 
A hero object. When the game is running, you can also assign hero blocks to this variable.   

Unity Objects 
An object that exists in Unity. Audio Clip, Sprite, Scene, Particle System, Mono Script are supported by default. 

Create a variable:

Spoiler

Open the hero object where you want to create the variable. Expand Variables and select the type of variable you want to add. Click the Add Variable icon.

Create an integer:

Spoiler

An integer field has two slots. One for the value (left) and one for a description (right). In this example, we've added an integer called Health. The default value is 0.

i9RyA0A.gif

Create a float:

Spoiler

A float field has two slots. One for the value (left) and one for a description (right). In this example, we've added a float called Speed. The default value is 0.

FOxzrch.gif

Create a bool:

Spoiler

A bool field has two slots. One for the value (left) and one for a description (right). In this example, we've added a bool called Health is 0? The default value is false.

F5Xu0e3.gif

Create a string:

Spoiler

A string field has three slots. One for the value (left), one for a description (right), and one to specify whether this string contains variables which should be displayed during gameplay (bottom). In this example, we've added a string called Intro message. The default value is "Hello there. How are you?" There are no variables in the value, so we've left the "String contains variables" box unmarked.

FokzJrC.gif

If your string does have variables in it, this is what your variable should look like. This string contains a variable (Variables > Integer > Slot 2). The "String contains variables" is marked (otherwise, the value on the top line will be used verbatim in the game). When you run the game, the value displayed will be something like "Monster Kills: 23" or "Monster Kills: 2". 

VZYTUUl.png

Create a game object:

Spoiler

A game object field has one slot for the description. In this example, we've added a game object called Food. The value for this field is hidden. We set the value via actions.

vIdE76b.gif

Create a hero object:

Spoiler

A hero object field has two slots. One for the description (top) and one for the value of the hero object (bottom). In this example, we've added a hero object called Bats. The hero object value for this field is Bat. There is a hidden value field that can contain a list of hero blocks. It's hidden because we set the values of this list via actions.

vEO4v8f.gif

Create a unity object:

Spoiler

A unity object field has three slots. One for the type of unity object (top), the value (middle), and the description (bottom). In this example, we've added an audio clip called Background Music. We did not give it a description.

zewm3wO.gif

Copy a variable:

Spoiler

Copy one variable:

Spoiler

Open the hero object that contains the variable you want to copy. Expand Variables and click on the type of variable you want to copy. In the variable list, click the copy icon to the right of the variable.

In this example, we are going to copy the Attack variable.

r6I1vJa.png

Copy a range of variables:

Spoiler

Open the hero object that contains the variables you want to copy. Expand Variables and click on the type of variable you want to copy. In the variable list, click the settings icon. In the range field, enter the ID of the first variable to copy. In the to field, enter the ID of the last variable to copy. Click Copy [variable type].

E4vCI8H.gif

 

Paste a variable:

Spoiler

Paste one variable:

Spoiler

Copy the variable you want to use. Open the hero object where you want to paste the variable. Expand Variables and click on the type of variable. In the variable list, click the paste icon to the right of the variable. The copied variable is inserted after this variable.

In this example, we are going to paste a variable after the Attack variable.

AcnjFj3.png

Paste a range of variables:

Spoiler

Copy the range of variables. Open the hero object that contains the variables you want to paste. Expand Variables and click on the type of variable you want to paste. In the variable list, click the settings icon. Click Paste [variable type].

eBWMeX6.gif

 

Delete a variable:

Spoiler

Delete one variable:

Spoiler

Open the hero object that contains the variable you want to delete. Expand Variables and click on the type of variable. In the variable list, click the delete icon to the right of the variable.

In this example, we are going to delete the Attack variable.

N76q31w.png

Delete a range of variables:

Spoiler

Open the hero object that contains the variables you want to delete. Expand Variables and click on the type of variable you want to paste. In the variable list, click the settings icon. In the range field, enter the ID of the first variable to delete. In the to field, enter the ID of the last variable to delete. Click Delete [variable type].

lsXWTzH.gif

 

Restore the most recently deleted variable:

Spoiler

Open the hero object that contains the variables you want to restore. Expand Variables and click on the variable type. Click the Undo icon.

b6SW0iP.gif

 

Share this post


Link to post
Share on other sites
Sign in to follow this  

×