General RGSS/RGSS2/RGSS3 Help

Started by G_G, March 04, 2009, 12:14:28 am

Previous topic - Next topic

Blizzard

That's ok. Mostly classes can be defined in any order, but when several script redefine the same classes, this is where your scripts need to be in the correct order.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

C.C. rOyAl

Spoiler: ShowHide

Blizzard

This:

Quote from: C.C. rOyAl on October 11, 2009, 05:39:51 pm
would i have to define the class Scene_Menu before i defined The Status screen?


No you wouldn't. This order IS NOT important.
BUT! Your CMS script that redefines Scene_Menu MUST be placed under the original Scene_Menu script. This order IS important.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

C.C. rOyAl

Spoiler: ShowHide

nathmatt

if i wanted to inclose each Character in a separate window in my menu status how would i do that
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


fugibo

Quote from: nathmatt on October 13, 2009, 05:20:02 pm
if i wanted to inclose each Character in a separate window in my menu status how would i do that


Just replace the single instance of Window_MenuStatus with four instances of your own window.

Ryex

so I have an dynamically generated array that looks something like this

powers = [[index_to_another_array, effective_power], [index_to_another_array, effective_power], [index_to_another_array, effective_power],[index_to_another_array, effective_power]]

what I need to do is find the array in the powers array that has the highest value for effective_power and return it so that I end up with
[index_to_another_array, highest_effective_power]

how can I do this?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

October 17, 2009, 04:50:33 pm #287 Last Edit: October 17, 2009, 04:52:53 pm by Blizzard
max = nil
powers.each {|current| max = current if max == nil || current[1] > max[1]}


It's just a standard max/min loop. You could also use something like this:

max = powers[0]
(1...powers.size).each {|i| max = powers[i] if powers[i][1] > max[1]}


I prefer the latter due to only 1 condition being checked.

There's also a way to use a block with .max, but I don't really recommend it as it's confusing.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

K here's a method from scene_battle
def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp = 0
    gold = 0
    treasures = []
    # Loop
    for enemy in $game_troop.enemies
      # If enemy is not hidden
      unless enemy.hidden
        # Add EXP and amount of gold obtained
        exp += enemy.exp
        gold += enemy.gold
        # Determine if treasure appears
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # Treasure is limited to a maximum of 6 items
    treasures = treasures[0..5]
    # Obtaining EXP
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # Set wait count
    @phase5_wait_count = 100
  end


Anyways what I'm wondering is how do I change how the experience is handled when aliasing, see when I alias it and call the old method its gonna change how the exp is given but I wanna change that to something else but still be able to alias and not over write the method.

Blizzard

Check out how I did it in the Different Difficulties System in Tons.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fugibo

Quote from: Ryexander on October 17, 2009, 02:13:55 pm
so I have an dynamically generated array that looks something like this

powers = [[index_to_another_array, effective_power], [index_to_another_array, effective_power], [index_to_another_array, effective_power],[index_to_another_array, effective_power]]

what I need to do is find the array in the powers array that has the highest value for effective_power and return it so that I end up with
[index_to_another_array, highest_effective_power]

how can I do this?


This looks suspiciously like you're solving a polynomial, or something similar (that code would function to find the degree of any polynomial once you process it into an array of constants and variable names and the highest of their powers). May I ask what you're trying to do?

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

How do we get all of the map files put into an array?
For example, MAP001, MAP002, MAP003 are in the data folder, how would I get each of those map files in an array?

Because I dont know how many maps people are going. I'm working on a really cool script but yea I need all the map files in an array first.

Or if possible, instead of the file names, I want to use the actual map names used in the editor.
Like MAP001 is named Grasslands ect.

Blizzard

hash = load_data('Data/MapInfos.rxdata')


The keys in the hash are the map IDs of all maps in the game (hash.keys returns an array of all keys). The values in the hash are RPG::MapInfo instances which have the attribute @name. So you can simply use hash[ID].name to get the map name.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

nathmatt

is there a way to get the exp curve and use it so that other things lvl the same way
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Ryex

how do you alias a self.method in a module?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

module XYZ
 
  class << XYZ
    alias abc_2 abc
  end
 
  def self.abc
    # code
    abc_2
    # code
  end
 
end
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Jackolas

Quoteis there a way to get the exp curve and use it so that other things lvl the same way

http://forum.chaos-project.com/index.php?topic=4851.0
should be correct