How to make a custom inspector to select variable from one script to another?

I want to do something similar to this:

https://forum.unity.com/threads/how-to-select-a-callback-function-for-your-script-from-the-editor.295550/

for example, I have a script A to record my character’s HP, MP, etc. And a script B to describe the result of drinking potion. The potion may restore HP or MP, and I want to make the decision can be changed from inspector so other game designer can make their own potion without change the code.

however, the event trigger seems cannot return int variable. I should find other way to make the variable selectable on the inspector.

How should I do it?

There are many ways to do it, it’s dependent on what effect you want.
I’m not sure if this is what you want, but I hope this can help you.

I create two scripts named A and B just like you said.

public class A : MonoBehaviour {
    public int originalHP;
    public int originalMP;
    public float originalTime;
    [Space]
    public int realHP;
    public int realMP;
    public float realTime;

    private void OnEnable()
    {
        realHP = originalHP;
        realMP = originalMP;
        realTime = originalTime;
    }
}

In “A” script, there are three values to record HP, Mp and Time(I don’t know what this mean, just an example fo float).
Every value has an original and real value, so the potion only changes the real value, if don’t do this, the value will accumulate, of course, you don’t want this happen.

[ExecuteInEditMode]
[RequireComponent(typeof(A))]
public class B : MonoBehaviour {
    public int hpEffect;
    public int mpEffect;
    public float timeEffect;
    
    protected void OnValidate()
    {
        A a = GetComponent<A>();
        a.realHP = a.originalHP + hpEffect;
        a.realMP = a.originalMP + mpEffect;
        a.realTime = a.originalTime + timeEffect;
    }
}

In “B” script, it set the “ExecuteInEditMode” and “RequireComponent(typeof(A))” tag to make sure this script will execute in edit mode and the object have to attach the “A” Script.
OnValidate() function will execute only when some value is change, it’s more great than Update() function.

If other designers make their own potion, they can inherit your “B” class.