Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - brewmeister

1
Script Requests / Re: Rename SP Script
June 13, 2011, 06:00:06 am
I think what we need to do is talk to Gubid & see if we can't get a battle interpreter implemented so at least common events for skills & items will work.
Does GTBS use Troops?

Quote(sag ma biste deutsch ?)


1/16
2
Script Requests / Re: Rename SP Script
June 12, 2011, 03:40:34 pm
To use different colors for each string, just add a
self.contents.font.color = Color.new(255,0,0,255)  ## Red
statement under each sp_word = "" statement

To add another string, just add another 'when' statement

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw SP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_sp(actor, x, y, width = 144)
    # Draw "SP" text string
    self.contents.font.color = system_color
    case actor.class_id
    when 7, 8  ## Magic Users
      sp_word = "SP"
      self.contents.font.color = Color.new(255,0,0,255)  # Red
    when 9, 10  ## Something Else
      sp_word = "EP"
      self.contents.font.color = Color.new(0,255,0,255)  # Green
    else
      sp_word = "TP"
      self.contents.font.color = Color.new(0,0,255,255)  # Blue
    end
    self.contents.draw_text(x, y, 32, 32, sp_word)
    # Calculate if there is draw space for MaxSP
    if width - 32 >= 108
      sp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      sp_x = x + width - 48
      flag = false
    end
    # Draw SP
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
    # Draw MaxSP
    if flag
      self.contents.font.color = normal_color
      self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
      self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
    end
  end
end

[/quote]

I don't really understand the 2nd thing.  You want only certain items to restore SP, and others to restore TP?
You can do that with a common event for the healing/restoring items.
Not sure what you mean about "new state".  I haven't looked at MOG's script.
3
Script Requests / Re: Rename SP Script
June 12, 2011, 01:56:33 pm
Something like...    edit the ## Magic Users line to include the class ids of all magic user classes

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw SP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_sp(actor, x, y, width = 144)
    # Draw "SP" text string
    self.contents.font.color = system_color
    case actor.class_id
    when 7, 8  ## Magic Users
      sp_word = "SP"
    else
      sp_word = "TP"
    end
    self.contents.draw_text(x, y, 32, 32, sp_word)
    # Calculate if there is draw space for MaxSP
    if width - 32 >= 108
      sp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      sp_x = x + width - 48
      flag = false
    end
    # Draw SP
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
    # Draw MaxSP
    if flag
      self.contents.font.color = normal_color
      self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
      self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
    end
  end
end
4
Script Requests / Re: [XP] Circular HP Guage
June 12, 2011, 01:44:27 pm
Scratching my head on an algorithm for this too....

1) Ryex idea. It would be easy to write a method that subtracts (draws transparent) a line from the image. Then depending on the difference between the current & new value, iterate between the two. If the precision is a percent (100 possible values), and the value changes from 100 to 99, you draw 3 or 4 lines from the center of the circle at angles 0, 1, 2, 3.6.   The problem with this is I think the edges would end up jagged looking unless you added some kind of anti-alias algorithm, which would slow down the execution.

2) multiple images on layers.  What if we broke the top image up into 4 separate images (quadrants). Make 6 separate sprites (background, gauge1(100 - 75%), gauge2, gauge3, gauge4, and another upper left quadrant of the background).  then rotate each sprite to partially hide it behind the next sprite.  The last sprite, the partial background would turn on (become visible) when the value is less than 25%, for gauge4 to hide behind.

3) Make the top image like a big character set (except 10 x 10) with a separate image for each percent value, then just .blt the appropriate cell for the new value.

This will do the last option. It actually needs an image that's 10 x 11. first row starts with 0 & ends with 9. 11th row just has 100 in the first cell. (101 images in all)
Cells can be any size.  Call it with     @hp_gauge = Sprite_HPgauge.new(actor_id, x, y)
Don't forget to also dispose & update it in whichever scene you add it to.

#==============================================================================
# ** Sprite_HPgauge
#------------------------------------------------------------------------------
#  This sprite is used to display an hpgauge.
#  Create an image 10 cells wide, 11 cells tall with the gauge at 0%
#  in the first cell, the gauge at 100% in the first cell of the 11th row.
#==============================================================================

class Sprite_HPgauge < Sprite
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor_id, x = 0, y = 0)
    super()
    @charset = RPG::Cache.picture("hpgauge")
    @cw = @charset.width / 10
    @ch = @charset.height / 11
    self.bitmap = Bitmap.new(@cw, @ch)
    self.x = x
    self.y = y
    self.z = 500
    self.visible = true
    @actor_id = actor_id
    @hpp = -1
    update
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    if self.bitmap != nil
      self.bitmap.dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if @hpp != $game_actors[@actor_id].hp * 100 / $game_actors[@actor_id].maxhp
      @hpp = $game_actors[@actor_id].hp * 100 / $game_actors[@actor_id].maxhp
      row = @hpp / 10
      col = @hpp % 10
      rect = Rect.new(col * @cw, row * @ch, @cw, @ch)
      self.bitmap.blt(0, 0, @charset, rect)
    end
  end
end

5
Script Requests / Re: [XP] Circular HP Guage
June 10, 2011, 02:58:22 pm
Quote from: ForeverZer0 on June 07, 2011, 05:18:30 pm
He's not posting it as a resource. This is a script request for providing functionality for a circular HP meter.


I know. I just didn't want to guess what it should look like completely empty, and he only shows what it looks like 1/4 empty.
I suppose I could assume that the rest of the gauge is 'somewhat' darker when empty, but I've been burned too many times
in the past starting something without complete requirements that I just don't do it anymore.

The next question would be, how do you want this to integrate into the scenes that use an HP gauge?
Do you want it to completely replace "draw_actor_hp" every place HP is displayed (menu, status, battle),
and how do you want those windows rearranged to make room for the much larger HP gauge?

Or, do you want it simply as a new class that you can implement yourself?

Also, you are showing it with 4 increments of ~22.5 degrees (6.25%).  Which would be 16 increments overall.
Is that the desired precision?   or do you need a higher precision?
6
Script Requests / Re: [XP] Circular HP Guage
June 07, 2011, 11:56:37 am
It's huge!!!   :)

Can you post it completely empty?  HP 0
7
Quote from: Sub-Zero on May 14, 2011, 01:57:46 pm
Quick note, you could give any text "\" commands by simply aliasing the Bitmap.draw_text method. Scripters could even use it then when writing code.


Kinda like this....   http://www.hbgames.org/forums/viewtopic.php?f=11&t=74073    ;)  ;)

I started out the same way, then realized... "Everything uses Bitmap.draw_text, why not modify that!!"


Either way, great enhancement! Lot's of people have requested it.

Be Well
8
Script Requests / Re: [XP]Gold Hud
May 05, 2011, 04:34:29 pm
I assume you meant a gold window that shows on the map all of the time? (HUD)

This is an excellent first script-modification lesson. Good choice!

If you notice in the menu scene when you test play, the gold window is already there.
You just need to copy it to the map scene.

In Scene_Menu, find every line that has "@gold_window".   (5 places)
Use Cntl-F to bring up the "Find" dialog

Copy all 5 lines to the same respective location in Scene_Map

The first 3

    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416


go in the 'main' method, somewhere above the 'loop'.  Right below "@message_window = Window_Message.new"  is a good spot

The next one

    @gold_window.dispose


Also in the main method, but below the 'loop'.    Let's put that right after "@message_window.dispose"

And the last one

    @gold_window.update


in the 'update' method.  Right below "@message_window.update"    (seeing a pattern here?)   :)


Test it out.

It appears in the lower left corner, because that's it's position in the menu.


To reposition it,  just change the @gold_window.x = 0, and @gold_window.y = 416 to your desired position.

0, 0 is the upper left corner of the screen.   640, 480 is the lower right corner.
The origin of the window is the upper-left corner of the window.

So, right now the y=416 because the bottom of the screen is y 480, minus the height of the gold window (64)

To put your window in the upper left corner, set both x & y to 0

To put it in the upper right corner, set x to 480  (width of screen - width of window) (640 - 160),
and y to 0

Test again until you get the desired results

Be Well

9
General Discussion / Re: Autotiles?
April 25, 2011, 09:49:36 am
I wonder if this might help a bit...



drop this in your autotiles folder, and just draw on your map with it. Draw a row of single-wide tiles with some turns (like a path or road)
draw some double-wide rows, then draw a larger area.  Make sure you also hit the edge of the map.

blue - solid tile
green - edge
red - convex corner
yellow - concave corner

notice how a concave corner tile is made up of 3/4 of the blue solid tile, and 1/4 of the yellow convex corner tile.


Be Well
10
How, EXACTLY, should this work?

You want a pixel to pixel comparison (i.e. collision detection)?

Or just, if the event is wider than 32, check the adjacent tiles for passability too?
11
Scripting School / Re: Second Lesson, Break it down.
April 19, 2011, 02:55:42 pm
perhaps a non-programming example would help...

Level 1: Brush Teeth

Level 2:
  Get Toothbrush
  Get Toothpaste
  Combine Toothbrush & Toothpaste
  Replace Toothpaste
  Use Toothbrush on Teeth
  Replace Toothbrush
  Rinse


Level 3:
  Combine T&T
    Store toothbrush in right hand
    Store toothpaste in left hand
    Remove cap from toothpaste
    Aim toothpaste at brush
    While toothbrush is not full of toothpaste*
      Squeeze
    Stop Squeezing


* it's sometimes ok to use 'programming' terminology/concepts/logic, but in a very generic sense.

It's sometimes hard to conceptualize a modification this way, since you have already decided the mode of implementation (the language), and you're looking at the current implementation rather than just it's 'requirements'.
12
Script Requests / Re: Cooking
April 19, 2011, 02:35:23 pm
I'm not aware of any cooking/crafting/alchemy system that doesn't show you which items you need to combine to produce another item.
I also can't remember seeing one that can fail when you do have all the right ingredients.

That being said, your best bet is to find a system that mostly works the way you want, and have it modified.

You need to provide enough detail so that someone can make the modifications you need. pictures help (a lot) even if they're rough sketches.

How will it be accessed?  a "Cooking" option on the main menu, a special key in the item menu?
How will the user select the items?
What happens on success? (What does the user see?)
What happens on failure? (again, what does the user see?)
Are any items exempt?  (not selectable when cooking)
Are there non-consumable items required? (Pots, pans, etc..)
13
Script Troubleshooting / Re: Invert Graphic in Game
April 19, 2011, 01:49:11 pm
This is a very simple implementation of just the invert method.

#=======================================================================
# ** Additional Bitmap Methods
#-----------------------------------------------------------------------
#   By Untra
#   5/5/10
#   v0.5
#=======================================================================
  #---------------------------------------------------------------------
  # * Invert
  #   WARNING: Inverting colors is especially process consuming, and
  #     with frequent use can lag a game indefinitely. Use sparringly. 
  #   NOTE: calling an invert color method a second time will bring its
  #     colors back to normal, assuming you didn't change its colors
  #     while in negative.
  #---------------------------------------------------------------------
  class Bitmap
  def invert
    for w in 0..(width - 1)
      for h in 0..(height - 1)
        color = get_pixel(w, h)
        r = 255 - color.red
        g = 255 - color.green
        b = 255 - color.blue
        a = color.alpha
        set_pixel(w, h, Color.new(r, g, b, a)) if a > 0
      end
    end
    return self
  end
end

#=======================================================================
# ** Additional Bitmap Methods Implemented
#=======================================================================

class Sprite_Character
  alias invert_update update
  def update
    invert_update
    if @character.inverting
      self.bitmap.invert
      @character.invert
    end
  end
end

class Game_Character
  attr_reader :inverting
  alias invert_init initialize
  def initialize
    invert_init
    @inverting = false
  end
  def invert
    @inverting = !@inverting
  end
end


To change the player, call

$game_player.invert

To change an event, call

event = get_character(0)
event.invert
14
General Discussion / Re: Which has to be done first?
April 19, 2011, 11:56:19 am
Quote from: Magnum-X on April 18, 2011, 02:13:56 am
i messed up bad on my game started making tons of maps (isn't that a good thing?, let me finish) WITHOUT A STORY
now i have to restart from beginning...


Not really. I see no reason why that won't work. You create a world, then develop the story in the world.
It may turn out that as you develop the story you will either have to adapt the map to the story, or adapt the story to the map.
e.g. you decide you want a side-quest that leads into the mountains, but your map has no trail going to the mountains.

Mapping is relatively easy to so, you can SEE the fruits of your labors, and you get a sense of accomplishment
which can help keep you motivated to keep working on the game.

However, once you start adding plot related events, NPCs, puzzles, quests, etc...  it would be better to have at least
a detailed outline of the story to avoid inconsistencies, and reduce the amount of editing required.

I certainly wouldn't scrap all the work you've done & start over.

Be Well
15
Good if it's done to support your story / plot.
Bad if it's done just for the sake of doing it.
Although I suppose the comedic effect of Mario walking by & asking, "Hey, have you seen a princess? Tall... Blond... last seen with a big monkey???" would get a laugh. In moderation though.
16
Script Requests / Re: [XP] Health and level
April 13, 2011, 09:13:35 pm
weird, I just answered this recently.

BTW, It took me a little while to figure out how to alias a 'setter' method, but this is a little cleaner & will prevent incompatibility...

class Game_Actor
  alias :old_exp= :exp=
  def exp=(exp)
    oldlvl = @level
    self.old_exp = exp
    if @level > oldlvl
      @hp = self.maxhp
      @sp = self.maxsp
    end
  end
end
17
Script Requests / Re: [XP] Health and level
April 13, 2011, 08:50:06 pm
Did you ask this somewhere else?

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Change EXP
  #     exp : new EXP
  #   Add All Heal on Level up - Brew
  #--------------------------------------------------------------------------
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
      #heal
      @hp = self.maxhp
      @sp = self.maxsp
    end
    # Level down
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # Correction if exceeding current max HP and max SP
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
end
18
RMXP Script Database / Re: [XP] Revival Point
March 22, 2011, 09:19:58 am
If the 'respawn' location is fixed throughout the game, the using Constants is neater.

If you want to change the respawn location as you move through the game..  i.e. local respawn locations,
then using game_variables makes it easy to control with events without using "script" commands.
19
Script Troubleshooting / Re: Respon kills me
March 21, 2011, 11:53:39 am
Yep, also add...

    $game_temp.in_battle = false

8)
20
Script Requests / Re: Critical hit state
March 14, 2011, 09:53:58 am
You can double the chance by having your state set the DEX% to 200.