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

*shrugs* You just need put something on scene update then. Something like ...
Code:
class Scene_Map
  alias vn_update update
  def update
    vn_update
    toggle_image if Input.trigger?(:A)
  end
end
In this "toggle_image" you hid window_message and show image.
@TheoAllen But that's what I'm looking for, how to hide the window_message and re-display it afterwards.

Edit: I might have found an interesting side-effect, I'll keep looking but I'm close.
I'm sure it's obvious, but my brain just can't grasp it.
It's the same method, but put it in Window_Message
Code:
class Window_Message
  alias vn_update update
  def update
    vn_update
    update_visibility
  end
 
  def update_visibility
    self.visible = <put condition here>
  end
end
@TheoAllen That still doesn't trigger the picture display until I press enter.
Even if I hide the window_message, it's still there and prevents other instructions from being read.
Can I see how is your whole attempt?
The script part is:
Code:
class Scene_Map
  alias vn_update update
  def update
    vn_update

    if Input.trigger?(:A)
      $game_switches[98] = true
    end
  end
end


class Window_Message
  alias vn_update update
  def update
    vn_update
    update_visibility
  end
 
  def update_visibility
    if $game_switches[98] == true
    self.visible = false
    else self.visible = true
    end
  end
end
Where switch 98 triggers a common event :
V6nhNwe.jpg


and my test is just an event with a succession of Text entries separated by a Wait(20) between them.

When I activate this event, I display the first Text.
I press Shift to activate switch[98], it hides the window_message, but doesn't display the picture until I press Enter.
You don't run common event, use pure scripting, we all know eventing sucks.
Code:
class Scene_Map
  alias vn_update update
  def update
    vn_update
    if Input.trigger?(:A)
      $game_switches[98] = !$game_switches[98]
      unless @spr
        @spr = Sprite.new
        @spr.bitmap = Cache.picture('carte_clavier_FR')
      end
      @spr.visible = $game_switches[98]
    end
  end
 
  alias vn_term terminate
  def terminate
    vn_terminate
    @spr.dispose if @spr
  end
end


class Window_Message
  alias vn_update update
  def update
   vn_update
   update_visibility
  end

  def update_visibility
    self.visible = $game_switches[98]
  end
end
Roughly it's something like this, it can be modified to be more better though.
Thanks, I got it!
I just had to fix a couple of things in your code, like "alias vn_term terminate" -> "alias vn_terminate terminate"
and
self.visible = !$game_switches[98] #with an !
Very minor issues compared to my initial problem 🙂


Edit: I've found a side effect: albeit the window_message is invisible, the player can still go through the dialogue by pressing Enter. He can even walk on the map and activate another event in blind mode, with the picture still displayed.
I'll have to find a way to prevent actions.

Edit 2: I've managed to make something that does it. Your help with the Sprite use instead of a standard Show picture helped a lot, so your effort was not in vain. Thanks again!
Don't know what causes this - but when I try to alias, the sprite_battler's initialize method. The enemy battlers all seem to disappear.
Thought I could get around doing what I need to do by just heading up to the head honcho, Sprite Base - and while it will cause enemies to not vanish, but on the down side...
Spoiler
kSdB0d5.gif
It caused a prison break and now the battlers are above the menu's. And soon they will be in the real world!
So does anyone know why it's doing this? Or why aliasing sprite_battler's initialize could cause enemy sprites to not show up?
I probably should start using this thread for small questions like this one... feel lame to open a new one for this 😛
Anyway, is there a way to use the command "Set Event Location" for an event that is on another map? (this is for vxa)
Basically I have to move some events before the player enters that map, in relation on how the player positioned some events on another map.

My first instinc was to put the set event location commands AFTER the teleport, so the game would search for the events on that map, like you would do on rpg maker 2000/3 but apparently on ace doesn't work like that. So I went to look for some script call and I found this:

$game_map.events[id].moveto(new_x, new_y) and i put the entries like this:

$game_map[65].events[15].moveto($game_variables[39], $game_variables[40])
$game_map[65].events[16].moveto($game_variables[41], $game_variables[42])
and so on... but I get a crash 🙁

apparently $game_map[65] is incorrect. Anyone knows if it's possible to do this?
@sleepy_sealion my take is you will never get wrong on aliasing the initialize without you did something wrong on it. Maybe show us how you did it?

@Otto loaded map is only one, means you can't alter other map. And $game_map is not an array or something. Most of time, people did it by using fadeout on eventing before transfer player, then set position on the map, then perform fadein manually. Tell me why you couldn't do the same.
You can't change events on different maps, only on the one you are currently on.
But even if you change their position, they will revert back to their original position if the map is reloaded, unless you always set their position on map load (NOT an always running parallel process, just a simple one that erases itself after running.

Seeing that you already use variables for tracking their position, you can do this with events if needed.
Just run a parallel process event on the map you want to change these event positions, and put an "Erase Event" command on the end.

That little script call you used was almost correct, but $game_map is the object of the current map, no hashes/arrays involved, so just remove that [65] part from there.

In case you want to memorize these event positions, you can try to lookup Shaz's Memorize Event Positions script (not sure about the name, but it's something similar).
here's what I did:

upload_2018-9-15_1-13-12.png


This is the event that teleports me to the map in question.
Coming from long time use of rm2k/3 I was expecting the "Set Event Location" command to refere to the events on the new map, since the command take place after the teleport, but apparently on VXA its different, or at least I can't seem to get it work. I can probably find a different solution, but since apparenty one can put text from an item description into a variable (that it's originally meant to be numeric) I thought you could alter what happens in other maps in a similar way. My bad, I probably gave script calls too much credits lol

@Sixth hey 🙂 I actually do have that script, but in this particular case the player can push/pull some objects on a certain map to create himself some sort of bridge on another map (which is above the map where he moves the stuff) so i basically need to check where they are every time the player enters the map n°65. Anyway, like I said I'll try a different approach (aka I'll do as you said and use the call script but without the [65] stuff and hope for the best ) 😛
@TheoAllen this is the code I'm using:
Code:
  #Update bitmap image to index.
  alias update_image_index_bitmap update_effect
  def update_effect
  update_image_index_bitmap

   change_battler_image if @battler.battler_image_index != ""
   
  end

  #Change battler sprite to image index.
  def change_battler_image
   if @battler.actor?
    new_bitmap = Cache.battler(@battler.battler_name + @battler.battler_image_index, @battler.battler_hue) 
    self.bitmap = new_bitmap if @battler.battler_image_index != ""
   end
  end
donut steal - but maybe it's the new bitmap, I did edit the code a bit, since using bitmaps instead of changing the battler name felt like a good idea at the time. (Though I've noticed sprite_base isn't the best thing to use, as it affects the overworld events - though that did inspire some more scripts).
@sleepy_sealion and why u put change bitmap on update_effect? In default code, there is separate update_bitmap, and update_position. And you can just overwrite them and change how they work. And you didn't post how you alter the initialize function.
Woah - sorry, been a long day. This is the initialize for sprite base.

Code:
  #Create variables during initialization.
  alias create_idle_sprite_effect_var initialize
  def initialize(viewport = nil)
  create_idle_sprite_effect_var(viewport = nil)
    super(viewport)
    @idle_paused = 0
    @idle_frames = 0
  end

I don't know if everyone's on a new viewport that's above the menus?
You did that wrong.
Code:
  alias create_idle_sprite_effect_var initialize
  def initialize(viewport = nil)
   create_idle_sprite_effect_var(viewport)
   @idle_paused = 0
   @idle_frames = 0
  end
Yep - that did it. I thought Aliasing needed to be exact though to register?
Though maybe it's different with viewports - since I'm guessing that goof up was either making or using some other viewport for the sprites?
Your biggest mistake was
create_idle_sprite_effect_var(viewport = nil)
How would I go about implementing two stat scaling for attack in VXA? Basically, weapons would use certain bonus from Atk and Agi, depending on scaling. 5 types of scaling in each stat (E, D, C, B, A).

I'm currently using Yanfly's Weapon Attack Replace, which works fine for one stat scaling. Different "attack" skills correspond to different scaling for Atk stat, sending to a method like
Code:
calculate_attack(scaling, base_damage)

But the thing is, while it works good for one stat, with two stats it gets... bigger. I'd need 25 separate attack skills to take into account scaling E...A in both stats. Is there any way I could use weapon's note box to send scaling info to the attack skill? For example, I'd have a Mace, and in note box I'd write <scaling: B E>, and Attack skills' formula box would get that and call method
Code:
calculate_attack("B", "E", base_damage)
?

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