playMaker

Author Topic: How to Make Custom Action Sliders Dependent on Each Other?  (Read 929 times)

mrphilipjoel

  • Junior Playmaker
  • **
  • Posts: 57
How to Make Custom Action Sliders Dependent on Each Other?
« on: October 03, 2021, 06:36:08 AM »


Edit: Image code isn't working in post. So here is the link https://i.ibb.co/bHPxMH8/Capture.jpg

I've made the simple action as pictured above.
I was trying to figure out, how to force these four values to stay below 200 as a sum of the four.

At first I looked at CustomActionEditor, but I couldn't figure out how to get the variable values.

So, then I tried using OnGui() to have the action update when the Gui was changed, and for update the values. Weirdly, it worked once, but I haven't been able to repeat it.

Below is my code, where I was just trying to update 2 of the variable sliders.

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{

[ActionCategory("2D Fighter")]
[Tooltip("This action is used to setup the stats of your fighter.")]
public class CharacterStatsSetup : FsmStateAction
{
[HasIntSlider(0, 100)]
public FsmInt maxHealth;

[HasIntSlider(0, 100)]
public FsmInt punchDamage;

[HasIntSlider(0, 100)]
public FsmInt kickDamage;

[HasIntSlider(0, 100)]
public FsmInt speed;

// Code that runs on entering the state.
public override void OnEnter()
{

Finish();
}

public override void OnGUI()
        {
if(kickDamage.Value > 50)
            {
punchDamage = 0;
            }

        }


}

}
« Last Edit: October 03, 2021, 06:38:19 AM by mrphilipjoel »