edited June 2017 in ORK Scripting
So I made some playmaker actions some time ago and I'm trying to get them to work again but I can't figure out whats wrong with them. Did anything change in ork? Any insight would be helpful.

UPDATE!!: Okay, I've confirmed that there is nothing wrong with setting the variables, it seems to be something wrong with the way the playmaker script is set up. I will continue to investigate.

UPDATE!!2222!!: Okay, I got it to work. Apparently, I needed to change OnUpdate() to OnEnter(). I don't really get it but it works now.

using UnityEngine;
using ORKFramework;
using System.Collections;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Ork Framework")]
[Tooltip("Set or create an ork variable. Leave unused values empty!")]
public class SetOrkVariable : FsmStateAction
{
public enum VarType
{
String,
Bool,
Float,
Vector3
}


[RequiredField]
[Tooltip("The type of the ork variable.")]
public VarType orkVariableType;

[RequiredField]
[Tooltip("The name of the variable you wish to use.")]
public FsmString orkVariableName;

[ActionSection("Set Value")]

[Tooltip("The string value of the variable.")]
public FsmString orkVariableString;

[Tooltip("The bool value of the variable.")]
public FsmBool orkVariableBool;

[Tooltip("The float value of the variable.")]
public FsmFloat orkVariableFloat;

[Tooltip("The vector3 value of the variable.")]
public FsmVector3 orkVariableVector3;

public override void Reset()
{
orkVariableType = 0;
orkVariableName = "";
orkVariableString = "";
orkVariableBool = null;
orkVariableFloat = null;
orkVariableVector3 = null;
}

public override void OnUpdate()
{
switch (orkVariableType)
{
case VarType.String:

ORK.Game.Variables.Set(orkVariableName.Value,orkVariableString.Value);

break;

case VarType.Bool:

ORK.Game.Variables.Set(orkVariableName.Value,orkVariableBool.Value);

break;

case VarType.Float:

ORK.Game.Variables.Set(orkVariableName.Value,orkVariableFloat.Value);

break;

case VarType.Vector3:

ORK.Game.Variables.Set(orkVariableName.Value,orkVariableVector3.Value);

break;
}
Finish();
}
}
}
Post edited by Dre788 on
Sign In or Register to comment.