Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

70 Pages V  < 1 2 3 4 > »   
Reply to this topicStart new topic
> Submission: Blue Magic, by Prexus
Ty
post Aug 21 2007, 11:45 AM
Post #21


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




Punctuation please.

Look at the post above the post that you posted.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Roderick
post Aug 21 2007, 10:59 PM
Post #22


Level 4
Group Icon

Group: Member
Posts: 47
Type: None
RM Skill: Undisclosed




Were do i need to put it?
Go to the top of the page
 
+Quote Post
   
Zeriab
post Nov 12 2007, 06:07 AM
Post #23


Level 12
Group Icon

Group: Revolutionary
Posts: 196
Type: Event Designer
RM Skill: Skilled




Script Page here: http://www.rpgrevolution.com/script/24

I have tried to make a Dialog system which is intended to ease the creation of dialogs.
QUOTE (Dialog system)
CODE
#==============================================================================
# ** Dialog system
#------------------------------------------------------------------------------
# Zeriab
# Version 1.0
# 2007-11-07 (Year-Month-Day)
#------------------------------------------------------------------------------
# * Description :
#
#   A small framework like script for dialogs
#------------------------------------------------------------------------------
# * License :
#
#   Copyright (C) 2007  Zeriab
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Lesser Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Lesser Public License for more details.
#
#   For the full license see <http://www.gnu.org/licenses/>
#   The GNU General Public License: http://www.gnu.org/licenses/gpl.txt
#   The GNU Lesser General Public License: http://www.gnu.org/licenses/lgpl.txt
#------------------------------------------------------------------------------
# * Instructions :
#
#   You can place this script pretty much anyway you like.
#   Place it above any other Dialogs you might be using.
#   Increase the STARTING_Z_VALUE if you have trouble with the dialog not
#   on top.
#==============================================================================
class Dialog
  STARTING_Z_VALUE = 1500 # Default value is 1500
  attr_accessor :value
  attr_writer :marked_to_close
  #--------------------------------------------------------------------------
  # * Getter with 'false' as default value
  #--------------------------------------------------------------------------
  def marked_to_close
    @marked_to_close = false  if @marked_to_close.nil?
    return @marked_to_close
  end
  #--------------------------------------------------------------------------
  # * Initialization
  #--------------------------------------------------------------------------
  def mark_to_close
    self.marked_to_close = true
  end
  #--------------------------------------------------------------------------
  # * Show the dialog
  #   Returns the value from the dialog
  #--------------------------------------------------------------------------
  def self.show(*args, &block)
    dialog = self.new(*args, &block)
    dialog.marked_to_close = false
    return dialog.main
  end
  #--------------------------------------------------------------------------
  # * Initialization
  #--------------------------------------------------------------------------
  def initialize(*args, &block)
    # For subclasses to overwrite
  end
  #--------------------------------------------------------------------------
  # * Main processing
  #--------------------------------------------------------------------------
  def main
    # Create the dimmed background
    create_background
    # Create Windows
    main_window
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if the dialog should close
      if marked_to_close
        break
      end
    end
    # Dispose of windows
    main_dispose
    # Dispose of background
    dispose_background
    # Update input information
    Input.update
    # Returns the acquired value
    return self.value
  end
  #--------------------------------------------------------------------------
  # * Create the dimmed background
  #--------------------------------------------------------------------------
  def create_background
    bitmap = Bitmap.new(640,480)
    bitmap.fill_rect(0,0,640,480,Color.new(0,0,0,128))
    @background_sprite = Sprite.new
    @background_sprite.z = STARTING_Z_VALUE
    @background_sprite.bitmap = bitmap
  end
  #--------------------------------------------------------------------------
  # * Create the windows
  #--------------------------------------------------------------------------
  def main_window
    # For the subclasses to override
    # Remember to set their z.value to at least STARTING_Z_VALUE + 1
  end
  #--------------------------------------------------------------------------
  # * Dispose the background
  #--------------------------------------------------------------------------
  def dispose_background
    @background_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Dispose the windows
  #--------------------------------------------------------------------------
  def main_dispose
    # For the subclasses to override
    # Dispose your windows here
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # For the subclasses to override
    if Input.trigger?(Input::B)
      mark_to_close
    end
  end
end


What is a dialog? You can consider it as a scene that runs on top of the current scene.
Here is an example of how the system can be used. It is a yes/no dialog.
QUOTE (An example - A Yes/No Dialog)
CODE
#============================================================================
# * A Simple Yes/No dialog
#============================================================================
class Dialog_YesNo < Dialog
  # self.value: false = No, true = Yes
  
  #--------------------------------------------------------------------------
  # * A show method
  #--------------------------------------------------------------------------
  def initialize(default_value = false, text = nil)
    # Sets the default value
    self.value = default_value
    @text = text
    # Sets the menu index
    if default_value
      @menu_index = 0
    else
      @menu_index = 1
    end
  end
  #--------------------------------------------------------------------------
  # * Create the windows
  #--------------------------------------------------------------------------
  def main_window
    @disposables = []
    
    # The command window
    @command_window = Window_Command.new(80, ['Yes', 'No'])
    @command_window.index = @menu_index
    @command_window.x = (640 - @command_window.width) / 2
    @command_window.y = (480 - @command_window.height) / 2
    @command_window.z = STARTING_Z_VALUE + 1
    @disposables << @command_window
    
    # The text window
    if @text.is_a?(String)
      @text_window = Window_Help.new
      @text_window.set_text(@text, 1)
      @text_window.z = STARTING_Z_VALUE + 1
      @disposables << @text_window
    end
  end
  #--------------------------------------------------------------------------
  # * Dispose the windows
  #--------------------------------------------------------------------------
  def main_dispose
    @disposables.each {|element| element.dispose}
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    @command_window.update
    if Input.trigger?(Input::B)
      mark_to_close
    end
    if Input.trigger?(Input::C)
      if @command_window.index == 0
        self.value = true
      else
        self.value = false
      end
      mark_to_close
    end
  end
end


The idea is that you can all this dialog anywhere with the code:
CODE
# Code before
var = Dialog_YesNo.show(default_value, text) # Calls the dialog
# Code after

The dialog should then be shown and the code after will only be executed after the player chooses yes or no. It will return false if No is selected and true if Yes is selected.
Then the code placed after the call will be executed. You can say it will freeze execution until the dialog is closed.
The principle is that you can call this code anyway. In script calls as well as in normal scripts.
Here is an example of a script call:
CODE
s = 'Do you want to open the chest?'
v = Dialog_YesNo.show(true, s)
$game_switches[5] = v

Here is an event using this:
QUOTE (Angry Chest)

I assume you know how to make page 2 and page 3 yourself.

I know. This can easily be done with the normal choice system in events. So what about an example where its use is more clear?
Did you know that if you try to save on a slot where there already is a savegame it does not ask if you want to overwrite? It simply just overwrites the savegame. Let us say we don't want that. The remedy?
CODE
class Scene_Save < Scene_File
  alias scene_save_overwrite_dialog_on_decision on_decision
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(filename)
    if File.exist?(filename)
      var = Dialog_YesNo.show(false, 'Do you want to overwrite' +
                                     ' the old savegame?')
      unless var
        $game_system.se_play($data_system.buzzer_se)
        return
      end
    end
    scene_save_overwrite_dialog_on_decision(filename)
  end
end

Just paste this anywhere below the original Scene_Save.


I have tried to give dialogs the feeling of scenes.
When you create a dialog you will in most cases only have to overwrite 3-4 methods:

main_window
You should create the windows you are going to use in this method.
Please set the .z-values of the windows to at least STARTING_Z_VALUE + 1
This is what you put before the main loop when creating a normal scene.
You can consider it pretty much equivalent to the main_window method in the SDK.
Does nothing by default

main_dispose
Dispose of the windows you have created here and do any other clean up you find necessary.
Does nothing by default

update
The update method is pretty much equivalent to the update method in a normal scene.
Exits the scene when you press the B-button by default.

You end the dialog by calling the mark_to_close method. It will then exit just like if you normally change the scene.
Remember to set the value that will be returned. By default is nil returned.
Use self.value = ... to set the value. This value will not be frozen after you use the mark_to_close method, which means that you can change the value after you use that method if it happens later in the update method.

I am certain that I have messed something up or forgotten to tell something important. Please do tell if you run into any problems

*hugs*
- Zeriab

This post has been edited by PK8: Sep 9 2012, 02:51 AM


__________________________
Go to the top of the page
 
+Quote Post
   
deadlydan
post Jan 25 2008, 09:08 PM
Post #24


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




Hi guys, this is a little thing i added for custom fonts, putting it on here for the less knowledgeable people of RGSS.

This basically allows you to load fonts and check if they exist simply put.
  1. Open up the "Main" script, and put the following before the "begin" call.
    CODE
    def FontExist?
      unless Font.exist? ( Font.default_name )
        print "Unable to find #{Font.default_name} font."
        exit
      end
    end

    def FontLoad ( fontname, fontsize )
      Font.default_name = fontname
      Font.default_size = fontsize
      FontExist?
    end

  2. Before the line "$scene = Scene_Title.new" add the following:
    (Replace 15 with the font size you want and replace Comic Sans MS with the name of the font you want to use, for loading fonts from the "Fonts" folder in your project folder without installing it on windows, place the *.ttf file in the "Fonts" folder, and use the name which is stated when you view the font in windows. It is case sensitive by the way.


    CODE
    FontLoad ( "Comic Sans MS", 15 )
No credits needed, thanks smile.gif


__________________________
Go to the top of the page
 
+Quote Post
   
deadlydan
post Jan 31 2008, 08:20 PM
Post #25


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




Hey guys, by request, i changed the little snippet i made for turtleman, added in some checks also to fix some bugs. Here's the code, very simple to use:

CODE
#==============================================================================
# ■ DeadlyDan_MessageSound v2.0 by DeadlyDan
#------------------------------------------------------------------------------
#  Simple "typewriting" style sound when messages are displayed.
#==============================================================================
# Usage:
=begin
  
  Simply change:
  
  MS_SOUND = "Audio/SE/cursor"
  
  To what ever sound file you want, for example:
  
  MS_SOUND = "Audio/SE/cow"
  
  If you want to change how fast it sounds, change
  
  MS_FRAME_INTERVAL = 2
  
  To, for example, if you want longer:
  
  MS_FRAME_INTERVAL = 4

=end

class Window_Message < Window_Selectable
  
  MS_SOUND = "Audio/SE/cursor"
  MS_FRAME_INTERVAL = 2
  
  def update_message
    loop do
      c = @text.slice!(/./m)
      case c
      when nil
        finish_message
        break
      when "\x00"
        new_line
        if @line_count >= MAX_LINE
          unless @text.empty?
            self.pause = true
            break
          end
        end
      when "\x01"
        @text.sub!(/\[([0-9]+)\]/, "")
        contents.font.color = text_color($1.to_i)
        next
      when "\x02"
        @gold_window.refresh
        @gold_window.open
      when "\x03"
        @wait_count = 15
        break
      when "\x04"
        @wait_count = 60
        break
      when "\x05"
        self.pause = true
        break
      when "\x06"
        @line_show_fast = true
      when "\x07"
        @line_show_fast = false
      when "\x08"
        @pause_skip = true
      else
        if ( @line_show_fast == false and @show_fast == false )
          if ( Graphics.frame_count > ( @last_ms_sound_frame.to_i + MS_FRAME_INTERVAL ) )
            Audio.se_play ( MS_SOUND, 100, 100 )
            @last_ms_sound_frame = Graphics.frame_count
          end
        end
        contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
        c_width = contents.text_size(c).width
        @contents_x += c_width
      end
      break unless @show_fast or @line_show_fast
    end
  end
  
end


__________________________
Go to the top of the page
 
+Quote Post
   
jens009
post Jan 31 2008, 08:23 PM
Post #26


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




Good job. ;-] Now it's user friendly.
Might I ask though, you said you fixed some bugs? What would they be?


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
turtleman
post Jan 31 2008, 08:24 PM
Post #27


Level 2
Group Icon

Group: Member
Posts: 23
Type: None
RM Skill: Undisclosed




Yeah, I didn't notice any =P.

By the way, is there a way to prolong to beeb between letters, like 1 beep every other letter or something?
Just wondering.
Go to the top of the page
 
+Quote Post
   
deadlydan
post Jan 31 2008, 08:25 PM
Post #28


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




QUOTE (jens009 @ Jan 31 2008, 07:30 PM) *
Good job. ;-] Now it's user friendly.
Might I ask though, you said you fixed some bugs? What would they be?


Well, if you pressed enter to skip the message writing it would still play an extra few sounds.

QUOTE (turtleman @ Jan 31 2008, 07:31 PM) *
Yeah, I didn't notice any =P.

By the way, is there a way to prolong to beeb between letters, like 1 beep every other letter or something?
Just wondering.


I'll script that in right now, hold on a few mins smile.gif

|EDIT|

Updated, to add the feature you desire smile.gif


__________________________
Go to the top of the page
 
+Quote Post
   
Rory
post Jan 31 2008, 10:33 PM
Post #29


GFX Pro
Group Icon

Group: +Gold Member
Posts: 409
Type: Artist
RM Skill: Skilled




Wow! Nice Script, and amazing idea.


__________________________

THE SAVAGE NYMPH
Note: this is Magdreamer, I'm using my real name for my forum name now.
Go to the top of the page
 
+Quote Post
   
Melkor Qc
post Jan 31 2008, 11:39 PM
Post #30


Level 2
Group Icon

Group: Member
Posts: 17
Type: Artist
RM Skill: Masterful




Great idea for a script, I always liked the sound it makes in Zelda games when you read messages :]


__________________________
~ I am decent
Go to the top of the page
 
+Quote Post
   
Kuplex
post Feb 1 2008, 12:02 PM
Post #31


Level 1
Group Icon

Group: Member
Posts: 10
Type: Event Designer
RM Skill: Skilled




Another nice script, DeadlyDan. smile.gif
Go to the top of the page
 
+Quote Post
   
Nathan
post Feb 1 2008, 12:08 PM
Post #32


Level 1
Group Icon

Group: Member
Posts: 7
Type: Event Designer
RM Skill: Masterful




Can you turn on and off?
:/
Go to the top of the page
 
+Quote Post
   
X-Snake-X
post Feb 1 2008, 01:10 PM
Post #33


Level 6
Group Icon

Group: Member
Posts: 88
Type: Event Designer
RM Skill: Skilled




Great Script as always Dann^^


__________________________

I'm from Germany o.o
Go to the top of the page
 
+Quote Post
   
turtleman
post Feb 1 2008, 01:57 PM
Post #34


Level 2
Group Icon

Group: Member
Posts: 23
Type: None
RM Skill: Undisclosed




Thanks for updating timing in the sound for me. Setting it to 4 or 5 makes it sound perfect!

Again, thankyou, you've been so helpful.
Go to the top of the page
 
+Quote Post
   
Kuplex
post Feb 1 2008, 08:13 PM
Post #35


Level 1
Group Icon

Group: Member
Posts: 10
Type: Event Designer
RM Skill: Skilled




I was inspired by NathanDug's thread to make this simple, but useful script.
It allows you to disable/enable the battle BGM (default is enabled). So your map BGM/BGS will continue uninterrupted into battle. This is useful for key battles where you don't want it change to battle music.

Game_System script
Add the following with the other attr_accessor near the top.
CODE
attr_accessor :battle_bgm_enabled


Directly below, you will see a section called def initialize
Add the following at the end of the others:
CODE
@battle_bgm_enabled = true

If you want it to be disabled by default, change the value to FALSE.

======================

Scene_Map script

This is the original code for def Call_Battle
CODE
def call_battle
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    $game_temp.map_bgm = RPG::BGM.last
    $game_temp.map_bgs = RPG::BGS.last
    RPG::BGM.stop
    RPG::BGS.stop    
    Sound.play_battle_start    
    $game_system.battle_bgm.play
    $game_temp.next_scene = nil
    $scene = Scene_Battle.new
  end


Replace it with this:
CODE
def call_battle
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    $game_temp.map_bgm = RPG::BGM.last
    $game_temp.map_bgs = RPG::BGS.last
    
    if $game_system.battle_bgm_enabled
      RPG::BGM.stop
      RPG::BGS.stop    
      Sound.play_battle_start    
      $game_system.battle_bgm.play
    end
    
    $game_temp.next_scene = nil
    $scene = Scene_Battle.new
  end


======================

Scene Battle script

This is the original code for def process_victory:
CODE
def process_victory
    @info_viewport.visible = false
    @message_window.visible = true    
    RPG::BGM.stop
    $game_system.battle_end_me.play    
    unless $BTEST
      $game_temp.map_bgm.play
      $game_temp.map_bgs.play
    end
    display_exp_and_gold
    display_drop_items
    display_level_up
    battle_end(0)
  end


Replace it with this:
CODE
def process_victory
    @info_viewport.visible = false
    @message_window.visible = true
    
    if $game_system.battle_bgm_enabled
      RPG::BGM.stop
      $game_system.battle_end_me.play
    end
    
    unless $BTEST
      $game_temp.map_bgm.play
      $game_temp.map_bgs.play
    end
    display_exp_and_gold
    display_drop_items
    display_level_up
    battle_end(0)
  end


======================

To use this, just create an event script call and use the following line:
CODE
$game_system.battle_bgm_enabled = true/false



If anyone has an easier way to implement this or critique, you're more than welcome. I'm still new to RGSS2. wink.gif

This post has been edited by Kuplex: Feb 1 2008, 08:17 PM
Go to the top of the page
 
+Quote Post
   
Rory
post Feb 1 2008, 09:08 PM
Post #36


GFX Pro
Group Icon

Group: +Gold Member
Posts: 409
Type: Artist
RM Skill: Skilled




I made a new "Click" sound which fits perfectly.


__________________________

THE SAVAGE NYMPH
Note: this is Magdreamer, I'm using my real name for my forum name now.
Go to the top of the page
 
+Quote Post
   
SeeYouAlways
post Feb 1 2008, 10:46 PM
Post #37


Demented Moogle
Group Icon

Group: Banned
Posts: 1,130
Type: None
RM Skill: Undisclosed




Share? biggrin.gif


__________________________
Go to the top of the page
 
+Quote Post
   
Rory
post Feb 2 2008, 12:50 AM
Post #38


GFX Pro
Group Icon

Group: +Gold Member
Posts: 409
Type: Artist
RM Skill: Skilled




Okay, its not that fancy, just sounds like words are coming out. smile.gif



Try using intervals of 1 or 2, it sounds cool


__________________________

THE SAVAGE NYMPH
Note: this is Magdreamer, I'm using my real name for my forum name now.
Go to the top of the page
 
+Quote Post
   
neclords
post Feb 2 2008, 07:03 PM
Post #39


Love me! I wanna you to love me!
Group Icon

Group: Revolutionary
Posts: 196
Type: Event Designer
RM Skill: Beginner




Great!!


__________________________

~Time To sWallow tHe Pain and VaniSH OuR HuRt~
Go to the top of the page
 
+Quote Post
   
user3k
post Feb 2 2008, 07:49 PM
Post #40


Level 2
Group Icon

Group: Member
Posts: 19
Type: None
RM Skill: Undisclosed




thanks
Go to the top of the page
 
+Quote Post
   

70 Pages V  < 1 2 3 4 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 17th June 2013 - 10:51 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker