Power/Mind Charge and Tetra/Makara Karn Help

Nunzio Zizzania

Veteran
Veteran
Joined
Jan 9, 2014
Messages
73
Reaction score
3
First Language
Italy/English
Primarily Uses
Hy there...
I know I asked this tread long time ago
but I confused about it.
So can you teach me how to do it or there are any scripts for it, thank you.

P.S: the part that I got confused are suggested by this guy:

Milennin:
-Put state on Actor, then link all physical/magical attacks to a Common Event that remove that state.
-Link enemy attacks to a Common Event that removes the reflect state.

These two lines got me confuesed. Can you help me with specific how to do it?
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
Those two lines refer to adding something to your attacks formula that removes the state when attacking. Which state has to be remove depends on the user as far as I can tell. If you could elaborate a bit more what you are trying to do or if you can provide a link to your previous thread, we can help you more.

However, what you should add in your formula to achieve that is something like this:
Code:
a.actor? ? do_something_to_remove_that_state : do_something_to_remove_reflect_state
I cannot help you more than this for many different reasons:
  1. I don't know exactly what you are trying to achieve;
  2. even knowing that is not enough to know how you set your states in the database so any user in this forum can only help you to a certain extent.
However, I hope my previous statement helped you clearing your doubts on those two sentences. If you need more help, please provide more information (or a link).
 

Nunzio Zizzania

Veteran
Veteran
Joined
Jan 9, 2014
Messages
73
Reaction score
3
First Language
Italy/English
Primarily Uses
Have you played Shin Megami Tensei?

There's a skill that power up the next attack/spell the next turn.

Also for the Karn (The reflective spells), can reflect 1 magical/physical attack and it goes out after been hit.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
Have you played Shin Megami Tensei?
I did not, and that is why I asked that question. As a general rule of thumb, never ask for skills that exist in a certain game. Doing so means that the reader must have played the said game to understand your question, greatly limiting the amount of potential helpers.

That said, here is how I would do that.

How to empower the next attack/spell
If the skills empowers the next attack/spell, you can just apply a state that only lasts for 1 turn (in my example I am going to use state 61). Once you have done that, you have to change each skill available to actors that can be affected by that state and add this to their formula box:
Code:
r = formula_goes_here; a.state?(61) ? (a.remove_state(61); r * 2) : r
Just change "formula_goes_here" with any formula you want for that particular skill.
Applying what I said to the Attack skill would look like this:
Code:
r = a.atk * 4 - b.def * 2; a.state?(61) ? (a.remove_state(61); r * 2) : r

- - - - - - - - - - - - -​

How to reflect spells
To reflect spells you have to force an action against the user. To do that you have to store both the user and the original target. This is requires another check in the formula, and you have to do this for every existing skill that can be reflected. First of all pick a variable (in my example I am going to use variable 32) and store the required information in it, then modify your skill formula. In the following example, the ID of my reflect state is going to be 54.
Code:
v[32] << [a, b, skill_id_goes_here]; r = skill_formula_goes_here; b.state?(54) ? (b.remove_state(54); 0) : r
This goes under the assumption that you initialize your variable as an array at the beginning of the battle using the following script call in a troop event:
Code:
$game_variables[32] = []
After you do that, you can call a common event from your skill that forces actions on the the caster until the array is empty. The script call to do that is the following:
Code:
while ($game_variables[32].length > 0)
  action = $game_variables[32].pop
  next if (action[0].dead? || action[1].dead?)
  target_array = (action[0].actor? ? $game_party.members : $game_troop.members)
  target_index = 0
  target_array.each_index do |i|
    if (target_array[i] == action[0])
      target_index = i
      break
    end
  end
  action[1].force_action(action[2], target_index)
end

Personal tip
While the code you should write in common events and troop events can take a lot of space, the one you can write in the formula box is quite limited. If you have a skill that needs both those changes, the formula is going to take a lot of space. For that reason, I recommend placing those things in a small script (or a variable, just anything that can take a bigger number of characters) and evaluate that text instead. This will break the limits of formula boxes.
 

Nunzio Zizzania

Veteran
Veteran
Joined
Jan 9, 2014
Messages
73
Reaction score
3
First Language
Italy/English
Primarily Uses
How to reflect spells
To reflect spells you have to force an action against the user. To do that you have to store both the user and the original target. This is requires another check in the formula, and you have to do this for every existing skill that can be reflected. First of all pick a variable (in my example I am going to use variable 32) and store the required information in it, then modify your skill formula. In the following example, the ID of my reflect state is going to be 54.
Code:
v[32] << [a, b, skill_id_goes_here]; r = skill_formula_goes_here; b.state?(54) ? (b.remove_state(54); 0) : r
This goes under the assumption that you initialize your variable as an array at the beginning of the battle using the following script call in a troop event:
Code:
$game_variables[32] = []
After you do that, you can call a common event from your skill that forces actions on the the caster until the array is empty. The script call to do that is the following:
Code:
while ($game_variables[32].length > 0)
  action = $game_variables[32].pop
  next if (action[0].dead? || action[1].dead?)
  target_array = (action[0].actor? ? $game_party.members : $game_troop.members)
  target_index = 0
  target_array.each_index do |i|
    if (target_array[i] == action[0])
      target_index = i
      break
    end
  end
  action[1].force_action(action[2], target_index)
end

Personal tip
While the code you should write in common events and troop events can take a lot of space, the one you can write in the formula box is quite limited. If you have a skill that needs both those changes, the formula is going to take a lot of space. For that reason, I recommend placing those things in a small script (or a variable, just anything that can take a bigger number of characters) and evaluate that text instead. This will break the limits of formula boxes.

Is it possible to do it even with the script "Element Reflect" from Yanfly Ace
and Action Reflect from Victor Engine?
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
I am not 100% sure because I do not know how they work internally, but, at a first glance, Yanfly's script does not work the way you want it to work - not for that purpose at least. I cannot say if you need it for anything else since that would be a whole different topic and it is not something being discussed here.

I did not check Victor's script as he does not provide a direct link to the code, but a google drive download link instead, so I cannot answer your question about that. Anyway, a small script that removes magic the state when magic is reflected might actually do the trick in your case. A small script made of 5 lines in total (literally) should be enough for that if my memory is not wrong.

To be honest, handling that reflection using a script looks like a much better deal to me. I cannot check everything right now, but as soon as I can access the engine I can help you with that.
 

Nunzio Zizzania

Veteran
Veteran
Joined
Jan 9, 2014
Messages
73
Reaction score
3
First Language
Italy/English
Primarily Uses
How to reflect spells
To reflect spells you have to force an action against the user. To do that you have to store both the user and the original target. This is requires another check in the formula, and you have to do this for every existing skill that can be reflected. First of all pick a variable (in my example I am going to use variable 32) and store the required information in it, then modify your skill formula. In the following example, the ID of my reflect state is going to be 54.
Code:
v[32] << [a, b, skill_id_goes_here]; r = skill_formula_goes_here; b.state?(54) ? (b.remove_state(54); 0) : r
This goes under the assumption that you initialize your variable as an array at the beginning of the battle using the following script call in a troop event:
Code:
$game_variables[32] = []
After you do that, you can call a common event from your skill that forces actions on the the caster until the array is empty. The script call to do that is the following:
Code:
while ($game_variables[32].length > 0)
  action = $game_variables[32].pop
  next if (action[0].dead? || action[1].dead?)
  target_array = (action[0].actor? ? $game_party.members : $game_troop.members)
  target_index = 0
  target_array.each_index do |i|
    if (target_array[i] == action[0])
      target_index = i
      break
    end
  end
  action[1].force_action(action[2], target_index)
end


Personal tip
While the code you should write in common events and troop events can take a lot of space, the one you can write in the formula box is quite limited. If you have a skill that needs both those changes, the formula is going to take a lot of space. For that reason, I recommend placing those things in a small script (or a variable, just anything that can take a bigger number of characters) and evaluate that text instead. This will break the limits of formula boxes.

Is it possible to do it even with the script "Element Reflect" from Yanfly Ace
and Action Reflect from Victor Engine?
I am not 100% sure because I do not know how they work internally, but, at a first glance, Yanfly's script does not work the way you want it to work - not for that purpose at least. I cannot say if you need it for anything else since that would be a whole different topic and it is not something being discussed here.

I did not check Victor's script as he does not provide a direct link to the code, but a google drive download link instead, so I cannot answer your question about that. Anyway, a small script that removes magic the state when magic is reflected might actually do the trick in your case. A small script made of 5 lines in total (literally) should be enough for that if my memory is not wrong.

To be honest, handling that reflection using a script looks like a much better deal to me. I cannot check everything right now, but as soon as I can access the engine I can help you with that.

These lines...
while ($game_variables[32].length > 0)
action = $game_variables[32].pop
next if (action[0].dead? || action[1].dead?)
target_array = (action[0].actor? ? $game_party.members : $game_troop.members)
target_index = 0
target_array.each_index do |i|
if (target_array == action[0])
target_index = i
break
end
end
action[1].force_action(action[2], target_index)
end

Is it a script?
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
As it has been said, it is a script call, and since it is much more complex than I would like it to be, I recommended using a script instead - as it would make things much shorter.
Code:
#===============================================================================================
# HEIRUKICHI MAGIC REFLECTION AUTO-REMOVAL
#===============================================================================================
# Version 1.0.0
# - Author: Heirukichi
# - Last update 07-08-2019 [MM-DD-YYYY]
#===============================================================================================
# TERMS OF USE
#-----------------------------------------------------------------------------------------------
# This script is under the GNU General Public License v3.0. This means that:
# - You are free to use this script in both commercial and non-commercial games as long as you
# give proper credits to me (Heirukichi) and provide a link to my website;
# - You are free to modify this script as long as you do not pretend you wrote this and you
# distribute it under the same license as the original.
#
# You can review the full license here: https://www.gnu.org/licenses/gpl-3.0.html
#
# In addition I'd like to keep track of games where my scripts are used so, even if this is not
# mandatory, I'd like you to inform me and send me a link when a game including my script is
# published. As I said, this is not mandatory but it really helps me and it is much appreciated.
#
# IMPORTANT NOTICE:
# If you want to distribute this code, feel free to do it, but provide a link to this website
# instead of pasting my script somewhere else.
#===============================================================================================
module HRK_MRAR
  #----------------------------------------------------------------------------
  # Change this to contain your magic reflection states that require to be
  # removed automatically. Default is [30].
  # You can add more states by separating them with commas.
  #
  # Example:
  # AUTO_REMOVAL_MAGIC_REFLECTION = [30, 15]
  # - This example shows how to put two states (using state 15 and 30).
  #----------------------------------------------------------------------------
  AUTO_REMOVAL_MAGIC_REFLECTION = [30]
end

class Scene_Battle < Scene_Base
  #----------------------------------------------------------------------------
  # * Aliased method: invoke_magic_reflection
  #----------------------------------------------------------------------------
  alias hrk_mrar_invoke_magic_ref_old invoke_magic_reflection
  def invoke_magic_reflection(target, item)
    hrk_mrar_invoke_magic_ref_old(target, item)
    HRK_MRAR::AUTO_REMOVAL_MAGIC_REFLECTION.each do |id|
      target.remove_state(id) if target.state?(id)
    end
  end
end
The code above should automatically remove any magic reflection state as long as its ID is listed inside AUTO_REMOVAL_MAGIC_REFLECTION. I wrote this from mobile so let me know if something does not work.

To use the script you should just copy/paste it in your project below Materials and above main. It should not cause compatibility issues as long as you place it below every other script you have that overwrites invoke_magic_reflection.

Using this means that there is no need to remove your reflection state manually, just list it among those that need to be removed automatically.
 

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

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,470
Members
137,821
Latest member
Capterson
Top