Check Current Skill Being Used (Help)

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
Is there a way to access the current skill that's being used?


I'm wondering if there is an eval or JS code to check, but I'm not too familiar with those. I have been trying
 


if (this.Skill().damage.elementId === physical)


Which was an attempt to check the current skill's element (whether it was physical, fire, etc). I saw somewhere a similar piece of code for checking the item being used, so thought that could work and from there I could figure out how to check the actual skill ID, but no luck.

Edit: Replacing 'physical' with the actual ID numbers of the elements didn't work either.

Edit 2: 
if (this.action.skillId() == 404)
gives me "Cannot read property of 'skillId' of undefined.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,364
Reaction score
7,673
First Language
German
Primarily Uses
RMMV
I've moved this thread to Learning Javascript. Please be sure to post your threads in the correct forum next time. Thank you.
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
826
First Language
English
Primarily Uses
This depends on where you are trying to check the skill.
 

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
This depends on where you are trying to check the skill.


I'm trying to check the skill during battle while the skill itself is being executed. 
Why: I'm using Yanfly's Action Sequence <action copy> tag to copy the action sequences from another skill/item. This is to make it easier on myself in editing skills and animations. It would be useful to me if the Action Sequence being called via <action copy> can differentiate which skill is calling it.

There's a game eval option, so I didn't think it was necessarily a Yanfly-specific question.
(And sorry @ Mod for posting in the wrong section)
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
826
First Language
English
Primarily Uses
I'm trying to check the skill during battle while the skill itself is being executed. 
Why: I'm using Yanfly's Action Sequence <action copy> tag to copy the action sequences from another skill/item. This is to make it easier on myself in editing skills and animations. It would be useful to me if the Action Sequence being called via <action copy> can differentiate which skill is calling it.

There's a game eval option, so I didn't think it was necessarily a Yanfly-specific question.
(And sorry @ Mod for posting in the wrong section)
You can use


this._action.item().id


in the action sequence eval to get the id of the skill/item being used.


example that prints to the console the id:

Code:
eval: console.log(this._action.item().id);
 

Yurii

Villager
Member
Joined
Apr 10, 2016
Messages
21
Reaction score
2
Primarily Uses
if (this.action.skillId() == 404)
gives me "Cannot read property of 'skillId' of undefined.
I think the problem is that 'this.' references something different from what you may have supposed.


Try referencing directly with 'BattleManager.' or probably 'BattleManager.actor().'


I'm not sure whether it will work, but you may give it a try.
 

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
I think the problem is that 'this.' references something different from what you may have supposed.


Try referencing directly with 'BattleManager.' or probably 'BattleManager.actor().'


I'm not sure whether it will work, but you may give it a try.

You can use



this._action.item().id


in the action sequence eval to get the id of the skill/item being used.


example that prints to the console the id:



eval: console.log(this._action.item().id);

Okay, so I was not successful. My set up:

Skill ID 411: <action copy: skill:414>


Skill ID 412: <action copy: skill:414>


Skill ID 414: Long action sequence, but the key part is:


eval: $gameVariables.setValue(86, X);
if ($gameVariables.value(86) == 411)
add state 178: user
else if ($gameVariables.value(86) == 412)
add state 176: user
end


I can replace X with 411 or 412 and it enters the if else branch correctly.


Replacing X with:
this._action.skill().id                                    ( undefined is not a function )
BattleManager._action.skill().id                   ( undefined is not a function )
BattleManager.actor()._action.skill().id        ( Error: Cannot read property '_action' of null )
BattleManager.action.skillId()                      ( Error: Cannot read property 'skillId' of undefined )
BattleManager.actor().action.skillId()           ( Error: Cannot read property 'action' of null )


Edit 3:

BattleManager.actor().this._action.skill().id   ( Cannot read property 'this' of null )
BattleManager.this._action.skill().id               ( Cannot read property '_action' of undefined )
 
Last edited by a moderator:

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
452
Reaction score
158
First Language
Not English
Primarily Uses
N/A
I don't know if you put script in formula or what?!


but try this if you want it in formula


a._lastBattleSkill._itemId
 

Yurii

Villager
Member
Joined
Apr 10, 2016
Messages
21
Reaction score
2
Primarily Uses
BattleManager.actor().this._action.skill().id   ( Cannot read property 'this' of null )
BattleManager.this._action.skill().id               ( Cannot read property '_action' of undefined )
You got me wrong. Please see what 'this' is: http://www.quirksmode.org/js/this.html


In short, 'this.' is similar to link which stands for current scope of the function/object.


You should have tried 'BattleManager.' or 'BattleManager.actor().' instead of 'this.'


I am also not sure whether '_action' will work for you, as I cannot find any definition that 'skill()' is its property. Why did you opt for this '_action'?
 
Last edited by a moderator:

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
@Yurii I also tried it without using 'this.' in the four examples above Edit 3.
I tried '_action' because that was from what DreamX suggested I try.

@mrcopra I'm working inside the note box as I'm working with Yanfly's Action Sequences.
Is it " a._lastBattleSkill._itemId " with both Skill and item? Or do I change " item " to " skill "?
And in the set up I described... do I put that in Skill ID 411/412 or Skill ID 414?

I also tried calling different common events with Skills 411 and 412 (via the Effects section) that set switch 86 to different values so that Skill 414 (when called via <action copy>) would enter the relevant branch, but the common event wasn't being called.

--------------------
EDIT: Well I found a work around using the lunatic coding of Yanfly's Skill Core.

(Example) Skill ID 411:
 


<Custom Execution>


$gameVariables.setValue(86, 2);


</Custom Execution>


<action copy: skill:414>

So I just have to change the custom execution accordingly for each skill that would call 414 and it should work.
I wouldn't mind still learning how to do what I was doing before though.
 
Last edited by a moderator:

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,859
Messages
1,017,030
Members
137,566
Latest member
Fl0shVS
Top