Ruby/RGSSx questions that don't deserve their own thread

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.
Pacattack, if I'm reading your question correctly you want some states which replace themselves with less severe versions, yes? At what point will they be doing this?
Well I'm planning on: Some states that aren't completely removed on an rest (they get weaker - but one inn stay isn't enough to knock out say a cold - may make you feel better but wont stop the cold compltely) and a way to reduce states with spells (or increase them on enemies) because just making someone have a little sniffle isn't going to be as effective as a full blown flu - but going from nothing to overpowered state (even when balancing out states to do MORE damage over time than just attacking and most other spells)  seems like it would take two castings... I feel so close...

Sorry for disease refferences... best thing I can think of off top of head

See also POISONS (one nights stay is not saving your rear from the bite of [insert incredibly poisonous thing] poisoning you... a nights rest might help you fight off the poison but one night isn't stopping a poison worth it's salt
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.
Base64 is used in many usages but I don't need to hide what it's saying and I not sure what I want to use it all for right now, I want to be able to control most of my game by my launcher from letting the user select settings and it will build the file on the fly.

Online Databasing of the game items and settings but at the moment I having a problem conviting the scripts back to rb only able to do it with the scripts.rvdata2

I am playing with loads of ideas at the moment really.
Not sure what use Base64 would have for online databasing.

I have managed to make all databases read from online sources without the use of Base64 (or Zlib) - it just not necessary.
@Milena:

You can do that by manually defining an attribute writer method:

Code:
class Game_Actor   def popful_mail=(value)    @popful_mail = [value, 100].min  endend
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. 
@Trihan something like below I have the VAST majority of the sudo code when it's affecting everyone... I just don't know the exacts when affecting everyone and that's part of why I can't figure it out for a single person

Page 112 (sorry I don't usually look here often as I don't often get responce quickly)

1. $game_variables[X]=numberActorsInGame

2. for

3.    if $game_variables[X]=0

4.        break loop

5.    end ##end if on line 3

6.     if $game_actor[X-1] inflicted (statusIdStart)

7.          $game_actor[X-1] remove (statusIDStart)

8.          $game_actor[X-1] add (statusIDEnd - probably put in another var)

9.     end ##end if on line 6

10.     X-=1

11 .end ##end for on line 2
$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.

Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/