.
RGSS3 Script RequestsCollision Sound by DiamondandPlatinum3 should do the trick for one of your requests. With editing you can get rid of any features you want disabled.
Well your script does have an error.
I added the switch to DP3's script.
Your script gives an error with
it should be
The gameplayer doesn't go in the alias. it must be the same alias inside the method.
*EDIT
For your second request, there's this script
http://rmrk.net/index.php?topic=45866.0
I added the switch to DP3's script.
Code:
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Collision Sound
# Author: DiamondandPlatinum3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Description:
#
# This script plays a collision sound when you try walking on to an
# non-passable space. This is not used if you have 'through' checked on your
# player on the other hand.
# Collision sound only works for the Player, it does not play for other
# events if they try to walk into something they shouldn't.
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#------------------------------------------------------------------------------
# Instructions:
#
# Editable Region, simply replace the Filename, VOlume & Pitch for the
# Collision_SE. You must also set a wait timer until it can be heard again.
# This is because the collision sound can play many many times if you keep
# attempting to walk into a wall, so this option sets the cooldown time until
# it can be heard again.
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
class Game_Player < Game_Character
#----------------------------------------
# Editable Region
#----------------------------------------
Collision_SE = [ "Bite", 80, 100 ] # The Collision Sound you wish to play, volume, pitch.
Collision_Wait_Timer = 60 # Wait Timer (in frames) until next collision sound.
Collision_Switch = 3 # On to play sounds
#----------------------------------------
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias dp3_collisionsound_gameplayer_update_sevt update
def update
dp3_collisionsound_gameplayer_update_sevt()
@collision_sound_timer = 0 unless @collision_sound_timer != nil
@collision_sound_timer -= 1 unless @collision_sound_timer == 0
end
#--------------------------------------------------------------------------
# * Determine if Passable
#--------------------------------------------------------------------------
alias dp3_collisionsound_gameplayer_passable_sevt passable?
def passable?( *args )
passable = dp3_collisionsound_gameplayer_passable_sevt( *args )
return passable unless $game_switches[Collision_Switch] == true
unless passable == true || @collision_sound_timer > 0
RPG::SE.new(*Collision_SE).play
@collision_sound_timer = Collision_Wait_Timer
end
return passable
end
end
Your script gives an error with
Code:
alias romanticist_frame_update update
def update
romanticist_gameplayer_frame_update
Code:
alias romanticist_frame_update update
def update
romanticist_frame_update
*EDIT
For your second request, there's this script
http://rmrk.net/index.php?topic=45866.0
I need to see more of your code.
My testing has it working, but we don't have the same setup.
What does the event have in it, what does the common event have in it.
Update your original post with your script for collision.
I put your script in a test project and set it up just like you have and it works fine.
Just a note as well, you don't need to call a common event or change the switches before hand.
It can all be in one move route.
or
But I don't see how it would still cause a problem. turning the switches on or off doesn't cause any problems in my test.
It must be something to do with your map or a script incompatibility.
Just a note as well, you don't need to call a common event or change the switches before hand.
It can all be in one move route.
But I don't see how it would still cause a problem. turning the switches on or off doesn't cause any problems in my test.
It must be something to do with your map or a script incompatibility.
Ok I see now.
The system is processing the collision before you get to perform the actions in the event.
you need to make the event run before the passable method occurs. Not sure about that.
Otherwise you would have to turn the switch off before the player gets to the edge.
The system is processing the collision before you get to perform the actions in the event.
you need to make the event run before the passable method occurs. Not sure about that.
Otherwise you would have to turn the switch off before the player gets to the edge.
I would use a region ID, or make a check to see if the player is facing a 'jump' event by giving jump events a specific name.
E.g.
Any events with 'jump' in the name will not use the collision sound. Then you can turn off the switch, perform the jump, then turn the switch back on (in the event).
E.g.
Code:
class Game_Player < Game_Character
alias romanticist_collisionbump_sfx passable?
def passable?(*args)
passable = romanticist_collisionbump_sfx(*args)
x2 = $game_map.round_x_with_direction(@x, @direction)
y2 = $game_map.round_y_with_direction(@y, @direction)
return passable if facing_jump_event?
return passable unless $game_switches[Collision_Switch]
unless passable || @collision_sound_timer > 0
RPG::SE.new(*Collision_SE).play
@collision_sound_timer = Collision_Wait_Timer
end
return passable
end
def facing_jump_event?
x2 = $game_map.round_x_with_direction(@x, @direction)
y2 = $game_map.round_y_with_direction(@y, @direction)
return false unless $game_map.event_id_xy(x2, y2) > 0
return $game_map.events[$game_map.event_id_xy(x2, y2)].jump_event?
end
end
class Game_Event < Game_Character
def name
@event.name
end
def jump_event?
name.include?("jump") # or whatever unique name you want to use
end
end
Any events with 'jump' in the name will not use the collision sound. Then you can turn off the switch, perform the jump, then turn the switch back on (in the event).
This is what I used to make it work.
The bump sound did not play.
If I made the event a player touch then the sound played.
The bump sound did not play.
If I made the event a player touch then the sound played.
Sorry, I was just showing the bits to add/change rather than changing the whole script. I've got an idea for using directions in the name to decide whether you can jump, but I won't have time to mock something up until later on today.
EDIT: Here you go, this should do the trick.
So for an event that lets you jump left and right only, the name would be
EDIT: Here you go, this should do the trick.
Code:
class Game_Player < Game_Character
Collision_SE = ["collision", 85, 50]
Collision_Wait_Timer = 20
Collision_Switch = 26
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias romanticist_frame_update update
def update
romanticist_frame_update
@collision_sound_timer = 0 unless @collision_sound_timer != nil
@collision_sound_timer -= 1 unless @collision_sound_timer == 0
end
#--------------------------------------------------------------------------
# * Determine if Passable
#--------------------------------------------------------------------------
alias romanticist_collisionbump_sfx passable?
def passable?(x, y, d)
passable = romanticist_collisionbump_sfx(x, y, d)
return passable if facing_jump_event?(d)
return passable unless $game_switches[Collision_Switch]
unless passable || @collision_sound_timer > 0
RPG::SE.new(*Collision_SE).play
@collision_sound_timer = Collision_Wait_Timer
end
return passable
end
def facing_jump_event?(direction)
x2 = $game_map.round_x_with_direction(@x, direction)
y2 = $game_map.round_y_with_direction(@y, direction)
return false unless $game_map.event_id_xy(x2, y2) > 0
return false unless $game_map.events[$game_map.event_id_xy(x2, y2)].jump_event?
return $game_map.events[$game_map.event_id_xy(x2, y2)].jump_directions.include?(direction)
end
end
class Game_Event < Game_Character
def name
@event.name
end
def jump_event?
name.include?("jump")
end
def jump_directions
res = []
name.scan(/jump\s*<(.+)>/i).each do |i|
i.each { |e| res << e.strip.split(",") }
end
res = res.flatten.map(&:to_i)
end
end
So for an event that lets you jump left and right only, the name would be
Code:
jump <4,6>
Cool, glad it works! Yep, the numbers in VXAce correspond to the keypad on most laptops, where 8 is up, 6 is right, 2 is down and 4 is left.
Original thread: https://forums.rpgmakerweb.com/threads/106794/