Is there a way to check which actor used a certain skill? (Solved)

Discussion in 'RPG Maker VX Ace' started by Tevi, Mar 24, 2019.

Thread Status:
Not open for further replies.
    Tags:
  1. Tevi

    Tevi Fierce Demon Woof Member

    Messages:
    21
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    Just as the title says.
    Bit of background info: So, I'm trying to make a system where when Actors attack or use skills too much, they will get tired. I'm mainly having problems with the shared skills as I don't know the answer to this threads question. That's.. quite an obvious statement but meh.
    I'd appreciate some help as soon as,
    Thank- Tev.
     
    #1
  2. Milennin

    Milennin "With a bang and a boom!" Veteran

    Messages:
    2,197
    Likes Received:
    1,255
    Location:
    Fiore
    First Language:
    English
    Primarily Uses:
    RMMV
    I think an easy, but somewhat tedious way of doing it (depending on number of shared skills and number of playable characters) is by making copies of the shared skills, one version for each character that are identical, but keep track of usage for the specific characters they're assigned to.
     
    #2
  3. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,235
    Likes Received:
    492
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    I am going to give you two possible solutions:

    Option 1
    If those skills also deal damage the easiest way is to use damage formula to store used id in a variable.

    Step 1: prepare your variable
    Use a troop event that runs at turn 0 and turn a variable into an array with a number of elements equal to the number of actors in your game. You can do it using the following script call:
    Code:
    $game_variables[your_var_id] = Array.new($data_actors.length)
    Step 2: check your actor using skill formula
    In your skill formula you can check if the user is an actor and increase the counter of tiring skill used by that actor this way. Just be sure to put it before your damage formula.
    Code:
    $data_actors.each.with_index { |e, i| $game_variables[your_var_id][i] += 1 if e==a };

    Option 2
    Another possible implementation for this would be to add a troop event at the end of each turn that checks your actors to see if they have a certain state (the state does nothing, it just tells you that that actor used a tiring skill) and then increases a variable accordingly. In this case you can use a single variable for each actor, it will not change much. Of course both options have their good points and bad points.


    Comparing those two options
    Option 1 is good because it can handle things easily directly inside your damage formula. Its downside is that if your attack hits multiple enemies/times the damage formula is called more than once and that variable increases faster. This is not a bad thing if the stronger the skill the stronger the toll but if that is not what you want to achieve this option is not suited for you. Another bad point is that this option does not work if your skill does not use any damage formula at all.

    Option 2 is good because it increases each variable only once per turn so even if you use a skill with multiple targets fatigue only increases by 1. On the bright side you also have the fact that this works on buffing skills as well - as long as they target the user or the character who is supposed to get tired from the skill - even if they do not use damage formula. You could also add that state using enemies skills so that characters get tired when receiving certain attacks. The bad point is that if an actor acts twice in a single turn and uses two tiring skills it still counts as a single one and, of course, if the skill has no damage formula and the previous conditions for skills with no damage formula are not met, it is still unable to affect the user.

    If none of these options suits you then you might want to use a script instead.
     
    #3
  4. Tevi

    Tevi Fierce Demon Woof Member

    Messages:
    21
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    What kinds of scripts would be available? I don't know how to make an attack that targets enemies give the actor using it a state, and my main actor uses Dual Attack as its Attack command so Option 1 is unavailable to me as well. I do appreciate you coming up with solutions though, even if they wouldn't work for me.
    Edit: a mod merged the post below so changing the edit

    Oh and, for the first one, that's my last resort
     
    Last edited: Mar 24, 2019
    #4
  5. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,235
    Likes Received:
    492
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    If the skill that targets an enemy deals damage you can still apply a state to the actor casting it. Just add this to your formula before your real damage formula:
    Code:
    a.add_state(state_id);
    Of course state_id has to be the real ID of your fatigued state.

    Unfortunately there is no script I know that does something like that. However since I mostly write my own scripts I am not very knowledgeable in that field. You might ask in the Script Request board, people reading that board might know of a script that does that if my solution still does not fit your needs.
     
    #5
  6. Tevi

    Tevi Fierce Demon Woof Member

    Messages:
    21
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    Thanks, that should help. If I can't get that to work I'll look on the Script Request board.
    Then if that doesn't work, it's time to duplicate a few of my skills 13 times-
    EDIT: Doesn't work, probably because I don't know how to add that to the damage formula -.-
     
    Last edited: Mar 24, 2019
    #6
  7. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,235
    Likes Received:
    492
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    Assuming your formula is
    Code:
    a.atk*4 - b.def*2
    just turn it into this:
    Code:
    a.add_state(id_goes_here); a.atk*4 - b.def*2
     
    #7
  8. Tevi

    Tevi Fierce Demon Woof Member

    Messages:
    21
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    Thanks! The state is working now. Also, you can bypass adding an event in the troops by just using a common event in the skill. Just thought I'd let you know considering putting that event in every troop would be tedious.
    Thanks again, I'm glad you could help me resolve my issue.
     
    #8
  9. slimmmeiske2

    slimmmeiske2 Little Red Riding Hood Moderator

    Messages:
    5,531
    Likes Received:
    4,121
    Location:
    Belgium
    First Language:
    Dutch
    Primarily Uses:
    RMXP

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #9
Thread Status:
Not open for further replies.

Share This Page