Jump to content
Aveyond Studios Community
Amaranth

[WIP] Reference: fields for actions

Recommended Posts

This guide contains the fields that you can use to create actions.

Overview:

Spoiler

Each field has two scripts associated with it. Let's learn more about these scripts.

  • The first one is used to display a field in a hero action in the HeroKit Editor (ex. GetBoolValue).
  • The second one makes the action occur when you play the game (ex. BoolValue). 
  • Each field needs an ID (and sometimes two or more). This ID needs to be referenced in both scripts. I'll how you how to do this below.

Where to get your fields

Spoiler

This directory contains the fields that you want to display in the action form (Action form fields):

  • HeroKit > Hero Engine > Framework > 3. Hero Actions > Editor > Fields > Other Fields

This is directory contains the logic for the fields above (Action runtime fields):

  • HeroKit > Hero Engine > Framework > 3. Hero Actions > Scene > Fields

When you look in these two directories, notice that the C# files names almost match each other. In the Other Fields directory, you'll noticed that the C# files all begin with "Get" and that they don't in the Fields directory (ex GetBoolValue, BoolValue)

Where to put your fields

Spoiler

Action form fields go in an action's Fields script. To look at this script, double-click on any Hero Action. This opens the Hero Action in the HeroKit Editor. In the HeroKit Editor, double-click on the script in this field: Action (this is used to create the fields for this action). 

  • Example: HeroKit > Hero Engine > Actions > Templates > Hero Action Template > Editor > HeroActionTemplateFields.cs

Action runtime fields go in an action's runtime script. To look at this script, double-click on any Hero Action. This opens the Hero Action in the HeroKit Editor. In the HeroKit Editor, double-click on the script in this field: Action (this is used during gameplay).

  • Example: HeroKit > Hero Engine > Actions > Templates > Hero Action Template > HeroActionTemplate.cs

Create your form fields before you use their IDs

Spoiler

In each hero action's Field script, you must specify how many fields to use BEFORE you add fields & and assign these fields IDs. The hero action's Field script must have this line of code:

ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 5);

If you open any Field script for an existing hero action, you will see this code (usually on line 23). Do you see the number 5 above? This is the number of fields for this action. It means that you can now assign IDs (0, 1, 2, 3, or 4) to your fields.

REMEMBER to only assign an ID to one field. If you use the ID twice, the second field will overwrite the data in the first field. 

The fields and how to use them in your code (C# coding required)

Spoiler

Animation Paramater

Bool Field

Spoiler

Bool Field A (Value, Variable, Property, Global):

Spoiler

pBzEvLd.png

Put this in the action's fields script (ex. HeroActionTemplateFields):

  • GetBoolField.BuildFieldA("Turn on hyperdrive?", actionParams, heroAction.actionFields[2], false);

Put this in the action's runtime script (ex. HeroActionTemplate):

  • bool change = BoolFieldValue.GetValueA(heroKitObject, 2);

IMPORTANT: Replace 2 with the ID that you want to use with this field. 

Bool Field B (Variable, Property, Global):

Spoiler

ah6ytut.png

Put this in the action's fields script (ex. HeroActionTemplateFields):

  • GetBoolField.BuildFieldB("Turn on hyperdrive?", actionParams, heroAction.actionFields[2], false);

Put this in the action's runtime script (ex. HeroActionTemplate):

  • bool change = BoolFieldValue.GetValueB(heroKitObject, 2);

IMPORTANT: Replace 2 with the ID that you want to use with this field. 

Bool Value

Spoiler

Cfyh0eT.png

Put this in the action's fields script (ex. HeroActionTemplateFields):

  • GetBoolValue.BuildField("Change default values?", actionParams, heroAction.actionFields[2], true);

Put this in the action's runtime script (ex. HeroActionTemplate):

  • bool change = BoolValue.GetValue(heroKitObject, 2);

IMPORTANT: Replace 2 with the ID that you want to use with this field. 

Camera Field

Child Object Field

Color Value

Conditional Field

Coordinates Field

Drop Down B Field

Drop Down Field

Event Field

Field Info Field

Float Field

Game Object Field

Hero Object Field

Hero Property Field

Hero Type Field

Integer Field

Layer Mask Value

Method Field

Object Value

Parameter Field

Prefab Value

Property Field

Rigidbody Value

Scene Object Value

Slider Value

String Field

Tag Field

Tag Mask Value

Unity Object Field

Share this post


Link to post
Share on other sites

×