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,236
Reaction score
9,681
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,173
Reaction score
723
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,500
Reaction score
2,855
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

ScreenShot_6_24_2022_9_20_7.png
Here's Mike when you get a preemptive strike in battle. There's another one for when an enemy sneaks up on you too.
Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.
Finally I bought OMORI...cant wait to get traumatised!!!
Finished making this pretty ambitious forest map. Was wondering what y'all think of it! :kaopride:
1656136876015.png
All this anger everywhere,Who's happy but me?
Seems to be all the people that don't follow Jesus wholeheartedly. My smile might burn you ahhhhhhhhhhh!

Forum statistics

Threads
123,021
Messages
1,153,445
Members
161,363
Latest member
jereDev
Top