I'm trying to create a "Stun" status effect in my combat system. It currently uses a dynamic initiative system that shifts up the initiative order constantly, and turns are measured in terms of an amount of "action time" that runs while you are taking actions such as attacking or moving or using abilities. I'd like the Stun status effect to to block movement and ability use while on the target and to last for a few seconds. All of that is easy. I was able to adapt the "block" status effect from the tutorials. But I'd like the status effect to also cost action time while it lasts (i.e. it will prevent you from doing anything for 2 seconds during which you loose 2 seconds of action time as though you used an ability whose animation took 2 seconds to execute.) How would you suggest accomplishing this effect?
  • Aren't actions blocked by the effect anyway while it is applied? That should already take care of it.

    Otherwise, you can use a formula for the action time and e.g. reduce it if the effect is applied.
    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!
  • Yeah, all actions are blocked. but action time is set to "while in action" so it won't decrease and you can't pass your turn. I'd like it to, like, play a "stunned idle animation" and drain your action time for the number of seconds that the stun is supposed to be, and then let you continue normally. Should I use a game event for that?

    Also, the Stun status effect is currently set to end after: time. but it appears as though that doesn't delay until the start of the persons turn, so usually the number of seconds it stuns the person have elapsed while other people take turns before the stunned target gets their turn in the first place. Is there a way to delay the status effects duration until the start of the victims next turn?
  • Well, yeah, effects ending after time start ticking when they're applied.

    One way to solve this is to split it into 2 separate effects - one that's applied by attacks and one that handles the actual stunning.

    1) Stun applied by abilities/etc.
    End after Start Turn and applies the 2nd stun effect via the End Status Effect Casts. Doesn't do anything else (e.g. blocking actions, etc.).

    2) Time-based stun.
    Ends after Time, blocks actions, etc.

    That should do the trick, though I haven't tested it.
    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!
  • That's a really good idea and it works! I've tested it and it works. Now I just need to make the action time reduce properly. I have some questions:

    1. When is action time calculated if I use a formula? At the start of a characters turn or continually? For example, if I used the dual status effect system you described above and had the first status effect stackable, and the second one's duration set to 1 second, with recast set to add. Could I check the number of stacks of the first status effect in the action time formula to determine how much to reduce it by?

    2. Is there a node that lets me convert the number of stacks of a status effect directly into a Float value? I know I can use a status fork node to do this with a lot of different forks, but then there would be a number of stacks it couldn't handle automatically.
  • 1) It's calculated when the combatant's timebar reaches the menu border, i.e. when choosing actions starts (usually also start of the combatant's turn). However, it's calculated before turn start can happen, so when the 1st effect would be applied - so yeah, checking the stack in the formula is possible here.

    2) No, currently not, you'll have to go the fork way :)
    Also, you can limit the stack count via Set Max Stack to keep it simple.
    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!
  • Alright, currently all of that is working great. But two other corner cases:

    1. What if I want the status effect to last longer than 1 turn? E.g. same effect, but instead of the ability #1 end on start of the next turn, have it apply the other status effect on start of turn each turn? Similar to the poison status effect in the tutorial, but inflicting a status effect instead of loss of HP?

    2. Alternatively if I have a "persistent area" ability (e.g. cloud of stunning gas) that triggers when people move through it, and therefore could stun someone in the middle of their turn, how would you handle that? Ideally it would apply X seconds of being blocked, during which you would loose action time, and apply on one of move-to or move-over for a cell... also probably be nice if I could limit it to only once per turn per combatant or something like that.
  • 1) Your turn-based stun effect can last for multiple turns and instead of using the End Status Effect Cast use a Game Event on Turn Start that applies the other time-based stun effect.

    2) Hm, if it uses an event, you could e.g. use a Check Status node to check for Is Choosing or Turn State to see if the combatant is currently in turn and add the appropriate effect ... also, the Change Action Time node can be used to change the combatant's action time directly (since it can't influence the calculation of the already started turn).
    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!
  • 1) for that Game event would the "Starting Object" of the event be the combatant that the Status Effect was on? (e.g. for setting an event actor via type starting object)
  • 1) Yes, the combatant the effect is on is the Starting Object actor. The combatant who applied it (e.g. via an ability) would be available as the Event Object.
    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!
  • edited October 2021
    2) actually, come to think of it, do you have any tutorials or examples for how to create a persistent effect in a grid battle? such as a poison cloud that damages anyone in it at the start of their turn, or does a very small amount of damage whenever they move into a hex within it, and lasts for a certain number of it's creators turns?
    Post edited by Whatexists on
  • 2) No, there isn't really a specific tutorial for this. However, the grid battle tutorials cover using cell events in the grid move command events.
    So, what you'd want to do is add cell events to the cells that should have some kind of effect. E.g. it could use an ability or just add/remove a status effect, etc.
    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!
  • 2) So the "Create Poison Cloud" ability would add cell events to the cells in it's area? Would I do that through the animating game event? Search for the cell objects in the scene and add the events to them; then when the ability ends have it's end event search for the same cells and remove the event?
  • 2) Yes, the battle event of the ability would handle that.
    E.g. use a Store Grid Cells node to get the cells around the selected target combatant (or cell) you want to use and a Add Temporary Cell Event node to add the temporary cell event. The Store Grid Cells node can e.g. use battle range templates for this - the cells will be stored into found objects.
    The temporary cell events can e.g. automatically be removed after a defined number of turns or time.
    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!
  • Alright. I'm having a problem where the AI, when stunned at the start of their turn, instantly concludes all it's actions are illegal and so executes it's "end turn" action. Is there a way to get it, to, like, wait for the status effect to be over before running through it's normal set of AIs? I can put in an AI at the beginning with a status requirement based on stun being applied, but I can't figure out how to make a Battle AI just... wait patiently until the status effect is gone.
  • If stun means that all it's actions are blocked, the battle AI isn't executed at all and immediately ends the combatants turn (none actoin).
    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.