[XP] Ryex's Dynamic Sounds UPDATE:Version 2 is out!

Started by Ryex, October 18, 2009, 01:50:39 am

Previous topic - Next topic

Ryex

This is a test post for diagnosing the code formater spoiler problem


Code: ruby
#=============================================================================
#
#          DYNAMIC SOUNDS PATCH
#          Author: Heretic
#          Version: 1.0
#          Date: Saturday, July 30th, 2016
#
#   Instructions: Place Below Dynamic Sounds
#
#   ----   Patch for Ryex's Dynamic Sound Engine----
#
# - Fixes a bug that causes a Fatal Game Crash when a Non Edited Save Game
#   has been loaded.  Any Sounds that were Muted before having been saved
#   will be enabled again.
# - Adds the ability to temporarily turn off Dynamic Engine Effects
#   with a Script Call: $game_system.disable_dee
#
#  Intended for use with DEE Version 1.6 and Dynamic Sounds 2.0
#
#=============================================================================

if DEE::DEE_VERSION > 1.6 and RyexCFG::D_S::VERSION > 2.0
  print "ERROR: Ryex\'s Dynamic Sounds Patch isnt needed with\n",
        "versions higher than version 1.6, you may wish to\n",
        "remove the Patch."
end

module DEE
  class System
    #------------------------------------------------------------------------
    # * Update - DEE::System
    #  - Allows disabling DEE
    #------------------------------------------------------------------------
    alias alias_dee_update update unless $@
    def update
      # Return if DEE is Disabled
      return if $game_system.disable_dee
      # Call Original
      alias_dee_update
    end
  end
end

#==============================================================================
# ** Game_System
#==============================================================================
class Game_System
  attr_accessor :disable_dee    # Allow turning off Dynamic Sounds when true
end

#==============================================================================
# ** Scene_Save
#==============================================================================
class Scene_Save < Scene_File
  #--------------------------------------------------------------------------
  # * Write Save Data - Scene_Save
  #  - Saves DEE in addition to other Game Variables
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  alias dynamic_sounds_patch_write_save_data write_save_data unless $@
  def write_save_data(file)
    # Call Original or other Aliases
    dynamic_sounds_patch_write_save_data(file)
    # Save DEE to File
    Marshal.dump($DEE, file)
  end
end

#==============================================================================
# ** Scene_Load
#==============================================================================
class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Read Save Data - Scene_Load
  #  - Rebuilds entire Dynamic Sounds for a Map when Game is Loaded
  #     file : file object for reading (opened) 
  #--------------------------------------------------------------------------
  alias dynamic_sounds_patch_read_save_data read_save_data unless $@
  def read_save_data(file)
    # Call Original or other Aliases
    dynamic_sounds_patch_read_save_data(file)
    # Restore DEE
    $DEE = Marshal.load(file)
    # If magic number is different from when saving
    # (if editing was added with editor)
    if $game_system.magic_number == $data_system.magic_number
      # Setup Dynamic Sounds on Loaded Map
      RyexCFG::D_S.setup($game_map.map_id)
    end
  end
end

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Kise

October 06, 2017, 09:41:27 am #61 Last Edit: October 06, 2017, 09:42:47 am by Kise
How can I smoothly fade out BGS which is played by default on map ( is set in Map Properties as Auto-Change BGS )? Fade Out BGS doesn't work. :???:

KK20

Just quickly messed with it and this is what I got:

I have Dynamic Sound v2.04 and Dynamic Effects Engine v1.61.
I also have Heretic's Dynamic Sounds Patch above your post.

In Heretic's script, I removed the little message at the top of the script

if DEE::DEE_VERSION > 1.6 and RyexCFG::D_S::VERSION > 2.0
  print "ERROR: Ryex\'s Dynamic Sounds Patch isnt needed with\n",
        "versions higher than version 1.6, you may wish to\n",
        "remove the Patch."
end


In your event, do the script call
$game_system.disable_dee = true

and then do your Fade BGS.

And then when you want to re-enable, just do
$game_system.disable_dee = 
false

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Kise

Yeah, that works. I tried this method before, but I didn't know that script call requied " = true" so it didn't work. Thanks!

Heretic86

Quick note on that also:

Any time you do a Script where something = false, the interpreter screws up.  This is known as the Interpreter 355 bug.  Several scripts fix this, but just in case, make sure that on Interpreter command_355 (which is the interpreter for Script calls), remove or comment out the line that says "return false".

    # If return value is false
    if result == false
      # End
      return false
    end
    # Continue
    return true


Change to:
    # If return value is false
    if result == false
      # End
      #return false
    end
    # Continue
    return true
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

But only if you put = false on the same line, which is why I formatted my post like so.
But I'm sure Kise is veteran enough to know that bug exists.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Heretic86

Agreed, but not everyone actually is.  Hopefully we wont even know if explaining that helps others since they wont need to post if it helps to solve issues.  And, good call on the way you formatted the post.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Sin86

December 23, 2017, 05:50:40 pm #67 Last Edit: December 23, 2017, 05:52:07 pm by Sin86
A very big problem with Blizz ABS plugin I believe.

When applying sounds to an enemy, the sounds will play when I get to the enemy except 2 things.

1. After the enemy dies, the sounds still play, but only at the tile right where the enemy appeared it.

2. When battling the enemy, sounds will play as they should, but only at the enemy's starting tile. If moving around while fighting close ranged at the enemy but away from the spot where it once stood at, the sounds fade out and only activate at the starting tile for the enemy.

This has been tested on the original versions of DEE, Dynamic Sounds and Blizz ABS v 2.7 or higher. Also tested on the latest versions of DEE, Dynamic Sounds as well as with and without Heretic's patch.

KK20

Your event's configuration is wrong.

Here's an example of one that worked for me:
\dee[dbgs|001-Wind01|100|300]


Based on what you described, it sounds like you used bgs instead of dbgs. As the PDF states:
Quote
Dynamic Position Sources
Dynamic Position Sources are sources that follow the event they were placed in; perfect for birds,
enemies, animals, guards in a sneak game, etc.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Sin86

Ah, that's how it is done, thanks.

However, there is an issue with the latest version, the script calls for muting and un-muting crash.

Ryex

you'll have to be a bit more specific. can you snag a screenshot or copy the text of the error message when the script calls crash the game?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Sin86

January 01, 2018, 10:20:47 pm #71 Last Edit: January 01, 2018, 10:21:50 pm by Sin86
The error says:

NameError occurred while running script.

uninitialized constant RyexCGG::D_S

(had to edit the post to make it look like the error because original converted the D into a smiley.)

Also, when having everything installed properly, I can only activate the sounds on Blizz ABS events(events that have enemy tags) and yet will not work on regular events if Pixel movement is set to anything other than 0.

If the pixel rate is however at 0, the sounds play regardless of how close you are to the events, yet can play the sounds on an event regardless if its an enemy or not.

Ryex

 The obvious culprit then is the typo of 'RyexCGG' the Module should be 'RyexCFG'. Since you didn't give a line number I'm assuming the game didn't give a line number for the error which suggests that the error is happening in a script call so double check those if it DID give a line number for the error I'll need that.  Also, the D_S module isn't under the RyexCFG module so any calls to it should remove the 'RyexCFG::' scope.

If you need more help I'll need a screenshot of the error message, a screenshot of the script call that's causing the error,  and you'll have to copy paste the relevant event comments that you're using to create the sound sources that are not working correctly.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Sin86

January 07, 2018, 08:49:30 pm #73 Last Edit: January 07, 2018, 08:51:55 pm by Sin86
My bad, I made the typo when posting the error. I did CFG and still got it. This is what happens. I can run your demo, get to map004 and talk to the girl who shares this piece of script.

RyexCFG::D_S.mute_source(0,
'011-Waterfall01')


In your demo, it works fine but then again, the demo is using an early build of Dynamic Sounds and DDE. My build is using the current versions and if I input that same exact code, I get the error. And when I got the error, I went into the scripts to see if it can pinpoint me to the error and it did not. If you know of a working code, please do post on how to execute it as apparently that no longer works.

Ryex

use just
D_S.mute_source(0, 011-Waterfall01')
and remove the
 RyexCFG::


The two modules are not nested in the current version. I'm fairly sure they never were but I could be wrong if that's is what is used in the Demo.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Sin86

January 10, 2018, 07:18:49 pm #75 Last Edit: January 10, 2018, 07:23:21 pm by Sin86
It's working partially.. I did D_S.mute_source(0, '011-Waterfall01')

However, this only works on bgs formats but on a dbgs format, no effect is taken. I even put in D_S.mute_piece(0, '013-Fire01', 'campfire 1'[, dynamic ]) and all I get is a "syntax error occurred". I don't know what I am doing wrong.

By the way, I found a typo in line 100.

piece.mute = treu

I think it should be saying piece.mute = true

KK20

Whenever someone explains how to use a script, like so
my_script_call(id, amount[, active])

this is saying that the following script calls are valid:

my_script_call(id, amount)
my_script_call(id, amount, active)


In the case of D_S.mute_piece, dynamic (the optional parameter) is either true or false.
If you don't specify a value for dynamic, the script will assume a value of false. Essentially
D_S.mute_piece(0, '013-Fire01', 'campfire 1')

is equivalent to
D_S.mute_piece(0, '013-Fire01', 'campfire 1', false)


So clearly what you want to do is
D_S.mute_piece(0, '013-Fire01', 'campfire 1', true)

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Heretic86

Seems like the links in the original post of this thread are dead.  No screenies either.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

?
Wrong thread you posted in? All the links work. And there were no images to begin with.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Barabian

July 08, 2021, 12:39:10 pm #79 Last Edit: July 08, 2021, 12:53:31 pm by Barabian
Hi! It's passible to make this script working with XPAce script? It returns the following error:
 
undefined method `id' for #<Game_Map:0xb01542c>

[0141]Dynamic Sounds:675:in `interpret_dynamic_sounds_data_bgs'
[0141]Dynamic Sounds:273:in `interpret_dee_data'
[0141]Dynamic Sounds:251:in `block (2 levels) in dee_comment_search'
[0141]Dynamic Sounds:248:in `gsub'
[0141]Dynamic Sounds:248:in `block in dee_comment_search'
[0141]Dynamic Sounds:247:in `each'
[0141]Dynamic Sounds:247:in `dee_comment_search'
[0141]Dynamic Sounds:262:in `block (2 levels) in event_search'
[0141]Dynamic Sounds:260:in `each'
[0141]Dynamic Sounds:260:in `block in event_search'
[0141]Dynamic Sounds:258:in `each_value'
[0141]Dynamic Sounds:258:in `event_search'
[0141]Dynamic Sounds:708:in `setup'
[0076]Scene_Title:132:in `command_new_game'
[0076]Scene_Title:99:in `update'
[0076]Scene_Title:74:in `block in main'
[0076]Scene_Title:68:in `loop'
[0076]Scene_Title:68:in `main'
[0142][XPA] Main:37:in `block in <main>'
:1:in `block in rgss_main'
:1:in `loop'
:1:in `rgss_main'
[0142][XPA] Main:28:in `<main>'
ruby:in `eval'