RMMV [SOLVED]Javascript code to get current target agility?

Kaymon145

Veteran
Veteran
Joined
Apr 22, 2022
Messages
34
Reaction score
17
First Language
English
Primarily Uses
RMMV
Hello everyone, I think this is the proper place to ask this but if not I'm sorry!
I'm setting up a skill using yanfly action sequences and one of the parameters accepts javascript formulas instead of full numbers. I'm trying to get the currently targeted enemies agility to use in this formula but I'm not entirely sure if its possible, all of this is coded in the notebox so putting in values like (a.agi * 4 - b.agi * 2) returns an error. I'm currently getting the actors agility with $gameActors.actor(2).agi, which only works because I only have 1 actor that can do the skill.
Again, not entirely sure if this is possible with how rpgmaker handles active targets, but just thought I'd ask anyway.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,277
Reaction score
9,701
First Language
German
Primarily Uses
RMMV
b.agi would work inside the damage formula itself.

the problem with an override similar to gameActor is that this does not exist for the other side.
the data you want depends on the troop of the battle and the enemy inside this troop, and troops do not exist on the map (the actors exist through the entire game).

can you give the entire notetag that you try to create?
with the correct context someone might be able to find an alternative to redirect the data.
 

Kaymon145

Veteran
Veteran
Joined
Apr 22, 2022
Messages
34
Reaction score
17
First Language
English
Primarily Uses
RMMV
b.agi would work inside the damage formula itself.

the problem with an override similar to gameActor is that this does not exist for the other side.
the data you want depends on the troop of the battle and the enemy inside this troop, and troops do not exist on the map (the actors exist through the entire game).

can you give the entire notetag that you try to create?
with the correct context someone might be able to find an alternative to redirect the data.
Hey thanks for the reply, yeah I had a feeling I was going to need to find a workaround or think of another way to do things. I'm using Srd Timed Attack Core and it has a parameter when called to set the speed. The notetag I'm using is in the skills window. I was trying to do something like :
Code:
<Timed Attack: default>
 Speed: target.agi - $gameActors.actor(2).agi
<End Timed Attack>
Which dosen't work as target.agi isn't a valid function, I was just guessing and trying a number of different things there.
Code:
<Timed Attack: default>
 Speed: $gameActors.actor(2).agi
<End Timed Attack>
works on it's own but I really wanted to factor in the enemies agility too if at all possible.
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,175
Reaction score
728
First Language
Javascript
Primarily Uses
RMMZ
Hello everyone, I think this is the proper place to ask this but if not I'm sorry!
I'm setting up a skill using yanfly action sequences and one of the parameters accepts javascript formulas instead of full numbers. I'm trying to get the currently targeted enemies agility to use in this formula but I'm not entirely sure if its possible, all of this is coded in the notebox so putting in values like (a.agi * 4 - b.agi * 2) returns an error. I'm currently getting the actors agility with $gameActors.actor(2).agi, which only works because I only have 1 actor that can do the skill.
Again, not entirely sure if this is possible with how rpgmaker handles active targets, but just thought I'd ask anyway.
Something like this seems to work.. but I'm no pro at action sequences
...I had to first set a variable.. there might be better ways idk

This is just a small example though showing a change to the targets hp
Code:
<target action>
eval: $gameVariables.setValue(1, (user.agi * 4 - target.agi * 2))
hp -variable 1: target, show
</target action>

..still I'm not really sure what you're trying to do but maybe that info could help idk
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,526
Reaction score
2,890
First Language
English
Primarily Uses
RMMV
You should be able to access the current actor with
Code:
BattleManager._subject

and the current target with
Code:
$gameTroop.aliveMembers()[BattleManager._action._targetIndex]

Something like this seems to work.. but I'm no pro
I found the first post confusing, also...despite the mention of Action Sequences, I don't think the question actually has to do with them. It looks like it has to do with the notetag for SRD's Timed Attack Core. That would fire off before the Action Sequence gets started, I think, and it doesn't include the user or target variables in the function for the button press timer.
 

Kaymon145

Veteran
Veteran
Joined
Apr 22, 2022
Messages
34
Reaction score
17
First Language
English
Primarily Uses
RMMV
You should be able to access the current actor with
Code:
BattleManager._subject

and the current target with
Code:
$gameTroop.aliveMembers()[BattleManager._action._targetIndex]


I found the first post confusing, also...despite the mention of Action Sequences, I don't think the question actually has to do with them. It looks like it has to do with the notetag for SRD's Timed Attack Core. That would fire off before the Action Sequence gets started, I think, and it doesn't include the user or target variables in the function for the button press timer.
Ahh thank you that's exactly what I was looking for.. I do have an action sequence running after the first part but you're right, that wasn't necessarily relevant information lol. Regardless, it works the way I want it to now and that is very useful information to know. Thank you!
 

Latest Threads

Latest Profile Posts

The main game of my trilo/saga 50%OFF on Steam..... its now or never more
I swap between Ace and MZ so I can stay fresh but - what do you mean you can use subfolders in the plugin's folder for easier organization!?
Did some new music again, praise be. To the next song!
Watch Studio Blue play Numina by starlit in our latest RPG Maker Games Critique stream starting NOW!

Forum statistics

Threads
123,140
Messages
1,154,268
Members
161,475
Latest member
guihguih27
Top