Ocarina :)

Started by Tazero, December 15, 2008, 03:54:17 am

Previous topic - Next topic

Tazero

December 15, 2008, 03:54:17 am Last Edit: January 04, 2009, 07:46:08 am by MetaKnight
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


If you were a fish...

Blizzard

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. >.<
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.

Tazero

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 ;)


If you were a fish...

Fantasist

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
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Tazero

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 ;)


If you were a fish...

Calintz

This is an awesome ass script, Lol...
I have always been a huge fan of the Zelda franchise.

G_G

Compatible with BABS? Does it allow you call or summon pets/monsters when a song is played if it is BABS compatible?

Blizzard

You could make it so a song forces the use of a skill for the actor to summon something.
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.

Calintz

That would be pretty neat actually!!

Tazero

@gameguy: I didnt thnk of that Holy.....Shit.........I gots a song stuck in my head "Jesus is my homeboy"


If you were a fish...

Leetfaction

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! :)

Boba Fett Link

I would like the images too, if that could be possible...
This post will self-destruct in 30 seconds.

GAX

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.

Rule 2: ShowHide
Quote from: Rule No.2Keep your signatures at reasonable size. The pictures in your signature may altogether be no more than 200kB and take up an area of 1600px2. That means 2 pictures of 400x200 are fine, one picture of 800x200 is fine and so on. Also your pictures height must not exceed 200 pixels, width can be as big as you want as long as your pictures match the other criteria. Every signature not matching this criteria is a subject of the moderator team to remove and leave this rule as message in your signature.

WhiteRose

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.

TJ01

The demo is down, but it sounds awesome, really epic :bow:
Great that you "found" it.

Spaceman McConaughey

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?

JellalFerd

Well, I made a quick place holder graphic since the demo's down.
Spoiler: ShowHide



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.
QuoteFrank says:
But obviously they put on that shirt on in the morning.
Hmmm..
Booty shirts are nice.
Depends on the girl.
Jellal says:
booty shirts
lolwut

Boba Fett Link

This post will self-destruct in 30 seconds.