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.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
// 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);
}
}
}
blindmonkeygames.com/index.html
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 :)
blindmonkeygames.com/index.html
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!