Chaos Project

RPG Maker => RPG Maker Scripts => Topic started by: Tazero on December 15, 2008, 03:54:17 am

Title: Ocarina :)
Post by: Tazero on December 15, 2008, 03:54:17 am
NOT MADE BY ME


found on RMXP.org from google search it might be usefull so i brought it here :)



You have to play the notes acording to the songs. This can be like a "challenge" in an adventure game, or for summoning monsters. I'M PROVIDING THE IMAGES WITH THE DEMO
It's an ocarina Script, like the one in Zelda games.
here it goes:
Call the script using: $scene = Ocarina.new

i ended up editing all the script so, yay credits!. :P
Scripts: ShowHide


Script
Code: Script

#============================================================================
# ** Ocarina System (Revised)
#----------------------------------------------------------------------------
# Rudy_Guillan : RENEGADEOFBMX : vpcdmd
# 2.0
# 2/16/2008
#---
# ~ Originally Created by                 : Rudy_Guillan
# ~ Edited by                             : RENEGADEOFBMX
# ~ Revised and Rewrite by                : vpcdmd
#============================================================================

#----------------------------------------------------------------------------
# ** Game_System
#----------------------------------------------------------------------------

class Game_System
  attr_reader :ocarina, :ocarina_down, :ocarina_right, :ocarina_up, :ocarina_left
  alias tsu_ocarina_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @ocarina = []
    #------------------------------------------------------------------------
    @ocarina_down = "001-System01"
    @ocarina_left = "002-System02"
    @ocarina_right = "003-System03"
    @ocarina_up = "004-System04"
    #------------------------------------------------------------------------
    @ocarina[0] = []
    @ocarina[0][0] = 4
    @ocarina[0][1] = 4
    @ocarina[0][2] = 6
    @ocarina[0][3] = 6
    @ocarina[0][4] = 2
    @ocarina[0][5] = 2
    @ocarina[0][6] = "Bolero of fire"
    @ocarina[0][7] = Color.new(0, 255, 0)
    @ocarina[0][8] = "023-Dive03"
    @ocarina[0][9] = 1
    #------------------------------------------------------------------------
    @ocarina[1] = []
    @ocarina[1][0] = 8
    @ocarina[1][1] = 2
    @ocarina[1][2] = 2
    @ocarina[1][3] = 8
    @ocarina[1][4] = 2
    @ocarina[1][5] = 2
    @ocarina[1][6] = "Canción del fuego"
    @ocarina[1][7] = Color.new(255, 0, 0)
    @ocarina[1][8] = "023-Dive03"
    @ocarina[1][9] = 47
    #------------------------------------------------------------------------
    @ocarina[2] = []
    @ocarina[2][0] = 2
    @ocarina[2][1] = 2
    @ocarina[2][2] = 8
    @ocarina[2][3] = 8
    @ocarina[2][4] = 8
    @ocarina[2][5] = 2
    @ocarina[2][6] = 2
    @ocarina[2][7] = "Bolero with seven"
    @ocarina[2][8] = Color.new(0, 0, 255)
    @ocarina[2][9] = "060-Cheer01"
    @ocarina[2][10] = 2
    #------------------------------------------------------------------------
    @ocarina[3] = []
    @ocarina[3][0] = 2
    @ocarina[3][1] = 8
    @ocarina[3][2] = 2
    @ocarina[3][3] = 8
    @ocarina[3][7] = "Small with four"
    @ocarina[3][8] = Color.new(0, 255, 255)
    @ocarina[3][9] = "022-Dive02"
    @ocarina[3][10] = 3
    #------------------------------------------------------------------------
    tsu_ocarina_initialize
  end
end
#----------------------------------------------------------------------------
# ** Scene_Ocarina
#----------------------------------------------------------------------------

class Ocarina
  #--------------------------------------------------------------------------
  # * Main
  #--------------------------------------------------------------------------
  def main
    @spriteset = Spriteset_Map.new
    @ocarina_window = Window_Ocarina.new
    @back = Sprite.new
    @back.bitmap = RPG::Cache.picture("pentagrama")
    @back.x = 40
    @back.y = 360
    @back.opacity = 160
    @arrow = []
    @max_notes = 0
    for i in 0...$game_system.ocarina.size
      size = $game_system.ocarina[i].size - 4
      @max_notes = size > @max_notes ? size : @max_notes
    end
    for i in 1..@max_notes
      @arrow[i] = Sprite.new
      @arrow[i].bitmap = RPG::Cache.picture("arrow")
      @arrow[i].ox = @arrow[i].bitmap.width / 2
      @arrow[i].oy = @arrow[i].bitmap.height / 2
      @arrow[i].opacity = 0
    end
    @song = []
    @correct = false
    @counter = 0
    @objects = [@spriteset, @back, @ocarina_window]
    Graphics.transition
    while $scene == self
      Graphics.update
      Input.update
      @objects.each {|x| x.update}
      update
    end
    Graphics.freeze
    @objects.each {|object| object.dispose}
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if @correct
      if @counter == 0
        @ocarina_window.set_text(@i)
        se = $game_system.ocarina[@i].size - 2
        Audio.se_play("Audio/SE/" + $game_system.ocarina[@i][se], 80, 100)
        for i in 1..@max_notes
          @arrow[i].opacity = 255
        end
        switch = $game_system.ocarina[@i].size - 1
        $game_switches[$game_system.ocarina[@i][switch]] = true
      end
      @counter += 1
      if @counter >= 200
        $scene = Scene_Map.new
        $game_map.autoplay
        $game_map.refresh
      end
    else
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
        return
      end
      for @i in 0...$game_system.ocarina.size
        correct = true
        for j in 0...$game_system.ocarina[@i].size - 4
          if @song[j] != $game_system.ocarina[@i][j]
            correct = false
          end
        end
        if correct == true
          @correct = true
          break
        end
      end
      if @song.size >= @max_notes  && @correct == false
        @counter += 1
        if @counter >= 80
          $scene = Scene_Map.new
        end
      end
      if Input.trigger?(Input::DOWN) && @song.size < @max_notes
        Audio.se_play("Audio/SE/" + $game_system.ocarina_down, 80, 100)
        @song.push(2)
        for i in 1..@song.size
          if i == @song.size
            @arrow[i].angle = 180
            @arrow[i].opacity = 160
            @arrow[i].x = 80 + ((400/(@max_notes-1)) * i)
            @arrow[i].y = 440
          end
        end
      end
      if Input.trigger?(Input::LEFT) && @song.size < @max_notes
        Audio.se_play("Audio/SE/" + $game_system.ocarina_left, 80, 100)
        @song.push(4)
        for i in 1..@song.size
          if i == @song.size
            @arrow[i].angle = 90
            @arrow[i].opacity = 160
            @arrow[i].x = 80 + ((400/(@max_notes-1)) * i)
            @arrow[i].y = 420
          end
        end
      end
      if Input.trigger?(Input::RIGHT) && @song.size < @max_notes
        Audio.se_play("Audio/SE/" + $game_system.ocarina_right, 80, 100)
        @song.push(6)
        for i in 1..@song.size
          if i == @song.size
            @arrow[i].angle = 270
            @arrow[i].opacity = 160
            @arrow[i].x = 80 + ((400/(@max_notes-1)) * i)
            @arrow[i].y = 400
          end
        end
      end
      if Input.trigger?(Input::UP) && @song.size < @max_notes
        Audio.se_play("Audio/SE/" + $game_system.ocarina_up, 80, 100)
        @song.push(8)
        for i in 1..@song.size
          if i == @song.size
            @arrow[i].opacity = 160
            @arrow[i].x = 80 + ((400/(@max_notes-1)) * i)
            @arrow[i].y = 380
          end
        end
      end
    end
  end
end
#--------------------------------------------------------------------------
# ** Window_Ocarina
#--------------------------------------------------------------------------

class Window_Ocarina < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 280, 640, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @song = []
    @correct = false
    @counter = 0
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  def set_text(index)
    col = $game_system.ocarina[index].size - 3
    text = $game_system.ocarina[index].size - 4
    self.contents.font.color = $game_system.ocarina[index][col]
    self.contents.draw_text(0, 0, 618, 48, $game_system.ocarina[index][text], 1)
  end
end


DEMO 
http://www.savefile.com/files/1384925

@jbrist:

Cutomization

paste the script above main, and edit this part:


Code: Sounds
    @ocarina_down = "001-System01"
    @ocarina_left = "002-System02"
    @ocarina_right = "003-System03"
    @ocarina_up = "004-System04"



    @ocarina[i] = []Array number
    @ocarina[i][0] = direction (2 = down, 4 = left, 6 = right, 8 = up)
    @ocarina[i][1] = direction (2 = down, 4 = left, 6 = right, 8 = up)
    @ocarina[i][2] = direction (2 = down, 4 = left, 6 = right, 8 = up)
    @ocarina[i][3] = direction (2 = down, 4 = left, 6 = right, 8 = up)
    @ocarina[i][4] = direction (2 = down, 4 = left, 6 = right, 8 = up)
    @ocarina[i][5] = direction (2 = down, 4 = left, 6 = right, 8 = up)
    @ocarina[i][6] = Name_of_song
    @ocarina[i][7] = Color_of_song_name
    @ocarina[i][8] = Song's sound file (SE)
    @ocarina[i][9] = Switch that activates when the song is player correctly.

ç

copy this to add songs
Title: Re: Ocarina :)
Post by: Blizzard on December 15, 2008, 04:57:04 am
Hm... Did the author allow you to post this here? I know how RMXP.org-ers act sometimes, you better have the permission from him/her if you don't wanna get in trouble. >.< Don't get me wrong, I have nothing against this, but the author might. >.<
Title: Re: Ocarina :)
Post by: Tazero on December 15, 2008, 05:01:50 am
The authors not on rmxp it was revised and reposted without rights and it has no rights seeing as any scripter could do this with the proper coding Hell i could take credit and the real guy couldnt do anything about it ;)
Title: Re: Ocarina :)
Post by: Fantasist on December 15, 2008, 07:36:16 am
QuoteHell i could take credit and the real guy couldnt do anything about it

I know you wouldn't do that, but don't really count on it mate :P
Title: Re: Ocarina :)
Post by: Tazero on December 17, 2008, 04:09:29 pm
Quote from: Fantasist on December 15, 2008, 07:36:16 am
QuoteHell i could take credit and the real guy couldnt do anything about it

I know you wouldn't do that, but don't really count on it mate :P

Ayy Anywayz im just using a simple system and decided to post no i don't take cred for things i don't do ;)
Title: Re: Ocarina :)
Post by: Calintz on January 11, 2009, 01:49:30 pm
This is an awesome ass script, Lol...
I have always been a huge fan of the Zelda franchise.
Title: Re: Ocarina :)
Post by: G_G on January 21, 2009, 08:18:58 pm
Compatible with BABS? Does it allow you call or summon pets/monsters when a song is played if it is BABS compatible?
Title: Re: Ocarina :)
Post by: Blizzard on January 22, 2009, 07:11:47 am
You could make it so a song forces the use of a skill for the actor to summon something.
Title: Re: Ocarina :)
Post by: Calintz on January 22, 2009, 05:00:47 pm
That would be pretty neat actually!!
Title: Re: Ocarina :)
Post by: Tazero on January 23, 2009, 03:52:31 am
@gameguy: I didnt thnk of that Holy.....Shit.........I gots a song stuck in my head "Jesus is my homeboy"
Title: Re: Ocarina :)
Post by: Leetfaction on August 10, 2010, 06:04:33 pm
Sorry if I bumped this thread but I need the pictures for the script. The demo link is broken so I can't download it. If anyone has it please tell me and put them up, thanks! :)
Title: Re: Ocarina :)
Post by: Boba Fett Link on May 04, 2011, 03:52:51 pm
I would like the images too, if that could be possible...
Title: Re: Ocarina :)
Post by: GAX on May 05, 2011, 01:10:40 am
fucking Necrophiles always show up at this time of night...

Last post was over a year ago, please be sure to look at the last post date.
Title: Re: Ocarina :)
Post by: WhiteRose on May 05, 2011, 03:15:59 am
Quote from: The One and Only GAX72 on May 05, 2011, 01:10:40 am
fucking Necrophiles always show up at this time of night...

Last post was over a year ago, please be sure to look at the last post date.


To be fair, his question was relevant to the topic.
Title: Re: Ocarina :)
Post by: TJ01 on May 05, 2011, 01:52:40 pm
The demo is down, but it sounds awesome, really epic :bow:
Great that you "found" it.
Title: Re: Ocarina :)
Post by: Spaceman McConaughey on May 05, 2011, 02:21:49 pm
Quote from: WhiteRose on May 05, 2011, 03:15:59 am
Quote from: The One and Only GAX72 on May 05, 2011, 01:10:40 am
fucking Necrophiles always show up at this time of night...

Last post was over a year ago, please be sure to look at the last post date.


To be fair, his question was relevant to the topic.


I thought he was supposed to submit something useful?
Title: Re: Ocarina :)
Post by: JellalFerd on May 08, 2011, 04:33:54 am
Well, I made a quick place holder graphic since the demo's down.
Spoiler: ShowHide
(http://img543.imageshack.us/img543/8321/arrowc.png)
(http://img834.imageshack.us/img834/1667/backxj.png)


But, I modified the script's positions to work with these graphics, so I'll post that here too.
Spoiler: ShowHide
#============================================================================
# ** Ocarina System (Revised)
#----------------------------------------------------------------------------
# Rudy_Guillan : RENEGADEOFBMX : vpcdmd
# 2.0
# 2/16/2008
#---
# ~ Originally Created by                 : Rudy_Guillan
# ~ Edited by                             : RENEGADEOFBMX
# ~ Revised and Rewrite by                : vpcdmd
#============================================================================

#----------------------------------------------------------------------------
# ** Game_System
#----------------------------------------------------------------------------

class Game_System
  attr_reader :ocarina, :ocarina_down, :ocarina_right, :ocarina_up, :ocarina_left
  alias tsu_ocarina_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @ocarina = []
    #------------------------------------------------------------------------
    @ocarina_down = "001-System01"
    @ocarina_left = "002-System02"
    @ocarina_right = "003-System03"
    @ocarina_up = "004-System04"
    #------------------------------------------------------------------------
    @ocarina[0] = []
    @ocarina[0][0] = 2
    @ocarina[0][1] = 2
    @ocarina[0][2] = 2
    @ocarina[0][3] = 2
    @ocarina[0][4] = 2
    @ocarina[0][5] = 2
    @ocarina[0][6] = "Bolero of fire"
    @ocarina[0][7] = Color.new(0, 255, 0)
    @ocarina[0][8] = "001-Victory01"
    @ocarina[0][9] = 1
    #------------------------------------------------------------------------
    @ocarina[1] = []
    @ocarina[1][0] = 8
    @ocarina[1][1] = 6
    @ocarina[1][2] = 2
    @ocarina[1][3] = 4
    @ocarina[1][4] = 8
    @ocarina[1][5] = 6
    @ocarina[1][6] = 2
    @ocarina[1][7] = "Song of Night"
    @ocarina[1][8] = Color.new(0, 0, 255)
    @ocarina[1][9] = "002-Victory02"
    @ocarina[1][10] = 2
    #------------------------------------------------------------------------
    @ocarina[2] = []
    @ocarina[2][0] = 2
    @ocarina[2][1] = 6
    @ocarina[2][2] = 8
    @ocarina[2][3] = 4
    @ocarina[2][4] = 2
    @ocarina[2][5] = 6
    @ocarina[2][6] = 8
    @ocarina[2][7] = "Song of Day"
    @ocarina[2][8] = Color.new(0, 0, 255)
    @ocarina[2][9] = "002-Victory02"
    @ocarina[2][10] = 3
    #------------------------------------------------------------------------
    @ocarina[3] = []
    @ocarina[3][0] = 8
    @ocarina[3][1] = 2
    @ocarina[3][2] = 8
    @ocarina[3][3] = 2
    @ocarina[3][7] = "Song of Misery"
    @ocarina[3][8] = Color.new(0, 255, 255)
    @ocarina[3][9] = "015-Mystery01"
    @ocarina[3][10] = 4
    #------------------------------------------------------------------------
    @ocarina[2] = []
    @ocarina[2][0] = 8
    @ocarina[2][1] = 6
    @ocarina[2][2] = 2
    @ocarina[2][3] = 4
    @ocarina[2][4] = 2
    @ocarina[2][5] = 6
    @ocarina[2][6] = 2
    @ocarina[2][7] = 4
    @ocarina[2][8] = "Song of Rain"
    @ocarina[2][9] = Color.new(0, 0, 255)
    @ocarina[2][10] = "010-Item01"
    @ocarina[2][11] = 6
    #---------------------------------------------------------------------------
     tsu_ocarina_initialize
  end
end
#----------------------------------------------------------------------------
# ** Scene_Ocarina
#----------------------------------------------------------------------------

class Ocarina
  #--------------------------------------------------------------------------
  # * Main
  #--------------------------------------------------------------------------
  def main
    @spriteset = Spriteset_Map.new
    @ocarina_window = Window_Ocarina.new
    @back = Sprite.new
    @back.bitmap = RPG::Cache.picture("back")
    @back.x = 0
    @back.y = 0
    @back.opacity = 255
    @arrow = []
    @max_notes = 0
    for i in 0...$game_system.ocarina.size
      size = $game_system.ocarina[i].size - 4
      @max_notes = size > @max_notes ? size : @max_notes
    end
    for i in 1..@max_notes
      @arrow[i] = Sprite.new
      @arrow[i].bitmap = RPG::Cache.picture("arrow")
      @arrow[i].ox = @arrow[i].bitmap.width / 2
      @arrow[i].oy = @arrow[i].bitmap.height / 2
      @arrow[i].opacity = 0
    end
    @song = []
    @correct = false
    @counter = 0
    @objects = [@spriteset, @back, @ocarina_window]
    Graphics.transition
    while $scene == self
      Graphics.update
      Input.update
      @objects.each {|x| x.update}
      update
    end
    Graphics.freeze
    @objects.each {|object| object.dispose}
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if @correct
      if @counter == 0
        @ocarina_window.set_text(@i)
        se = $game_system.ocarina[@i].size - 2
        Audio.me_play("Audio/ME/" + $game_system.ocarina[@i][se], 80, 100)
        for i in 1..@max_notes
          @arrow[i].opacity = 255
        end
        switch = $game_system.ocarina[@i].size - 1
        $game_switches[$game_system.ocarina[@i][switch]] = true
      end
      @counter += 1
      if @counter >= 200
        $scene = Scene_Map.new
        $game_map.autoplay
        $game_map.refresh
      end
    else
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
        return
      end
      for @i in 0...$game_system.ocarina.size
        correct = true
        for j in 0...$game_system.ocarina[@i].size - 4
          if @song[j] != $game_system.ocarina[@i][j]
            correct = false
          end
        end
        if correct == true
          @correct = true
          break
        end
      end
      if @song.size >= @max_notes  && @correct == false
        @counter += 1
        if @counter >= 80
          $scene = Scene_Map.new
        end
      end
      if Input.trigger?(Input::DOWN) && @song.size < @max_notes
        Audio.se_play("Audio/SE/" + $game_system.ocarina_down, 80, 100)
        @song.push(2)
        for i in 1..@song.size
          if i == @song.size
            @arrow[i].angle = 180
            @arrow[i].opacity = 160
            @arrow[i].x = 80 + ((400/(@max_notes-1)) * i)
            @arrow[i].y = 440
          end
        end
      end
      if Input.trigger?(Input::LEFT) && @song.size < @max_notes
        Audio.se_play("Audio/SE/" + $game_system.ocarina_left, 80, 100)
        @song.push(4)
        for i in 1..@song.size
          if i == @song.size
            @arrow[i].angle = 90
            @arrow[i].opacity = 160
            @arrow[i].x = 80 + ((400/(@max_notes-1)) * i)
            @arrow[i].y = 400
          end
        end
      end
      if Input.trigger?(Input::RIGHT) && @song.size < @max_notes
        Audio.se_play("Audio/SE/" + $game_system.ocarina_right, 80, 100)
        @song.push(6)
        for i in 1..@song.size
          if i == @song.size
            @arrow[i].angle = 270
            @arrow[i].opacity = 160
            @arrow[i].x = 80 + ((400/(@max_notes-1)) * i)
            @arrow[i].y = 372
          end
        end
      end
      if Input.trigger?(Input::UP) && @song.size < @max_notes
        Audio.se_play("Audio/SE/" + $game_system.ocarina_up, 80, 100)
        @song.push(8)
        for i in 1..@song.size
          if i == @song.size
            @arrow[i].opacity = 160
            @arrow[i].x = 80 + ((400/(@max_notes-1)) * i)
            @arrow[i].y = 339
          end
        end
      end
    end
  end
end
#--------------------------------------------------------------------------
# ** Window_Ocarina
#--------------------------------------------------------------------------

class Window_Ocarina < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 280, 640, 80)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @song = []
    @correct = false
    @counter = 0
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  def set_text(index)
    col = $game_system.ocarina[index].size - 3
    text = $game_system.ocarina[index].size - 4
    self.contents.font.color = $game_system.ocarina[index][col]
    self.contents.draw_text(0, 0, 618, 48, $game_system.ocarina[index][text], 1)
  end
end

Btw, I changed it to playing a ME instead of a SE, too, just to note that.
Title: Re: Ocarina :)
Post by: Boba Fett Link on June 26, 2011, 12:52:51 pm
Thanks.