Is there a way to access/broadcast the range of an ability on selection?
I am working on a real time point click game. The goal goal would be displaying the range of an ability after it has been selected using a decal that follows the mouse until the ability has been activated.
combatant.Shortcuts.Active
combatant is an instance of the Combatant and this returns an IShortcut implementation (e.g. an AbilityShortcut or ItemShortcut).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
if(BattleMenuMode.Target == combatant.Battle.BattleMenu.Mode)
The battle menu is only initialized for player combatants, so if used for other combatants, do a null check for it first (combatant.Battle.BattleMenu != null).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
public Combatant combatant;
private IShortcut abilityShortcut;
void Start()
{
combatant = ORKComponentHelper.GetCombatant(this.gameObject);
}
void Update()
{
if(BattleMenuMode.Target == combatant.Battle.BattleMenu.Mode)
{
abilityShortcut = combatant.Shortcuts.Active;
// Use abilityShortcut functions
}
}
Unfortunately none of the abilityShortcut interface functions I can see, seems to point toward the ability range, am I doing something wrong?
TargetSettings settings = TargetSettings.Get(abilityShortcut);
The target settings have all range settings and functions to access them.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Is there a way to know when the shortcut ability has been used? I tried this but it looks like the range value remains the same even after the ability has been activated..
void Update()
{
if(BattleMenuMode.Target == combatant.Battle.BattleMenu.Mode)
{
abilityShortcut = combatant.Shortcuts.Active;
if(abilityShortcut!=null)
{
settings = TargetSettings.Get(abilityShortcut);
range = settings.useRange.range.range[0].GetRangeValue(combatant);
}
else
range = 0;
}
}
Though, you just need to add an else case for the battle menu mode check and reset the range here - i.e. reset the range field of your class when the battle menu is not in target mode.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!