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

Status
Not open for further replies.

Tevi

Fierce Demon Woof
Veteran
Joined
Mar 10, 2019
Messages
33
Reaction score
5
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.
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,249
Reaction score
1,345
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.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,344
Reaction score
565
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.
 

Tevi

Fierce Demon Woof
Veteran
Joined
Mar 10, 2019
Messages
33
Reaction score
5
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:

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,344
Reaction score
565
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.
 

Tevi

Fierce Demon Woof
Veteran
Joined
Mar 10, 2019
Messages
33
Reaction score
5
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:

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,344
Reaction score
565
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
 

Tevi

Fierce Demon Woof
Veteran
Joined
Mar 10, 2019
Messages
33
Reaction score
5
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.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,040
Reaction score
4,255
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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Julian Brooks wrote on Hudell's profile.
Hi, I'm trying to use the Orange Mapshot plugin on Mac, but it isn't working. Could you assist? I'm attempting to do Parallax Mapping. Thanks.
I can't believe my dlc flopped that hard. It's depressing. I'm a fricking failure at being a musician.
Person: "Taxes are bs and money is, too! Anarchy!!" *Literally anything goes wrong* Same Person: "Why hasn't the government fixed this???"
Stream will be live shortly with a session of Haunting Ground! Feel free to drop by!

Forum statistics

Threads
94,354
Messages
920,173
Members
124,111
Latest member
Azarae
Top