Thanks for the answers. I have another problem, basically in apply_critical you only have the damage * 3. What I want to do is that:
when the ones who is applying the critical hit is an actor, he gains 10 tp, when he is being attacked with a critical hit, he loses 10 tp. How can I determine who is targeting and who he / she is targeting?
Edit: Sorry, slightly misunderstood the question. To get the battler having the critical hit applied, you can do "self"; not 100% sure about finding out who the user was in that method.
You'll also have to either make @tp an attr_accessor or create a new method in Game_BattlerBase for setting its value, as there are currently only a handful of ways to gain TP and they all rely on database-defined values.
@Milena if you go back up a few methods in Game_Battler, you can do what you want inside def make_damage_value(user, item) or make a method call inside there, since you need that user variable. user will be the one attacking, and use self to determine who is being hit.
And how would you want, as the developer, to manipulate these conditions via the script?
Is there a way to make a 4 enemy damage, however, deals much more damage on one of the enemies more than the others? For example, I have 4 slimes as an enemy. With that certain skill, I damaged 4 of the slimes, however, Slime 3 had more damage than the other slimes being Slime 1, Slime 2 and Slime 4. Or if it is not a 4 enemy scope, perhaps 1 enemy scope.
I made a skill like this for kentona where you target a specific enemy; it takes full damage and all others take 40%. The formula for it could easily be modified for what you need.
def manual_make_damage_value(value, subject, item)value *= item_element_rate(subject, item)value *= mdrvalue = apply_critical(value) if @result.criticalvalue = apply_variance(value, item.damage.variance)value = apply_guard(value)@result.make_damage(value.to_i, item)enddef custom_formula_fireblast(a, log_window = SceneManager.scene.log_window targets = a.current_action.opponents_unit.alive_members targets.delete( targets.unshift( item = a.current_action.item targets.each_with_index { |target, index| standard_formula = 200 + a.mat * 2 - target.mdf * 2 target.result.clear target.result.used = item_test(a, item) target.result.missed = (target.result.used && rand >= item_hit(a, item)) target.result.evaded = (!target.result.missed && rand < item_eva(a, item)) if target.result.hit? unless item.damage.none? target.result.critical = (rand < item_cri(a, item)) if index == 0 value = standard_formula else value = standard_formula * 0.3 end target.manual_make_damage_value(value, a, item) target.execute_damage(a) log_window.clear log_window.add_text("The fire spreads!") log_window.display_action_results(target, item) end end } b.result.clear return 0 endNote: You need the manual_make_damage_value because calling make_damage_value from a custom formula causes a recursive loop where it checks the formula to see how much damage it does, but the formula is calling the method which checks how much damage it does, which checks the formula...
So how can I exactly use the script? Will I overwrite make_damage_value to manual_make_damage_value from the Game_Battler?
If I read it right, you need to enter the 'manual_make_damage_value(value, subject, item)' method into Game_Battler and the 'custom_formula_fireblast(a, b)' method into Game_Interpreter, and call 'custom_formula_fireblast(a, b)' in the damage formula itself.
Edit the 'standard_formula' in the 2nd method to set a custom damage formula for the skill.
I might be wrong thou, did not test it.
Sugar, sorry, I forgot to include the class Game_Battler and end lines!
Put both methods in Game_Battler and for the skill formula put a.custom_formula_fireblast(a,b )
Thanks. It does work fine 🙂
Another question, how do you put a maximum value and restrict a new variable for the actor? I have this for example:
class Game_Actor < Game_Battler alias milena_game_actor_popful_mail_setup setup attr_accessor 😛opful_mail def setup(actor_id) milena_game_actor_popful_mail_setup(actor_id) @popful_mail = 0 endendNormally you can add as many popful mail as you want on the actors. Is there a way so that when popful mail for one actor reaches a certain value, say 100, will not add more? Because if you do:
$game_actor[actor_id].popful_mail += 10Once you reach 100 it just keeps adding more.
Awesome, it works. I have a question though, I thought attr_readers are attributes that can only read, and not therefore write and access? So you can add values or decrease values to it like attribute accessor does?
Another question is about characters. I would like to know how do you do it in scripts when I press a button, say :L (Left, Q on the Keyboard), my leader's sprite changes (index chosen), then when not pressing, returns to the original sprite and direction it has been.
$game_party.members.each do |actor|
if actor.state?(id of level 3 state)
actor.remove_state(id of level 3 state)
actor.add_state(id of level 2 state)
elsif actor.state?(id of level 2 state)
actor.remove_state(id of level 2 state)
actor.add_state(id of level 1 state)
else
actor.remove_state(id of level 1 state)
end
end
Or if you really do want it to affect every character in the game:
1.upto($data_actors.size - 1) do |index|
actor = $game_actors[index]
if actor
if actor.state?(28)
actor.remove_state(28)
actor.add_state(27)
elsif actor.state?(27)
actor.remove_state(27)
actor.add_state(26)
else
actor.remove_state(26)
end
end
end
How would I go about editing the tone of window borders? I'd like to do this for scripts that create their own windows.
Just to explain myself better, when a script calls window_base, I use this to change the window tone:
def update_tone
tone = Tone.new( 204, 187, 0, 128)
self.tone.set(tone)
end
Basically I'm asking for something like this that would change the tone of the border rather than the window itself.
I'm just assuming I'd need to set up the thing in window_base first.
Thanks trihan! That's a big help!
If I wanted to rotate a bitmap.draw_text how would I go about doing this (assuming this can be done)?
You can create a Sprite containing the bitmap and rotate that by setting its @angle attribute.