In my game, I have mounted characters and their base attack ability has to change when they're mounted or afoot. Because there is no condition for Weapons/Attack Settings/Override Attack, I can't specify which ability to use as an override depending on a status effect or something. However, I use grid combat and an Attack of Opportunity mechanic that uses the Grid Move Out of Range node in which uses the base attack for its use range. So, the best think I thought I should do was to set the base attack through code. I tried it with Combatant.Setting.baseAttack (which requires a ActiveAbilitySelection[] type, which I create and populate with the ability I want). However, I'm not sure it changes the combatant instance or the editor combatant. Also, when I use combatant.Abilities.GetCurrentBaseAttack(), it does not return the new base attack. Is there a function to set the current base attack?
  • Ok, so I managed to set the current attack with this:
    combatant.Abilities.InitAttacks();
  • edited February 2020
    Changing the setting would change it for all newly created combatants.

    I think the best option would be to use a special, hidden weapon and hidden equipment part for this. The weapon can override the base attack, so just equip the weapon when mounting, and unequip it when dismounting.
    Having the weapon on a different (hidden) equipment part would prevent interference with your other equipment, and the player doesn't know anything bout it :)
    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!
  • Got it! However, since I have multiple weapons with different base attack and I don't want to have to create hidden counterparts for all of them (the hidden version of the weapon which overrides the base attack when equipped), I think I still prefer to change the editor setting, change the combatant's base attack and then change the editor setting back so it's ready when I want to instantiate another combatant. Anyway, when I create a combatant, my script overrides his base attack based on the equipment ability he has, so I don't really care about the default editor value for the base attack of my combatants.

    Do you foresee any problem with this method?
  • Also, how can we get a list of all the abilities given by a weapon?
  • I guess there shouldn't be any problems as long as the combatant is only used by the player or there are no new combatants created while this is changed.

    Hm, I don't think there's currently an easy way to get them - you'd have to go through the equipment's ability settings and get the abilities from the combatant via the ability's ID.
    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!
  • Ok. For other users who might want to do the same thing, I managed to get the equipment responsible for an ability by using this code:

    EquipAbilityShortcut equipAbilityShortcut= abilityShortcutList[i] as EquipAbilityShortcut;

    This enables me to check equipAbilityShortcut.Equipment.
Sign In or Register to comment.