vanblam wrote:1. I can't find a way to change the sound ( seems to be hard coded).
Correct. If you want to play a different sound, overwrite the chest_open and chest_close sounds with a silent sound*, then define animation events to play your preferred sound:
Code: Select all
defineSound{
name = "chest_open",
filename = "mod_assets/dmcsb_pack/samples/silence.wav",
loop = false,
volume = 0,
minDistance = 0,
maxDistance = 0,
}
defineSound{
name = "chest_close",
filename = "mod_assets/dmcsb_pack/samples/silence.wav",
loop = false,
volume = 0,
minDistance = 0,
maxDistance = 0,
}
defineAnimationEvent{
animation = "assets/animations/env/treasure_chest_open.fbx",
event = "playSound:chest_open_2",
frame = 0,
}
defineAnimationEvent{
animation = "assets/animations/env/treasure_chest_close.fbx",
event = "playSound:chest_close_2",
frame = 0,
}
defineSound{
name = "chest_open_2",
filename = "assets/samples/env/chest_open_01.wav",
loop = false,
volume = 0.8,
minDistance = 1,
maxDistance = 10,
}
defineSound{
name = "chest_close_2",
filename = "assets/samples/env/chest_close_01.wav",
loop = false,
volume = 0.8,
minDistance = 1,
maxDistance = 10,
}
*(I use a true silent sound file, but really it doesn't matter much since volume 0 is always silent)
vanblam wrote:2. I'm looking to find a way to access when its opened or closed. It calls the animations but how do you catch when it does call the animations?
For example when you open a chest I know you can mess around with the clickable component, but when you back away and the chest closes how do
access that? I tried doing onOpen and onClosed in the animation component with no success. Basically I'm trying to add additional sounds for when it
opens and closes WITH out messing with the clickable component.
Again, easiest to use AnimationEvents:
Code: Select all
defineAnimationEvent{
animation = "assets/animations/env/treasure_chest_open.fbx",
event = "open",
frame = 0,
}
defineAnimationEvent{
animation = "assets/animations/env/treasure_chest_close.fbx",
event = "close",
frame = 0,
}
Then add this field to the AnimationComponent:
Code: Select all
onAnimationEvent = function(self, event)
if event == "open" then
-- do whatever you wanted to do when the chest opens
elseif event == "close" then
-- do whatever you wanted to do when the chest closes
end
end,