General RGSS/RGSS2/RGSS3 Help

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

Previous topic - Next topic

G_G

Quote from: nathmatt on April 09, 2009, 09:53:13 am
actually this works tested

Spoiler: ShowHide
module GameGuy
  Tilesets_Apply          = [1, 3]
  Terrain1                = "001-Grassland01"
  Terrain2                = "002-Woods01"
  Terrain3                = "003-Forest01"
  Terrain4                = "004-Mountain01"
  Terrain5                = "004-Mountain01"
  Terrain6                = "004-Mountain01"
  Terrain7                = "004-Mountain01"
end
class Scene_Map
  alias re_update update
  def update
    re_update
   if GameGuy::Tilesets_Apply.include?($game_map.map_id)
      if $game_player.terrain_tag == 1
        $game_map.battleback_name = GameGuy::Terrain1
      elsif $game_player.terrain_tag == 2
        $game_map.battleback_name = GameGuy::Terrain2
      elsif $game_player.terrain_tag == 3
        $game_map.battleback_name = GameGuy::Terrain3
      elsif $game_player.terrain_tag == 4
        $game_map.battleback_name = GameGuy::Terrain4
      elsif $game_player.terrain_tag == 5
        $game_map.battleback_name = GameGuy::Terrain5
      elsif $game_player.terrain_tag == 6
        $game_map.battleback_name = GameGuy::Terrain6
      elsif $game_player.terrain_tag == 7
        $game_map.battleback_name = GameGuy::Terrain7
      end
    end
  end
end



Yea but I wanted it for tilesets not maps.

nathmatt

April 09, 2009, 06:58:32 pm #61 Last Edit: April 09, 2009, 07:25:05 pm by nathmatt
there for tilesets but it goes by the name of it not the id
Spoiler: ShowHide
module GameGuy
  Tilesets_Apply          = [001-Grassland01]
  Terrain1                = "001-Grassland01"
  Terrain2                = "002-Woods01"
  Terrain3                = "003-Forest01"
  Terrain4                = "004-Mountain01"
  Terrain5                = "004-Mountain01"
  Terrain6                = "004-Mountain01"
  Terrain7                = "004-Mountain01"
end
class Scene_Map
  alias re_update update
  def update
    re_update
   if GameGuy::Tilesets_Apply.include?($game_map.tileset_name)
      if $game_player.terrain_tag == 1
        $game_map.battleback_name = GameGuy::Terrain1
      elsif $game_player.terrain_tag == 2
        $game_map.battleback_name = GameGuy::Terrain2
      elsif $game_player.terrain_tag == 3
        $game_map.battleback_name = GameGuy::Terrain3
      elsif $game_player.terrain_tag == 4
        $game_map.battleback_name = GameGuy::Terrain4
      elsif $game_player.terrain_tag == 5
        $game_map.battleback_name = GameGuy::Terrain5
      elsif $game_player.terrain_tag == 6
        $game_map.battleback_name = GameGuy::Terrain6
      elsif $game_player.terrain_tag == 7
        $game_map.battleback_name = GameGuy::Terrain7
      end
    end
  end
end

& blizz"s unofficial h window
Spoiler: ShowHide
Quote from: Doris on March 25, 2008, 11:35:30 am
Damn, I thought I had the code. This is what I am using:

#==============================================================================
# Window_Horizontal
#==============================================================================

class Window_Horizontal < Window_Base
 
  attr_reader :commands
 
  def initialize(w, commands)
    super(0, 0, 3 * w + 32, 64)
    @item_max = commands.size
    @commands = commands
    if @item_max > 0
      self.contents = Bitmap.new((@item_max + 4) * w, height - 32)
    else
      self.contents = Bitmap.new(32, height - 32)
    end
    @dir = 0
    self.contents.font.name, self.contents.font.size = 'Brush Script', 26
    self.opacity = self.index = 0
    refresh
  end
 
  def refresh
    self.contents.clear
    (0...@item_max+4).each {|i| draw_item(i, (i + @item_max - 2) % @item_max)}
  end
 
  def get_command
    return @commands[(@index + @item_max) % @item_max]
  end
 
  def draw_item(i, index, color = nil)
    rect = Rect.new((self.width - 32)/3 * i, 0, (self.width - 32)/3, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    if color.is_a?(Color)
      self.contents.font.color = color
    else
      self.contents.font.color = case @commands[index]
      when 'And again!', 'Und nochmal!' then text_color(3)
      when 'Warrior', 'Krieger' then text_color(6)
      when 'Exerion' then text_color(2)
      when 'Options', 'Optionen' then text_color(1)
      when 'Debug Room' then text_color(8)
      when 'Lost Memories', 'Erinnerungen' then text_color(9)
      when 'Hexahax' then Color.new(0, 192, 255)
      when 'Lexima One' then Color.new(0, 255, 96)
      else
        normal_color
      end
    end
    self.contents.draw_text_outline(rect, @commands[index], 1)
  end
 
  def disable_item(index)
    draw_item((index + 2) % @item_max, index, disabled_color)
    draw_item((index + 2) % @item_max + @item_max, index, disabled_color)
    draw_item((index + 2) % @item_max + @item_max*2, index, disabled_color)
  end
 
  def size
    return @commands.size
  end
 
  def update
    super
    if moving?
      case @dir.abs
      when 1 then self.ox -= 5 * @dir.sgn
      when 2 then self.ox -= 10 * @dir.sgn
      when 3 then self.ox -= 20 * @dir.sgn
      when 4 then self.ox -= 45 * @dir.sgn
      when 5 then self.ox -= 45 * @dir.sgn
      when 6 then self.ox -= 20 * @dir.sgn
      when 7 then self.ox -= 10 * @dir.sgn
      when 8 then self.ox -= 5 * @dir.sgn
      end
      @dir -= @dir.sgn
    end
    if !moving? && self.active && @item_max > 0
      if Input.repeat?($controls.right)
        $game_system.se_play($data_system.cursor_se)
        @index = @index % @item_max + 1
        if self.ox == (@item_max + 1)* (self.width - 32)/3
          self.ox -= @item_max * (self.width - 32)/3
          @index = 1
        end
        @dir = -8
      elsif Input.repeat?($controls.left)
        $game_system.se_play($data_system.cursor_se)
        @index = (@index + @item_max - 2) % @item_max + 1
        if self.ox == (self.width - 32)/3
          self.ox += @item_max * (self.width - 32)/3
          @index = @item_max - 1
        end
        @dir = 8
      end
    end
    update_cursor_rect
  end
 
  def moving?
    return (@dir != 0)
  end
     
  def index=(index)
    @index = index
    self.ox = (index + 1) * (self.width - 32)/3
    update_help if self.active && @help_window != nil
    update_cursor_rect
  end
 
  def update_cursor_rect
    self.cursor_rect.set((self.width - 32)/3, 0, (self.width - 32)/3, 32)
  end
 
end


But it's the command window that moves around as well. Hm... I remember somebody posting a horizontal command window at the old CP forum. You could try looking for it there.
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


Blizzard

I posted a version for public use of a horizontal window several times already and that's not the one. -_-
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

Okay nother question guys sorry :^_^':

How do we check if an item has an element checked? I'm making this Augmentation system like off of fable. Also how do we add an element or remove it from an item?

fugibo


G_G

April 25, 2009, 02:17:59 pm #65 Last Edit: April 25, 2009, 03:48:11 pm by game_guy
I see how to add elements but I still dont see how to check if it has an element checked.'

Ok I still dont know how to add them or see if one is checked. I only know how to set the elements in an array

G_G

More help :<_<: probably getting sick of me huh? >.<

Anyways couple of questions

How do I wait frames in rgss and how do I randomize variables in rgss?

nathmatt

there is no wait command in rgss ur best bet is to use a variable so put in update that if  @wait_count > 0 @wait_count = - 1 and for random u use rand(n)  so u use n as the range
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


G_G

There has to be a wait command because The event editor has a Wait command and it waits the amount of frames you put in.
Spoiler: ShowHide

Each event command has a line of script behind it.

But for the random thing use
Rnd(8)

and it'll randomize a number between 0-8?

nathmatt

April 28, 2009, 06:33:47 pm #69 Last Edit: April 28, 2009, 06:34:56 pm by nathmatt
yea put
rand(8)


& thats how they do the wait command the have a @wait_count in there update method
look at the update method in scene battle
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


G_G

New question.

I want to be able to find the percentage of somethign how would I do so? Wouldnt i use this?
$value = 1000 %


Aqua

A percent in math is...

Value / Max Value * 100

Gosh... so simple math =X

Blizzard

This will be always 0 if Value and MaxValue are both integers. Better use

Value  * 100 / MaxValue
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

May 14, 2009, 06:06:02 pm #73 Last Edit: May 14, 2009, 06:07:38 pm by Youngster Gi Gi
There is no max value. I want to be able to find what 1% = compared to a number. Like so...

1% of 100 = 1
1% of 1000 = 10
etc....

There is no ma value to divide by thats why I was asking.....

Aqua

DON'T YOU KNOW YOUR MATH!?!? >8U

1% = 0.01
10% = 0.1
etc

G_G

That's only for the number 1. Try getting the single percent for this than

23385

Aqua

You mean 23385% of something?

233.85

G_G

May 14, 2009, 06:28:29 pm #77 Last Edit: May 14, 2009, 06:29:53 pm by Youngster Gi Gi
Oh so I just move the decimal is all?

Thank you aqua thats all I wanted to know but

What if I dont know what the value will be? How would I get that mathematical in RGSS. I'm going to make Gold Boosting Equipments

and I wanted an equation that did that so than I can take the percentage from the armor and add it to the gold amount

Aqua

May 14, 2009, 06:33:58 pm #78 Last Edit: May 14, 2009, 06:35:48 pm by Elite Four Aqua
Where val = the % of the gold increase you want

gold_increase_percent = val.to_f / 100


Then add that as a % modifier to the amount of gold you receive.

G_G

Thank you so much aqua. *powers up*

Just what I needed to finish this. If I do release the script (might be private for my game not sure) You'll be on the special thanks.