General RGSS/RGSS2/RGSS3 Help

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

Previous topic - Next topic

fugibo

Quote from: game_guy on September 17, 2009, 08:40:36 pm
Okay so how do we draw a rectangle?

One thats just an outline? And then one thats just filled?




Wait, you honestly don't know Bitmap#fill_rect?

bitmap.fill_rect(<x>, <y>, <w>, <h>, <color>)


To draw an outline, you just draw lines using fill_rect:

bitmap.fill_rect(<x>, <y>, <w>, 1, <color>)
bitmap.fill_rect(<x> + <w>, <y>, 1, <h>, <color>)
bitmap.fill_rect(<x>, <y> + <h>, <w>, 1, <color>)
bitmap.fill_rect(<x>, <y>, 1, <h>, <color>)

G_G

thanks LF *lv's up* I know you hate it but you've helped me out alot

fugibo

Quote from: game_guy on September 17, 2009, 08:52:45 pm
thanks LF *lv's up* I know you hate it but you've helped me out alot


Just for the record, I was trying to offend you above, but I thought that fill_rect was one of the things most scripters learned right off the bat. 0_o

Apparently, I was wrong...

G_G

Well yea you'd think I'd know but I've never been the one to really mess with bitmaps so thanks again

Blizzard

September 18, 2009, 03:31:06 am #244 Last Edit: September 18, 2009, 03:32:09 am by Blizzard
Quote from: Longfellow on September 17, 2009, 08:51:40 pm
To draw an outline, you just draw lines using fill_rect:

bitmap.fill_rect(<x>, <y>, <w>, 1, <color>)
bitmap.fill_rect(<x> + <w>, <y>, 1, <h>, <color>)
bitmap.fill_rect(<x>, <y> + <h>, <w>, 1, <color>)
bitmap.fill_rect(<x>, <y>, 1, <h>, <color>)



Redundancy.

bitmap.fill_rect(x, y, w, h, c)
bitmap.fill_rect(x + b / 2, y + b / 2, w - b, h - b, Color.new(0, 0, 0, 0))
# x: x coordinate
# x: y coordinate
# c: color
# w: width
# h: height
# b: border width, use an even number

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

Wow. I can't believe I didn't think of that. You know, since I've actually written huge scripts using that exact method before. ><

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

Okay for this all I need is an answer to this. Its got nothing to do with rgss help but more of a "Is it worth scripting" question.

My friend relies on me when it comes to scripts...anyways he had this idea for his game called
Skill Equipping

Well what is exactly is each actor has ability points. For example
Aluxes: AP 10/10
Instead of being able to use all of your skills at once he wants to be able to equip skills to his actor. Each skill costs ap so when the ap's gone you cant equip anymore. The actor also gains some ap after every level up. He thought it was a great idea but is it really worth scripting?

I told him I might make it. But I want to know if theres a non sdk system like that already out there? Or if its even a good idea to script something. I thought it was a cool idea but I dont want to make it if its not worth it or if theres an already existing script like it.

winkio

Definitely a good idea, a unique system that could add to a game.  I don't know if there's systems already out there, but I think you could make a better one anyways.  :)

G_G

k thanks winkio I'll start working on it now and another question

Just some more bitmap stuff.
okay so I now know how to draw a rectangle but how do I make the inside clrea? Like transparent?

fugibo

Quote from: game_guy on September 24, 2009, 08:07:55 pm
k thanks winkio I'll start working on it now and another question

Just some more bitmap stuff.
okay so I now know how to draw a rectangle but how do I make the inside clrea? Like transparent?


Use the alpha layer of the Color class:

# 24-bit (RGB) Color, doesn't have transparency
c = Color.new(<red value>, <green value>, <blue value>)

# 32-bit (RGBA) Color, transparency layer is called "alpha"
c = Color.new(<red value>, <green value>, <blue value>, <alpha value>)


And simply use that color along with Bitmap#fill_rect.

G_G

another question....dang whats with all the questions? I'm going to count how many questions I asked in this thread lol

Okay anyways in a message window you can use commands like these
\n

  • \v

  • ect.

    Is it possible to use codes like that in skills names or items and stuff? Like here's the item name
    "Potion \p[100]"

    Just for example than have a script like take that text and delete it and then use the number for something.

    Also one more question. I plan on modding the message window for something but it requires this
    \blah[1, false]

    Like instead of it having just one thing in the brackets how would I make it two?

Aqua


G_G

well that doesnt help with the first question, I want to put
\ commands in the item name in teh database then later
it does a command

fugibo

Quote from: game_guy on September 28, 2009, 08:15:30 pm
well that doesnt help with the first question, I want to put
\ commands in the item name in teh database then later
it does a command


Regular expressions.


# Code to print a number specified with \p[<x>] inside the name of an item with ID @item_id
if $data_items[@item_id].name =~ /\\p\[([0-9]*?)\]/i # << Here be the regular expressions
    # Print the number they added in the name
    print "Your number is #{$1}, foo!"
end

G_G

will that get rid of the \ command from the skill name?

fugibo

Quote from: game_guy on September 28, 2009, 10:19:13 pm
will that get rid of the \ command from the skill name?




...I forgot that, dangit.


class RPG::Item
  alias real_name name
  alias real_name= name=

  def name
    return real_name.gsub /\\p\[([0-9]*?)\]/i, ''
  end
 
  def name= str
    if real_name =~ /\\p\[([0-9]*?)\]/i
      real_name = "#{str} #{$1}"
    else
      real_name = str
  end
end


Methods FTW!

samsonite789

A question for thee (all of thee):

I am using events to create custom regen/poison/drain/osmosis blah blah blah etc. etc.  So far, all of it works, but there's one problem: no numbers pop up for the damage or healing done.  Of course, they wouldn't, seeing as I am only using events to do this, but I was wondering if there was a way to arbitrarily make the damage pop in battle using the Call Script command in the eventing window.  If so, is there a way I can specify which target it shows up on and also specify the number it displays as a certain variable that I set in the RPG Maker's database (not a variable I set in a script)?

Thank you.

winkio

don't know if you want to use this instead or just borrow code from it, but: http://forum.chaos-project.com/index.php?topic=2481.0

samsonite789

I've tried to use that, but it doesn't seem to work.

If I put it below RTAB 1.6 (which I am using) and I go into battle and use the Regen skill, it returns this error:

Script 'Real Time Active Battle' line 2671: NoMethodError occurred.
undefined method 'each' for 686:Fixnum

And when I go into the script editor, it points me to this method:

Spoiler: ShowHide

#--------------------------------------------------------------------------
  # * Remaining HP estimate
  #--------------------------------------------------------------------------
  def rest_hp
    # Substituting reality HP to rest_hp
    rest_hp = @hp
    # All damage which the battler receives is made to reflect on rest_hp
    for pre_damage in @damage
      if pre_damage[1].is_a?(Numeric)
        rest_hp -= pre_damage[1]
      end
    end
    return rest_hp
  end


I'm not sure where 'each' is or what to do about it, really.  So, I tried putting the HoT DoT script above RTAB, and I go into battle and it works, with one strange exception: no matter what I specify in the HoT DoT database, the spell consistently deals about 200 points of damage over time.  I tried changing the positives and negatives, the damage numbers and the type of damage and it always will deal 200 points every turn or so.  I'm thinking that something in RTAB is overriding its functionality partially so that it's getting mixed signals, but I have no idea what to do about it.

Any thoughts?