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

Anyone know if I can use all YEA Yanfly engine Ace's 107 scripts all in one project?
Just try and see what happens. And why in the world would you even want to do that?
Yes you can.
i know from experience that some scripts do not work fully with other scripts. (yanflys of course) e.g the class ( subclass) script has issues with a few other yanfly scripts. i also read somewhere that there is issues from repeating an alias(stack errors). dont know the two scripts that caused it though.
Is there something simple I can input into "Call Script" that will removal items, weapons, armor from my inventory?

I'm trying to include a "New Game+" type option at the end of the game.
Is there something simple I can input into "Call Script" that will removal items, weapons, armor from my inventory?

I'm trying to include a "New Game+" type option at the end of the game.
This is suitable for a script call:



Code:
gp = $game_party
gp.all_items.each{|i| gp.lose_item(i, 99)}
You could do that, but I would use this:



Code:
$game_party.init_all_items
It performs a similar function, but executes slightly faster and exists in the base Game_Party.
You could do that, but I would use this:



Code:
$game_party.init_all_items
It performs a similar function, but executes slightly faster and exists in the base Game_Party.
This is for weapons & armor, too?

(Also, this is for RMXP, if that matters.)

edit: I'm also trying to find an easy way to reset all self-switches of all events on all maps in the entire game. Someone on another forum gave me this:



Code:
key = [1, 1, 'A']
$game_self_switches[key] = false
$game_map.need_refresh = true
(map, event, switch)

But said I would have to do all of them manually. This person only knew very little scripting.
Yes, it's for weapons and armors as well as normal items. As for it being XP... Add this to the script editor:



Code:
class Game_Party
  def init_all_items
    @items = {}
    @weapons = {}
    @armors = {}
  end
end
Neither solution previously offered would work in XP, but mine will if that is present.

As for the self switches thing, the easiest way is just to redo $game_self_switches. So use this:



Code:
$game_self_switches = Game_SelfSwitches.new
edit: I'm also trying to find an easy way to reset all self-switches of all events on all maps in the entire game.


Code:
$game_self_switches.send(:initialize)
$game_map.need_refresh = true
Solistra's solution is likely better due to size constraints and the fact that I didn't take into account the call being used on a map that you intend the player to remain on for much longer than it takes for the script to execute. That said, I would check if XP has a New Game + script - there are other things, like vehicle position, that will need to be reset as well.
Yes, it's for weapons and armors as well as normal items. As for it being XP... Add this to the script editor:



Code:
class Game_Party
  def init_all_items
    @items = {}
    @weapons = {}
    @armors = {}
  end
end
Neither solution previously offered would work in XP, but mine will if that is present.
Testing everything now and the the self-switch one seems like it's working. But I'm not sure where to paste the above code. In Game_Party, but where?
You would place that below Materials.

Edit: Wait, XP. Put it above Main but below the other scripts - or cut out the first line (class Game_Party) and the last end and place it before the last end in Game_Party.
I completed everything I wanted to do with it and I just tested it.

It works perfectly.

My game is already ~30 hours and it suddenly got all kinds of replay value.

Thanks.
Hey. I need a script call to remove all characters from the party. I think it's something along the line of the previous posts about items etc, but I can't get it quite right. Help please?
Put it under Materials



Code:
class Game_Party
  def remove_all_actors
    @actors.each(&method(:remove_actor))
  end
end
Then call:



Code:
$game_party.remove_all_actors
Or just call:



Code:
$game_party.instance_eval("@actors.each(&method(:remove_actor))")
Hey there!

I have a small issue with the Yanfly battle script, whenever I use buffs or states; say if I was raising defense, it pops up saying Defense but theres a little square and { next to it.

I wonder if this is a quick fix for something I've likely done?

I think the thing that controls it is on lines 313 and 314, but I don't want to change anything lest I completely destroy something.

If someone could help me I'd really appreciate it!

And an explanation so I can slowly learn to understand scripts would be uber appreciated!
hey, i have these two methods to save actor data into save files, here are the methods...

1

Spoiler
Code:
def self.save_game_without_rescue(index)
  File.open(make_filename(index), "wb") do |file|
    $game_system.on_before_save
    Marshal.dump(make_save_header, file)
    Marshal.dump(make_save_contents, file)
    Marshal.dump($data_actors, file)
    @last_savefile_index = index
  end
  return true
end

def self.load_game_without_rescue(index)
  File.open(make_filename(index), "rb") do |file|
    Marshal.load(file)
    extract_save_contents(Marshal.load(file))
    $data_actors = Marshal.load(file)
    reload_map_if_updated
    @last_savefile_index = index
  end
  return true
end
2

Spoiler
Code:
  class << self ; alias msc_datareq make_save_contents
				  alias esc_datareq extract_save_contents ; end

  def self.make_save_contents
    contents = msc_datareq ; contents[:cust_act] = $data_actors ; contents
  end

  def self.extract_save_contents(contents)
    esc_datareq(contents) ; $data_actors = contents[:cust_act]
  end

end
They both go into DataManager Module,

My question is this... which one is most efficient, I feel its the second one as it has less risk for incompatibilities, but am i missing something important ? the snippets are basically for saving data which both of them do. or does it even matter which one is used ?


1. @YEA

When I try to put all 107 scripts in a project I get 50 to 75 in and then I get a "stack level too deep" error,



2. Ace Scripts

Are these scripts available for Ace yet?

  • Woratana's Multiple Fogs script.
  • Ccoa's Weather script.
  • BulletXT's Lighting Script.



3. Last one.

When the Ace Trail came out originally there was a way to use the regions sort of like an additional layer or extra tiles. I was wondering how to or if that was available in the full version of ace because I haven't seen it since. I would really like to use that feature that way again.
They both go into DataManager Module,

My question is this... which one is most efficient, I feel its the second one as it has less risk for incompatibilities, but am i missing something important ? the snippets are basically for saving data which both of them do. or does it even matter which one is used ?
Yes it does matter; incompatibility is exactly what you want to be avoiding. You have no idea if another script someone would use would want to be saving something in this sense.

If you're able to alias a method instead of overwriting it, that's always the alternative you should be taking 🙂

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