Applying States During Combat

● ARCHIVED · READ-ONLY
Started by Beats 19 posts View original ↗
  1. I have an issue applying states during combat. I want to apply a state after all actions are chosen by the player, but before any actions are taken in the battle. I've devised a few work arounds, but they all seem really clunky. My goal is for the player to select the actions for their characters, the states be applied after all selections are chosen, then the battle continues. But, accessing this "between phase" has been really difficult for me.

    I'm a beginner and this has stumped me for weeks. I've googled so many things. I've downloaded so many plugins. I've watched so many videos. And yet, this has baffled me. I can have the player select a "stance" and then be able to use attacks that are mutually exclusive to each stance. But, it feels very clunky in practice. I want the player to be able to select an action and a state is applied to them before any actions are actually taken.

    I'm useless at javascript and I often can't get anything to work for me. However, I feel like what I want requires a script. I've exhausted all my other options and I can't figure it out. How in the world do I apply states to characters based on the actions the player has chosen, after all the actions are chosen, but before any actions are actually taken? I'm really at the end of my rope here.
  2. I think you're right that this will require a plugin.
    [mod]I am, therefore, moving this to JS Plugin Requests.[/mod]
  3. Thanks bud. I don't know how to approach this. It's completely stopped my progress because it's a necessary feature in every encounter. I've legit read dozens of threads on related subjects. Reread related plugins. Tried to use scripts. It seems like a really easy thing to solve and that's the very worst part.
  4. I think it would help if you explain what you want to do (ingame terms) instead of how you want to do something.
    Why is that a neccessary feature? what are those states used for?

    Because the way the battleengine works by default you'll most likely have to add another turn phase for this, and that requires good knowledge of the procedures....
  5. Last time I tried, turn events trigger at the start of the action phase, before any actions are taken.
    Unless you check turn end, then they trigger after all actions are taken.
    Have you tried applying states using a battle event set to take place each turn ?

    If this isn't what you're looking for, please tell us what you want to do exactly instead of how you want to do it, so we can see if there are other ways.
  6. Andar said:
    I think it would help if you explain what you want to do (ingame terms) instead of how you want to do something.
    Why is that a neccessary feature? what are those states used for?

    Because the way the battleengine works by default you'll most likely have to add another turn phase for this, and that requires good knowledge of the procedures....

    Well, I'm trying to do a game that utilizes formations and stances. Instead of the Fire Emblem weapon triangle, I want to give the player more choices that incrementally create effective/ineffective attacks. Instead of making weapon classes good against each other, I want to have three stances per CQC weapon. Stab, Slash, and Bludgeon. An action is chosen between these three stances. A submenu is opened that has attacks exclusive to those stances. The attack is then delivered during the turn.

    The deal is that using this attack applies a debuff on you. Slash> Stab > Bludgeon > Slash. So, being in the Slash stance means you're weak to Bludgeon, etc. If the stance is applied when the character attacks, slower characters won't have the stance applied to them before an attack is made against them. This eliminates the penalty for slow, attacking units! My strategy has been to evaluate what attacks were used that turn and the AI has the state placed on them that's strong against the stance the player is using to attack. When the next turn starts, the player sees what stance the enemies are in and they can react to that accordingly. Then, at the end of the turn, the enemies reevaluate and the most effective stance is placed on them. Rinse, repeat.

    I'll post one of the infographs I was working on. Obviously this is for internal use only and uses outside assets. SSB was inspired by Runescape. One of the things that stuck with me the most from my childhood was its weapon stances.
    1WtYLbB.png

    My issue is applying the stances before the action is taken during combat. In testing, I can create an Instant action that applies the state when the player chooses the stance. Then, the actor either learns the spells unique to that stance, has those mutually exclusive skills made visible to him, or it just seals all the other skills available. But, this has been very clunky. I really, really, really don't like breaking up the turn like this. It adds a lot more clicks, especially if the player decides to change his stance.

    I want the player to choose to attack CQC, then choose what form of attack they want to use, then a submenu opens up from the selected stance and the player chooses an option. Once all characters have taken action, the game uses a phase directly after those choices and applies the correct states. This is a much smoother option in my opinion. I have no idea how to add this extra phase.

    Also, I made that image at like 2am. So, there's mistakes. Try saying "quickets" out loud without smiling. What a fun word.
  7. Astfgl66 said:
    Last time I tried, turn events trigger at the start of the action phase, before any actions are taken.
    Unless you check turn end, then they trigger after all actions are taken.
    Have you tried applying states using a battle event set to take place each turn ?

    If this isn't what you're looking for, please tell us what you want to do exactly instead of how you want to do it, so we can see if there are other ways.

    I've messed with common events during battle and have been able to create some work arounds to the system that I desire. However, it requires a lot of work. With all I want to do, it'd take a hundred common events running during each turn. I feel like it'd weigh down the system and weigh down the game. I don't want turns to take several minutes to complete. I don't know js. It feels like I'm writing several volumes of books to describe every exact situation that the game may encounter. When someone more knowledgeable than me has a dictionary and can just point to all the words that he needs. I wanna be the guy with the dictionary, not the bookshelf.

    I also have a lot of other issues! I want to split actions into 1 major and 1 minor a turn. I also want to use formations but not in Side View mode. But, these are challenges to discuss at another time.
  8. @Beats what you want is theoretically possible even completely without a plugin, although you need to know the engine and its options in a very detailed form.
    and unfortunately I'm currently too tired to explain everything.

    basically you need to use skill speed for timing the selected skills, then have the different states give the skill type features (instead of having them on the class as usual) - this will make the selection by giving different skill types depending on stance.
    then use a combination of weapon conditions (on skill) and features on the weapon itself as well as damage formula coding for the fine tuning.
  9. Okay, I'll give that a shot. Thank you :V!

    I'll letcha know what happens. I probably won't succeed at it haha.

    Also while googling it I see a post you made in 2013 within the first search result. Handy!
  10. @Andar

    I appreciate the time you took, but I don't think this solves my issue. It's handy knowing what speed does and I didn't think about weapon conditions on skill. I think this helps me out more with multiple states overlapping or being able to select stance-exclusive attacks when not in that state. But, attack speed doesn't really interact with the game how I want it to for this particular issue. I think I may have to go with selecting stances and then attacking. Not attacking with an attack that has that stance and then having it apply before any actions are completed.

    What I want to have is a phase after all the player's actions are chosen, but before any of them are attempted. It might just be outside of my grasp for now.
  11. There already is such a phase, and you can access it with a battle event set to occur each turn.
    So what more do you need?
    Applying a state based on each battle member planned action is easy, you just need a script call to check the action, get the skill id and apply a state maybe using a notetag in the skill note box for ease of use.

    Actions are stored in an actor _actions array, you can get the skill id with the _itemId property of the action and then read the meta property of the corresponding $dataSkills item.
    Shouldn't be more than 5 lines of code really.
  12. I understand the first portion of your reply, but not the second part. I have the scripts call list and can try to implement what you've suggested. I'm assuming I use the turn span battle event, use a script to constantly check what skill they've used, and it applies the correct state?
  13. It's way too late for me to do this right now.
    I'll come back with the script call later.

    But yes: you use a turn event set to occur each turn then, using a script call, for each actor you access their chosen action, get the skill id, read the meta property of the skill data item and apply a corresponding state.
  14. I really appreciate your help! See, I'm still new and have been thinking about how to do this in a lot of different ways. So far, I've been pretty good at brute forcing everything else I've needed. But, something that needs scripts just defeats me. I'm afraid of it getting stuck in a loop, so it seems like some extra care will have to be taken to stop that. I've been trying to learn some js but my brain is all kinds of stupid when it comes to that sort of thing. And when I get stuck it gets really frustrating, watching script calls work for everyone else but not for me!
  15. You know I'd wager the vast majority of RPGMaker users actually don't use script calls at all.
    Script calls are just programming really so it makes sense, seeing the sales pitch of the engine.
    Back to the topic at hand: this does the trick:
    Code:
    $gameParty.battleMembers().forEach(function(member) { //for every party member
     if (member._actions[0]) { //if an action is selected
       let item = member._actions[0]._item;
           if (item._itemId !== 0 && item._dataClass === "skill") { //if action is a skill of id !== 0
               if($dataSkills[item._itemId].meta.prepStatus) { //if the meta property exists
                   member.addState(eval($dataSkills[item._itemId].meta.prepStatus)) //add the corresponding state
               }
           }
       }
    })

    When executed this snippet will add for all battle members the state defined in the <prepStatus: XXX> meta in the skill note box.
    It's evaled, meaning you can use javascript code and not just a fixed number, you could do for example:
    <prepStatus: 4> to add state 4
    <prepStatus: $gameVariables.value(1)> to add the state id contained in variable 1

    And much more with some js knowledge, but then you wouldn't have needed me to write the snippet in the first place most likely.
  16. Yes, I don't really know any js. I asked my brother for help but he knows java. And he told me that the two are like car and carpet. Totally different. I'll put some more effort into learning some js as it's the best way to achieve my goals.

    I'll plug in that script and experiment with it until it works! When it does, I'll deliver to you many hugs. Are you from france? I used to play a lot of Dofus growing up and I have a soft spot for Ankama.
  17. Oh it works, I tested it in a turns 0+1x event and it added the state correctly each and every turn before actions were taken.

    I'm french, yes and most definitely played a lot of dofus and wakfu.
    I loved the games for the silly humor, the boatload of references and what I think is probably the best TBS to date.
  18. Yeah, I grew up on Fire Emblem and it was really amazing to play this turn based mmo. I started in the international beta and some of my best gaming memories were in that game. Man, talk about some golden years. It's definitely influenced me on game design as well.

    I've been sick lately, so progress is kinda slow going and my brain isn't at optimal working condition. But, I'll give it a shot and see what I come up with and tell you! Cause I been so frustrated for weeks now. Just cause I don't know js haha.
  19. Okay, so I plugged in some numbers but I wasn't getting it to work. So, Imma try to learn some basics and figure out where I went wrong.