A created a custom node to remove a random status effect when a healing kit is used. This works fine for the currently active party member.

However, I need to figure out how to apply this function to the combatant you select from the Combatant Selection window.

For example, if I use a healing potion (no custom code) and select combatant #2 from the list, combatant #2 is healed.
Is this possible?

I found - ChoiceSelected in lots of the menu scripts; but, they return nothing.
  • edited September 2020
    Without knowing more about your custom node it's hard to tell - generally, you'd want to have the usual object selection in your node (i.e. a field using EventObjectSetting class) to e.g. select user or target of an action to be used in the node.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Below is the code for the node. I'm using a global event on the item to perform this function if that makes a difference


    // INFO: the editor help attribute lets you define the title and help text of a field or class.
    [ORKEditorHelp("Heal Random Injury", "This will remove 1 random injury from target combatant.", "")]
    // INFO: this attribute can be used to limit the step to only be available in defined event types.
    // INFO: using 'typeof(BaseEvent)' makes it available in all event types.
    // INFO: separate multiple types through commas, e.g.: typeof(GameEvent), typeof(BattleEvent)
    [ORKEventStep(typeof(BaseEvent))]
    // INFO: this attribute defines the name of the list in which the step will be displayed.
    [ORKNodeInfo("Legendary/Status Steps")]
    public class HealRandomInjury : BaseEventStep
    {
    [ORKEditorInfo(labelText = "Combatant")]
    public EventObjectSetting usedObject = new EventObjectSetting();

    // changes
    [ORKEditorArray(true, "Add Status Effect", "Add a status effect cast to the list.", "",
    "Remove", "Remove this status effect cast from the list.", "", noRemoveCount = 1)]
    [ORKEditorInfo(separator = true, labelText = "Status Effect Changes")]
    public StatusEffectCast[] effect = new StatusEffectCast[] { new StatusEffectCast() };


    public HealRandomInjury()
    { }

    public override void SetData(DataObject data)
    {
    base.SetData(data);

    if (data.Contains<int>("pID"))
    {
    this.usedObject.type = StepObjectType.Actor;
    data.Get("pID", ref this.usedObject.aID);
    }
    }

    public override void Execute(BaseEvent baseEvent)
    {


    List<Combatant> list = this.usedObject.GetCombatant(baseEvent);
    for (int i = 0; i < list.Count; i++)
    {
    if (list[i] != null)
    {
    CombatantStatus cs = list[i].Status;
    List<StatusEffect> se = cs.Effects;
    List<StatusEffect> injuries = new List<StatusEffect>();
    //remove non-injuries from the list
    foreach (StatusEffect e in se)
    {
    if (e.TypeID == 16)
    {
    injuries.Add(e);
    }
    }
    if (injuries.Count > 0)
    {
    int roll = UnityEngine.Random.Range(0, injuries.Count);
    StatusEffect s = injuries[roll];
    cs.RemoveEffect(s, false, false);
    }
    }
    }
  • You can ignore this GIL unless you want to answer for others.
    I figured out a better way to do what I wanted to do now that I understand what usedObject
    actually is. This one is on me :)
  • If you're using the item's global event settings, that'll only use the user of the item in the event. If you want the target as well, use the Game Event settings in the Target Changes, which will use a game event per target (with both user and target available as actors).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.