collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: Footsteps by DeadlyDan Frage  (Gelesen 957 mal)

Offline Valentine

  • Eventmeister
  • ***
  • Beiträge: 352
Footsteps by DeadlyDan Frage
« am: November 29, 2011, 16:00:02 »
Moinsen!

Ich nutze ein Footsteps Script und weiß nicht wie
man dort für bestimmte Flächen Sounds einstellen
kann.

Habe mir das Script angeschaut und es soll eben auch
für Custom Sounds funktionieren.
Nur ich werd da nicht schlau draus, wie ich das machen soll.

Hier ist das Script:

Spoiler for Hiden:
#==============================================================================
# ■ DeadlyDan_Footsteps by DeadlyDan
#------------------------------------------------------------------------------
#  Enables ability to "sound" footsteps when walking over specific tiles
#==============================================================================
# Usage:
=begin
 
  Simple, place the audio files in your SE directory, and try the game.
 
  There are some known bugs in this, if anyone has any fixes just let me know:)
 
  To add custom sounds for custom tiles you can do for example:
 
  FOOTSTEP_WOOD = [15] # The tilenumber ID that you get with debug_tileid function
  FOOTSTEP_WOOD_FILE = "Audio/SE/stepwood" # The filename for the sound
 
  then add underneath the # Insert custom sounds here line:
 
  footstep_check ( FOOTSTEP_WOOD, FOOTSTEP_WOOD_FILE, 0 )
 
  The last number in that function stands for the layer, since the wood tile i
  selected is on the ground layer, it's layer is 0. 
 
  (NOTE)
  There is a problem that when you go on carpet it makes dirt and snow sounds,
  i currently can't find a way to fix this, so, the best thing to do is to call
  the command $game_player.footsteps_enabled = false.
 
  To enable footsteps while stopping the carpet and tables from making the snow
  and dirt sounds, there's an uneasy solution of placing a touch event which
  calls $game_player.footsteps_enabled = false.
 
  Sorry about this inconvenience.

=end

class Game_Player < Game_Character
 
  FOOTSTEP_GRASS = [28, 29, 30]
  FOOTSTEP_GRASS_LONG = [29, 30]
  FOOTSTEP_GRASS_FILE = "Audio/SE/stepgrass"
 
  FOOTSTEP_DIRT = [32, 33, 34]
  FOOTSTEP_DIRT_LONG = [32 ,34]
  FOOTSTEP_DIRT_FILE = "Audio/SE/stepdirt"
 
  FOOTSTEP_SAND = [36, 37, 38]
  FOOTSTEP_SAND_LONG = [36, 38]
  FOOTSTEP_SAND_FILE = "Audio/SE/stepdirt"
 
  FOOTSTEP_SNOW = [39, 41]
  FOOTSTEP_SNOW_LONG = [40, 41]
  FOOTSTEP_SNOW_FILE = "Audio/SE/stepsnow"
 
  FOOTSTEP_WOOD = [15]
  FOOTSTEP_WOOD_FILE = "Audio/SE/stepwood"
 
  FOOTSTEP_PITCH = 100
  FOOTSTEP_PITCH2 = 90

  attr_accessor :last_foot
  attr_accessor :footsteps_enabled
 
  alias foot_initialize initialize
  def initialize
    foot_initialize
    @last_foot = 0
    @last_foot_pitch = FOOTSTEP_PITCH2
    @next_foot_pitch = FOOTSTEP_PITCH
    @footsteps_enabled = true
  end
 
  alias foot_move_left move_left
  def move_left ( turn_ok = true )
    foot_move_left ( turn_ok )
    if ( @move_failed == false )
      sound_foot
    end
  end
   
  alias foot_move_right move_right
  def move_right ( turn_ok = true )
    foot_move_right ( turn_ok )
    if ( @move_failed == false )
      sound_foot
    end
  end
 
  alias foot_move_up move_up
  def move_up ( turn_ok = true )
    foot_move_up ( turn_ok )
    if ( @move_failed == false and @footsteps_enabled )
      sound_foot
    end
  end
 
  alias foot_move_down move_down
  def move_down ( turn_ok = true )
    foot_move_down ( turn_ok )
    if ( @move_failed == false and @footsteps_enabled )
      sound_foot
    end
  end
 
  def no_layer_tile? ( layer )
    result = [false, false, false]
    for i in 0..2
      if ( @map_tile_id == 0 )
        result = true
      end
    end
    if ( layer == 0 )   
      if ( result[1] and result[2] )
        return true
      else
        return false
      end
    end
    else if ( layer == 1 )
      if ( result[2] )
        return true
      else
        return false
      end
    else
      return true
    end
  end
 
  def debug_tileid
    $game_message.texts[0] = @map_tile_tex[0]
    $game_message.texts[1] = @map_tile_tex[1]
    $game_message.texts[2] = @map_tile_tex[2]
  end
 
  def footstep_check ( footstep, file, layer )
    for i in 0..footstep.length
      if ( ( @map_tile_tex[layer] == footstep.to_s ) and ( no_layer_tile? ( layer ) ) )
        Audio.se_play ( file, 90, @next_foot_pitch )
        @last_foot = Graphics.frame_count
        return nil
      end
    end
  end
 
  def sound_foot
    if ( dash? )
      mul = 6
    else
      mul = 7
    end
    if ( Graphics.frame_count > ( @last_foot + mul ) )
      @map_tile_id = []
      @map_tile_tex = []
      for i in 0..2
        @map_tile_id.push ( $game_map.data[@x, @y, i] )
        @map_tile_tex.push ( @map_tile_id.to_s[0,2] )
      end
     
      # Use "debug_tileid" here to bring up the numbers of all the current tiles
      # to use with definitions of the tileids, walk over tiles ingame...
     
      if ( @last_foot_pitch == FOOTSTEP_PITCH )
        @next_foot_pitch = FOOTSTEP_PITCH2
        @last_foot_pitch = FOOTSTEP_PITCH2
      else
        @next_foot_pitch = FOOTSTEP_PITCH
        @last_foot_pitch = FOOTSTEP_PITCH
      end
     
      # Ground layer
      footstep_check ( FOOTSTEP_GRASS, FOOTSTEP_GRASS_FILE, 0 )
      footstep_check ( FOOTSTEP_DIRT, FOOTSTEP_DIRT_FILE, 0 )
      footstep_check ( FOOTSTEP_SAND, FOOTSTEP_SAND_FILE, 0 )
      footstep_check ( FOOTSTEP_SNOW, FOOTSTEP_SNOW_FILE, 0 )
      footstep_check ( FOOTSTEP_WOOD, FOOTSTEP_WOOD_FILE, 0 )
     
      # Layer 1
      footstep_check ( FOOTSTEP_GRASS_LONG, FOOTSTEP_GRASS_FILE, 1 )
      footstep_check ( FOOTSTEP_DIRT_LONG, FOOTSTEP_DIRT_FILE, 1 )
      footstep_check ( FOOTSTEP_SAND_LONG, FOOTSTEP_SAND_FILE, 1 )
      footstep_check ( FOOTSTEP_SNOW_LONG, FOOTSTEP_SNOW_FILE, 1 )
     
      # Insert custom sounds here
     
    end
  end
 
end

Zum Beispiel "tilenumber ID"
Ist glaube für die Grafik aus dem Tileset, aber wie kriege ich die ID dafür raus?
« Letzte Änderung: November 29, 2011, 16:30:39 von Valentine »

Re: Footsteps by DeadlyDan Frage

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Footsteps by DeadlyDan Frage
« Antwort #1 am: Dezember 05, 2011, 21:04:56 »
Hay,
mach ein Parallen Process und lass eine Tastenabfrage laufen. Falls die Taste gedrück wird, soll folgendes ausgeführt werden:
$game_player.debug_tileidNun erfährst du die ID's. ;)

MfG



Re: Footsteps by DeadlyDan Frage

Offline Valentine

  • Eventmeister
  • ***
  • Beiträge: 352
Re: Footsteps by DeadlyDan Frage
« Antwort #2 am: Dezember 06, 2011, 18:18:17 »
Nabend Deity.

Habe jetzt auf der Map ein Event erstellt und auf Paralell Prozess gestellt. Dann Script Ausführen und den Code von dir eingeführt. Wenn ich jetzt Test Spiel mache kommt aber Error:

"NoMethodError occurred while running script
undefined method debug_tileid for nil:NilClass"

Hmm... was hab ich falsch gemacht?

Re: Footsteps by DeadlyDan Frage

Offline PDM

  • Bibliothekar
  • Global Mod
  • VX-Kenner
  • ****
  • Beiträge: 468
    • Mein Blog
Re: Footsteps by DeadlyDan Frage
« Antwort #3 am: Dezember 06, 2011, 19:07:51 »
Mhm, bei mir funktioniert die Abfrage auf Deitys Weise. Hast du den Script drin?
PDM's Gameplays
Skype-Name: lordpdm

Re: Footsteps by DeadlyDan Frage

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Footsteps by DeadlyDan Frage
« Antwort #4 am: Dezember 06, 2011, 19:29:17 »
Das liegt daran, dass der Schreiber einen kleinen Fehler eingebaut hat. :)
Das benötigte Array, wird erst nach mindestens einem Schritt erstellt, also musst du dich vorher mindestens einen Schritt bewegt haben, bevor du die Methode aufrufst. :)



Re: Footsteps by DeadlyDan Frage

Offline Valentine

  • Eventmeister
  • ***
  • Beiträge: 352
Re: Footsteps by DeadlyDan Frage
« Antwort #5 am: Dezember 06, 2011, 22:07:12 »
Also ... ich möcht das unbedingt hinkriegen =( aber ich rall das nicht ganz was ich tun soll.

Ich geh im Maker auf eine Map, ein Event machen. Das stell ich auf Para Process und füge ein Call Script ein mit:
$game_player.debug_tileid

Das wars dann oder was fehlt da? Weil gehe ich jetzt auf Test, kommt Error, was ich oben beschrieben hatte.

Re: Footsteps by DeadlyDan Frage

Offline PDM

  • Bibliothekar
  • Global Mod
  • VX-Kenner
  • ****
  • Beiträge: 468
    • Mein Blog
Re: Footsteps by DeadlyDan Frage
« Antwort #6 am: Dezember 06, 2011, 22:12:31 »
Wie Deity schon gesagt hat, du musst einen Schritt gehen. Sonst kommt der Fehler bei mir auch.
PDM's Gameplays
Skype-Name: lordpdm

Re: Footsteps by DeadlyDan Frage

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Footsteps by DeadlyDan Frage
« Antwort #7 am: Dezember 06, 2011, 22:45:22 »
Also ... ich möcht das unbedingt hinkriegen =( aber ich rall das nicht ganz was ich tun soll.

Ich geh im Maker auf eine Map, ein Event machen. Das stell ich auf Para Process und füge ein Call Script ein mit:
$game_player.debug_tileid

Das wars dann oder was fehlt da? Weil gehe ich jetzt auf Test, kommt Error, was ich oben beschrieben hatte.

Benutz ne Tastenabfrage, sonst hast du keine Chance einen Schritt zu gehen, bevor du das CallScript aufrufst. :)



Re: Footsteps by DeadlyDan Frage

Offline Valentine

  • Eventmeister
  • ***
  • Beiträge: 352
Re: Footsteps by DeadlyDan Frage
« Antwort #8 am: Dezember 07, 2011, 00:08:36 »
Danke schön an euch!
Hat jetzt geklappt mit der Tastenabfrage =)

TileID wird nun gefunden.

Re: Footsteps by DeadlyDan Frage

Offline Ðeity

  • No Pain, no gain!
  • Administrator
  • Eventmeister
  • ****
  • Beiträge: 427
  • No Pain, no Gain!
    • Deity-VX
Re: Footsteps by DeadlyDan Frage
« Antwort #9 am: Dezember 07, 2011, 00:47:10 »
Wird damit geschloßen. ;)



 


 Bild des Monats

rooftop party

Views: 3582
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal