• Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Rgss Tutorial - basics

Blizzy

me = Scripter.new("Noob")
  • 492
    Posts
    20
    Years
    ok, i've made another toturial:
    read it carefully...

    RGSS Toturial [Basics]

    ● Drawing a picture on screen:
    Code:
      @image = Sprite.new
      @imate.bitmap = RPG::Cache.picture("name of picture")
    You can give @image any other name you could think of,
    but it needs to start with @.
    This will draw a picture at x 0 and y 0,
    To set the co?rdinates of the x & y: (you can use any number)
    Code:
      @image.x = 100
      @image.y = 100
    To set a layer, use:
    Code:
      @image.z = 100 # 1 - 9999+.
    to move pictures, use .ox and .oy
    example:
    Code:
      @image.ox += 1 or -= 1
      @image.oy += 1 or -= 1

    ● Drawing text on Screen
    To draw text, you'll need to have the following in "def initialize"
    Code:
      self.contents = Bitmap.new(width - 32, height - 32)
    If you don't have this in the method, no text will be draw on screen.
    to set text, use the following line:
    Code:
      self.contents.draw_text(x,y,width,height, "text")
    x is the x-co?rdinate of the text
    y is the y-co?rdinate of the text
    width is the lengt of the text
    height is the height of the text
    the width & height is the same as the size of the font!
    example:
    "this is text", if width is "8"
    it'll display something like this:
    "this i" and the rest is invisible

    ● Switches
    to modify switches, you*ll need to do:
    Code:
        $game_switches[ID] = flag value
    ID is the number of the switch
    flag value is: true or false (on/off)

    ● Variables
    to modify variables:
    Code:
        $game_variables[ID] = number
    ID is the number of the variable
    you can do the following with variable:
    set equal: =
    add : +=
    substract: -=
    multiply : *=
    divide : /=
    there are more, but the're not hard to find

    you can also store text in variables!
    example:
    Code:
    $game_variables[1] = "look! text"
    to test it, use this in a call script:
    Code:
    print $game_variables[1].to_s

    ● Local_Switches
    to modify local_switches:
    Code:
        $game_self_switches = {[MapID, EventID, "LOCAL-SWITCH"] => flag value} 
        $game_map.need_refresh = true

    MapID is the ID of the map
    ID is the event ID
    "Local-Switch" is "a,b,c or d"
    flag value is true or false
    after each local switch modify, you'll need to refresh the map:
    Code:
        $game_map.need_refresh = true

    this is it for now.
    i might do some more toturials about rgss.
    if you have any ideas for next toturials plz post them.

    comments & questions are welcome
     
    Last edited:
    Great!!!
    And with ox and oy, will the pic show the moving animation?
    100/10 !
     
    it should, but for some reason, it doesn't work for me...very strange

    ah, i know the problem, stupid me...it's:
    Code:
      @image.ox += 1
      @image.oy -= 1

    i'll edit it in the toturial now
     
    Really good tutorial! (though I already knew about 40% of it) This tutorial should help many people out :)
     
    I knew some of it but most of it is new to me! Nice work virtual! Can't wait to see more of your tutorials!
     
    i'm not good in spelling :sleeping: , english isn't my first language you know :P
    anyway, like i said at the end of the toturial...
    does anybody have any idea's for next toturials
    (not sure if i'm gonna do some more)
     
    Very good tutorial but I have one question. Is there a way to make a window like the message window and put it right above the message window? I want to use faces in my game but Enterbrain took out the show face feature.
     
    Great work Virtual, I tried to do Dubalex's tutorial but I couldn't concentrate on the 2nd tutorial for long enough to learn much :(
    Perhaps you will go a bit more in-depth for your next tutorial :D
     
    Krazy_Meerkat said:
    Great work Virtual, I tried to do Dubalex's tutorial but I couldn't concentrate on the 2nd tutorial for long enough to learn much :(
    Perhaps you will go a bit more in-depth for your next tutorial :D
    i guess i could go more in-depth next time,
    but this is only explaining basic syntax
     
    Back
    Top