playMaker

Author Topic: Is there a way to default FsmBools to true?  (Read 1879 times)

GarthSmith

  • Playmaker Newbie
  • *
  • Posts: 31
  • Games. Math. Code.
    • Garth Smith's Website
Is there a way to default FsmBools to true?
« on: December 05, 2014, 05:47:53 PM »
Hello! In a MonoBehaviour, I can declare public bool m_someBool = true; then whenever I add that component, the default value is set to true.

Can I do the same for FsmBools? When someone adds a custom action, can the checkbox start off checked?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Is there a way to default FsmBools to true?
« Reply #1 on: December 05, 2014, 08:38:47 PM »
i can make a custom Action for you if you want

what action you want to set standard to true?

"set bool value" ?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Is there a way to default FsmBools to true?
« Reply #2 on: December 05, 2014, 09:18:08 PM »
btw, you can also do it yourself if you want,
i changed the Action "set bool value" for you and added info of what i changed.

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2014. All rights reserved.

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Math)]
[Tooltip("Sets the value of a Bool Variable.")]
//Set you Custom Action Name Here and save with that name. DO NOT use the same name, it will be erased on updates. Custom names will not be erased.
public class SetBoolValueDefTrue : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmBool boolVariable;
[RequiredField]
public FsmBool boolValue;
public bool everyFrame;

public override void Reset()
{
// Set Default Variables here
boolVariable = null;
boolValue = true;
everyFrame = false;
}

public override void OnEnter()
{
boolVariable.Value = boolValue.Value;

if (!everyFrame)
Finish();
}

public override void OnUpdate()
{
boolVariable.Value = boolValue.Value;
}
}
}

always use a custom name for your edited or own made actions.

and share actions if you think they are usefull to others :D
« Last Edit: December 05, 2014, 09:21:09 PM by djaydino »