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

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
I still vote that my method would be most efficient...

class Game_Party  def member_level_avg    members.compact.inject(1) { |r, i| r += i.level } / members.size  end  def add_soul_actor(actor_id,level=members_level_avg)    add_actor(actor_id)    level.times { members.last.level_up }  endend
And you could make it even more efficient like this...

class Game_Party def member_level_avg members.compact.inject(1) { |r, i| r += i.level } / members.size end def add_soul_actor(actor_id,level=members_level_avg) add_actor(actor_id) actor = members.compact.last level.times { actor.level_up } endend
Maybe not though, Never actually tried the code lol
 
Joined
Feb 12, 2014
Messages
4
Reaction score
1
First Language
English
Primarily Uses
I'm trying to make a game where when you press cancel to call the menu, you get only the inventory (so like an adventure game.)

I found this script by IceDragon which is suppose to do just that. But for some reason, items I have in inventory refuse to actually appear on this menu. Does anyone know what's missing with it?

Code:
# IEK/lib/simple_item_window.rb#   dc 16/11/2013#   dm 16/11/2013#   by IceDragon#   Editted 21/06/2014class Scene_Map < Scene_Base  #--------------------------------------------------------------------------  # * Call Menu Screen  #--------------------------------------------------------------------------  def call_menu    Sound.play_ok    SceneManager.call(Scene_Item)  endendclass Scene_Item < Scene_ItemBase  remove_method :on_category_ok  remove_method :create_category_window # Removes category nonsense  def start    super    create_help_window    create_item_window    adjust_windows  end    def create_help_window    @help_window = Window_Help.new(1)    @help_window.viewport = @viewport  end      def create_item_window    ### Rect.new(  x,   y, width, height)    r = Rect.new( 15,  63,   514,    338)    @item_window = Window_ItemList.new(r.x, r.y, r.width, r.height)    @item_window.viewport = @viewport    @item_window.help_window = @help_window    @item_window.set_handler(:ok,     method(:on_item_ok))    @item_window.set_handler(:cancel, method(:on_item_cancel))  end    def adjust_windows    def @item_window.include?(item)      $game_party.usable?(item)    end    #~~~~~~~~~~~~~~~~~~~ Uncomment below this line to hide item quantities    #def @item_window.draw_item(index)    #  item = @data[index]    #  if item    #    rect = item_rect(index)    #    rect.width -= 4    #    draw_item_name(item, rect.x, rect.y, enable?(item))    #  end    #end    #~~~~~~~~~~~~~~~~~~~ Uncomment above this line    @item_window.refresh    @item_window.activate.select_last    ### help_window    @help_window.width = @item_window.width    @help_window.x = @item_window.x    @help_window.y = @item_window.y - @help_window.height    @help_window.create_contents # re-create the Help_Window contents    @help_window.refresh  end  def on_item_cancel    Sound.play_cancel    return_scene  endend
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Are you putting it BELOW your other scripts, under the Materials heading?
 
Joined
Feb 12, 2014
Messages
4
Reaction score
1
First Language
English
Primarily Uses
Yes. I also tried commenting out any other non-default scripts I had, as well as checking to make sure I did actually have items in my inventory. Still nothing showing up.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
I can't see why it doesn't work.


Maybe start a new thread, include a link to the script, and show some screenshots of what happens (and of proof that the items actually ARE in your inventory). Also a screenshot of your scripts window, showing where you've got the script installed and what other scripts you have in there.
 
Joined
Feb 12, 2014
Messages
4
Reaction score
1
First Language
English
Primarily Uses
Ahh okay nevermind, figured out what was wrong. I had item use occasions in the menu set to Never, and that causes it to just not appear at all (instead of appearing dimmed out like in default menu.It's working now :) .
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
May I ask if Ace still honors the use of DEP? I just thought of this because I remember a script from somewhere before that prevents the DEP or rather, helps the RM (through that script) look at the DEP and prevent the game from crashing. I just don't know if Ace still has that feature.

I asked this because I have a script that I'm working on and it concerns the DEP.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
http://tkool.jp/support/faq/general/dep.html

rom WindowsXP SP2, Data Execution Prevention (DEP) feature has been introduced as a security feature. 
Data Execution Prevention (DEP) is a feature to prevent code that has a problem and that perform additional checks on memory to be run on the system.

However, this feature is enabled,

"... Has stopped working" (the name of the program contains the ~)​
Display like is, you may some products may not work correctly. 
 

Currently, the following products, this phenomenon occurs has been confirmed.

---

I was wondering if this was availed till RMVXAce.
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
Found the answer to my previous question by myself.

But now, how do I make the SceneManager.background_bitmap show not just the map but also the events?
For some reason the original menu shows them fine, but even when I copy it it still doesn't show them...

Pretty sure it must be just a line I ignored or something, but...
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
The one that handles that is the snapshot_for_background something method of Scene_Map as far as I remember
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
I found the problem. There was something (forgot the name right now) erasing them before it ran.

For information, I was trying to make the map appear normal under the battle scene.
 
Last edited by a moderator:

Malzir

Villager
Member
Joined
Dec 7, 2012
Messages
23
Reaction score
4
First Language
English
Hello,

When entering a script through the event commands how do I make something run after $game_message.add AFTER the action key has been pressed or window has been closed? Thanks.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
just put the script call below your message box?

That is, if you want the script code to be evaluated after the message box closes/changes page.
 

Malzir

Villager
Member
Joined
Dec 7, 2012
Messages
23
Reaction score
4
First Language
English
Here's the script I'm working with:

args = $game_temp.common_event_args
make_pic(1, "Xia", 255, 130, 400)
$game_message.add("\\C[17]Xia\n\\C[0]" + args[0])
erase_pic(1)

But the picture is being erased immediately. I am putting this into a common event via the "Script" method. Even if I put an "Erase Picture" event after the script within the common event then it is erased immediately. I am trying to keep the system dynamic without having to clear the picture manually within the normal events themselves. Or is this not a possibility?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
Ahh sorry - I never use the default methods of showing pictures.

Why dont you - as a slight alternative - put the value args[0] (args.first works just as well btw) into a variable and then display the variable within the normal game text method.

Its probably because you are coding it that its erasing as its evaluating the complete box.
 

Malzir

Villager
Member
Joined
Dec 7, 2012
Messages
23
Reaction score
4
First Language
English
Cheers, I did as you suggested as an alternative and it works great. :)

One more quick question while I'm here: Is there an easy way to make a picture show in front of the message box instead of behind it? (But only temporary so every picture after doesn't show over it).
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
Glad that method worked for you :)

as previously mentioned - I dont use the default picture methods, but if there is a way to change the z value just increase that above 200 (im sure 200 is the message window z value)
 

Solistra

Veteran
Veteran
Joined
Aug 15, 2012
Messages
593
Reaction score
247
Primarily Uses
class Game_Party  def member_level_avg    members.compact.inject(1) { |r, i| r += i.level } / members.size  end  def add_soul_actor(actor_id,level=members_level_avg)    add_actor(actor_id)    level.times { members.last.level_up }  endend
I'm pretty sure I've covered the accuracy of averaging in this very topic before... anyway, the method you're using to determine the average is inaccurate, as it deals entirely with integers which are automatically rounded to the lowest integer: if the result of the average is 5.9, it will return 5. Here:

class Game_Party def member_level_avg return nil if members.empty? (members.map(&:level).reduce:)+) / members.size.to_f).round endendThis actually ensures that the average is treated as a floating point number and accurately rounds to the nearest integer. It also ensures that we won't encounter a ZeroDivisionError (or, in this method, FloatDomainError since we're casting members.size to a floating point number).It's also worth mentioning that the way the actor is being leveled will actually cause them to be a higher level than what I believe was intended (among other problems), seeing as they begin at their initial level and then increment that based on the party's average level. If you want the level of the actor to be equal to the party's average, I'd recommend going about it in a different way. Actually, I'd handle the entire method differently:

class Game_Party def add_soul_actor(id, level = member_level_avg || 1) unless @actors.include?(id) add_actor(id) actor = members.last actor.change_exp(actor.exp_for_level(level), false) if actor.level > level actor.level_down until actor.level == level end actor.recover_all yield actor if block_given? actor end endendFirstly, your original method didn't handle trying to add an existing party member appropriately -- this one does, returning nil without any modifications to the party. Secondly, this method also ensures that the actor will level up or down appropriately (if, for instance, the actor that is added has a higher initial level than the party's average). Finally, it accurately modifies the actor's experience and initializes them with full health and mana (as is expected when a member is added to the party most of the time in my experience).Note: leveling an actor down does not modify their learned skills -- this is how it works in the default scripts, and honestly, isn't my problem.

On a slightly separate note, this method also actually returns the actor instance which was added to the party and yields the actor if a block is given, which is honestly much nicer than the idiotic true returned by the default Game_Party#add_actor. (Then again, a lot of the default RGSS3 return values are pretty stupid.)

Code:
# Optimize the added actor's equipment with the party's best inventory when the# actor is added via the `Game_Party#add_soul_actor` method with a block.$game_party.add_soul_actor(8) { |actor| actor.optimize_equipments }
 

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

Latest Threads

Latest Profile Posts

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.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,454
Members
137,821
Latest member
Capterson
Top