Shiro-chan

Friendly Neighbourhood Neppy Maid
Veteran
Joined
Aug 7, 2018
Messages
197
Reaction score
61
First Language
German
Primarily Uses
RMVXA
Hello,
I'm trying to add/remove skills dynamically from enemies for use in battle (if it can only be done before a battle, that would still be sufficient). Yes, I know I could use the native conditions such as status effects, but that won't help in this case, and I know it's possible to change the names of enemies etc. So yeh, how would I go about this with a scriptcall?
 

Mattsuharu

Veteran
Veteran
Joined
Apr 15, 2022
Messages
81
Reaction score
31
First Language
English
Primarily Uses
RMVXA
Hellu, would someone know what would be a script call to check (return) the ID of what was the type of the last skill used?
I'm aware is something related to "stype", but I'm not sure how to write the call exactly.
And also to know if ANYONE casted it, allies or enemies.

Would be something like:

return true if current.battler_last.skill.(stype) = 6

or something similar to that?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,253
Reaction score
1,157
First Language
English
Primarily Uses
RMVXA
a script call to check (return) the ID of what was the type of the last skill used?
I don't believe you can use a script call check as something like that doesn't exist AFAIK.
You can try using a little script to place the id into a variable.
Ruby:
module R2_Last_Skill_Check
  Variable = 7
end

class Scene_Skill < Scene_ItemBase
  alias r2_on_item_var_ok on_item_ok
  def on_item_ok
    $game_variables[R2_Last_Skill_Check::Variable] = item.id
    r2_on_item_var_ok
  end
end

class Scene_Battle < Scene_Base
  alias r2_on_skill_var_ok  on_skill_ok
  def on_skill_ok
    $game_variables[R2_Last_Skill_Check::Variable] = @skill_window.item.id
    r2_on_skill_var_ok
  end
end
 

Mattsuharu

Veteran
Veteran
Joined
Apr 15, 2022
Messages
81
Reaction score
31
First Language
English
Primarily Uses
RMVXA
I don't believe you can use a script call check as something like that doesn't exist AFAIK.
You can try using a little script to place the id into a variable.
Ruby:
module R2_Last_Skill_Check
  Variable = 7
end

class Scene_Skill < Scene_ItemBase
  alias r2_on_item_var_ok on_item_ok
  def on_item_ok
    $game_variables[R2_Last_Skill_Check::Variable] = item.id
    r2_on_item_var_ok
  end
end

class Scene_Battle < Scene_Base
  alias r2_on_skill_var_ok  on_skill_ok
  def on_skill_ok
    $game_variables[R2_Last_Skill_Check::Variable] = @skill_window.item.id
    r2_on_skill_var_ok
  end
end
Thanks! But I'm not entirely sure if this would work (or at least, how should I use it to implement it).
Basically, what I want to achiev with yanfly lunatic state is a state that check everytime an action is made (with the "while effect"), if that action is an skill with the skill type (id) that actor will gain let's say 500 HP.
Would this script have some way to check for that? The While effect would call every time any action is made, even if it's an enemy or an ally. But I need to tell the effect itself to do it only when the skill is that type.

I suppose something like:

Code:
If $game_troop.members.last_action = $game_variables[7]
FORMULA
end
???
But I don't think this script call would check if the value I'm giving is for the Skill type but the skill id?
Maybe there's an easier way to achiev what I want and I'm trying the hard way?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,253
Reaction score
1,157
First Language
English
Primarily Uses
RMVXA
with yanfly lunatic state
That makes it much more complicated.
I also realized that the code I gave would save the skill id the last time a skill was selected, not the skill of a particular actor.

What your asking is complicated since you need to check the skill type/id of every action?
Looking at the code I see
Ruby:
  def execute_action
    scene_battle_execute_action_lsta
    @subject.run_lunatic_states(:while)
  end
which goes to
Ruby:
  def run_lunatic_states(type)
    for state in states; lunatic_state_effect(type, state, self); end
  end
so self should be the actor using the skill. But it doesn't allow for passing on the skill data.
But maybe you can pull in action data
Testing would have to be done. I may get to it but I'm generally busy these days.
Game_Actions has a item method which could be checked for teh item and if it is a skill then get the type. This (from what I understand) is accessible through Game_Battler.actions
 

Mattsuharu

Veteran
Veteran
Joined
Apr 15, 2022
Messages
81
Reaction score
31
First Language
English
Primarily Uses
RMVXA
This (from what I understand) is accessible through Game_Battler.actions
Yeah, I was checking the game_battler.action a lot to see if something related to the type of skill could be called to check. But as I'm not too skilled with coding I might be missing something.

I may get to it but I'm generally busy these days.

My brother in christ, you already did a lot for me! Don't lose your time with this and get some rest while you can. I might find some solution myself. Thanks for your predisposition so far!

EDIT:

OMG I found it thanks to this post!
Seems like the call method is "current_action.item.stype_id"

EDIT 2:

Okay, it does seem to be the script call somehow, but I still hadn't figured how to make it to check when any actor/enemy is the one casting. It only does it when I (the owner of the state) is taking an action. But at least I know I now can check out the id of a skill type.
 
Last edited:

Latest Threads

Forum statistics

Threads
124,349
Messages
1,162,943
Members
163,147
Latest member
onbetme
Top