edited July 15 in General Discussion
Howdy,

I have some custom battle ideas that go against the way classic TBS games are structured.
My question is what is the best way to accomplish these from inside the framework.

For anyone other than me reading this thread - im going to update this original post with questions and answers so you dont have to read any further.

1. Let's say you attack an enemy, but he has a special bonus that allows him to attack first when attacked, how would I account for that in an event? The best way to describe this is a pre-counter attack.
1a) Use a Use Battle Action node and set the Add Action setting to Sub Action. This will use whatever action you want to use outside of the system's action chain as an action within the current action. You can also wait for the action to finish before continuing the current action (event).
Check for the bonus if the action should be used before that, e.g. with a Check Status node.
You'd need to set this up in a battle event and add it to every action (e.g. ability) where it should be possible to perform such a pre-counter.
2. Let's say you are in a special battle where both the attacker and the target get a shot in. The best way to describe this is a 100% chance of counter, but i don't want it dictated by the combatant or the weapon. I want it dictated by the type of battle
2a) Easiest way to do this is by setting a variable to mark these special battle types (e.g. set in the battle start event) and use a counter chance formula that results in 100 % (i.e. result is 100) if that variable condition is valid.
Another way would be to use a system similar in (1) at the end of every action.
3) When a battle event takes place (like attack), I'd like to lock targets together. Say Player 1 attacks Enemy 2. I'd like to be able to store, and access the stored target (for both the player, which is Enemy 2, and the Enemy, which is player 1) from a node, after the first attack takes place. Is that possible?
3a) Hmmm ... I don't think that's really doable. While you can store combatants (e.g. using selected data), these are stored globally and not bound to a specific combatant.
You probably could use object variables and create some kind of custom system with e.g. float variables marking each individual combatant.
I will update this thread as i think of other things. Thanks in advance.
Post edited by chud575 on
  • You're in luck, there have been some additions in the latest update that allow creating such systems :)

    1) Use a Use Battle Action node and set the Add Action setting to Sub Action. This will use whatever action you want to use outside of the system's action chain as an action within the current action. You can also wait for the action to finish before continuing the current action (event).
    Check for the bonus if the action should be used before that, e.g. with a Check Status node.
    You'd need to set this up in a battle event and add it to every action (e.g. ability) where it should be possible to perform such a pre-counter.

    2) Easiest way to do this is by setting a variable to mark these special battle types (e.g. set in the battle start event) and use a counter chance formula that results in 100 % (i.e. result is 100) if that variable condition is valid.
    Another way would be to use a system similar in (1) at the end of every action.
  • Thanks!

    3) When a battle event takes place (like attack), I'd like to lock targets together. Say Player 1 attacks Enemy 2. I'd like to be able to store, and access the stored target (for both the player, which is Enemy 2, and the Enemy, which is player 1) from a node, after the first attack takes place. Is that possible?

  • 3) Hmmm ... I don't think that's really doable. While you can store combatants (e.g. using selected data), these are stored globally and not bound to a specific combatant.
    You probably could use object variables and create some kind of custom system with e.g. float variables marking each individual combatant.
  • okay, I solved #3 by doing the following:
    - creating a script that has a SelectedDataHandler variable, and adding it to the combatant
    - creating a custom battle event that has a to be stored combatant, and storer combatant. That calls the script and stores the selected data.
  • edited July 17
    okay, after fiddling around, I have a feature request:
    1. an 'Engage' or 'Lock' or 'Save Target' node, that saves the list of targets from the previous attack. This shouldn't be difficult, as you already have this information stored in user.Battle.LastTargets
    Sadly, for some reason the CombatantBattle script isn't available in the source so I don't know it's data type, but wouldn't need it anyways.

    2. An addition to the Status->Ability->Auto Target under Use Auto Target that is a checkbox called 'Auto Accept Target', so that the user does not have the ability to confirm the auto-target.

    I would write this myself - but as you know we don't have access to any of the framework's gui code. But we're talking what - 10-15 lines of code here?

    Thanks in advance!
    Post edited by chud575 on
  • Sure that script is available in the source code, found in Gameplay > Combatants > Combatant. LastTargets is a List, i.e. a list of combatants, and contains the targets of the last action.

    Also, auto targeting doesn't need any accepting - as it automatically uses the action on targets, if possible. Needs auto targets set up in the ability/item :)
  • Sure that script is available in the source code, found in Gameplay > Combatants > Combatant. LastTargets is a List, i.e. a list of combatants, and contains the targets of the last action.
    You're right - it wasn't in there in 2.11, but it's in there now (as of 2.12)
    Also, auto targeting doesn't need any accepting - as it automatically uses the action on targets, if possible. Needs auto targets set up in the ability/item :)
    As far as I can tell, in turn-based mode this is not the case, maybe in real time mode it works. Any help on this would be appreciated.
  • Make sure that:
    - Auto Target is enabled in the combatant's AI Settings
    - the used ability/item has Use Auto Target enabled
    - the control map key has Use Auto Target enabled
  • Ok. I think we're talking about two different things. I don't want auto target, I want auto accept

    So I want to click something like "continue attack" which would be an ability I create, use the last used target, and automatically attack the last target without needing to confirm the selection.

    Is that doable?
  • Ok, I've kind of solved this, but run into a different problem (which just seems to always be the case).

    If in the battle menu, I create a button of type Auto, and in the Combatant's AI, I set him to Attack Last Target, and select this button during combat, I get the exact effect I'm looking for. The Combatant will attack the last target it acquired (perfect!).

    But - I want to create a condition for showing this button (I want the player to lock onto or engage his target first, before showing such a button) - and while Abilities have conditional settings, Battle Menu buttons do not :-(

    Is this something you'd be willing to implement for me?
  • I just discovered this... did you intentionally include the framework code (The stuff that makes the Framework window appear) in the source? Because if so - right on. Now I can finally create my own custom menu items and have an easier time implementing my own GUI.

    So to follow up with the previous post - I added a SimpleCombatantRequirement to the AutoBattleMenuItem script, rebuilt the .dll, and now I've got what I want.

    However - this definitely has me worried about working with updates. Perhaps I should make my own custom battle menu item instead? But even if i did, I'd still have overwrite BattleMenu.cs (for this particular feature) so the problem still exists. Perhaps I should just merge the code where necessary when you update.
  • You're probably looking for the Auto Attack feature, where you can have a combatant automatically attack a target with the base attack or a defined ability.

    The gameplay code was always added to the full version - the editor code isn't included (and I just checked, it's not in there), so which one are you talking about?

    If you make changes to the code, you'll have to manage merging this with updates yourself. Using GIT or a similar solution is usually the best option here :)
  • AutoBattleMenuItem, etc, and BattleMenu is to what i'm referring - it's the first time i found code that let me customize an actual item that is represented inside the framework editor. In general, it would be really great to have access to that code as well, so that I can change how i interface with the framework a touch. By not giving us that, you've kind of put us in a box as to what we can accomplish from within the framework.
  • Okay, time to move on to a different topic! :p

    Let's say I want to add a certain order to the way battles play out. We still have a turn order, and everything is done in "classic" mode, but after everyone has selected their actions, we execute in the following order:

    1. Ranged attacks go first
    2. Movements (and special calculations to stop movements)
    3. Melee Attacks

    You think there's a way to do that on the fly using nodes? Or would I need to write my own combat type (Classic+)?
  • All gameplay related code (i.e. also in-game UI stuff like the battle menu) is available in the full version and has nothing to do with the ORK Framework editor in Unity :)
    The only code not included is the core serialization functionality and the Unity editor.

    Hm, I'd say you'll have to do some custom coding there - not so much as writing your own battle system, just sorting the battle actions as you need it. Check out the BattleActionHandler class (found in Gameplay/BattleSystem/Actions/), all the actions that are registered by the system are stored in the actionList, i.e. you can simply sort that list with a custom sorter.
Sign In or Register to comment.