How to make a cloud-with-trigger not stack sounds
Posted: Sat Aug 25, 2018 11:04 pm
Specifically a "smoke-with-trigger" that has one of its effects be "play-sound".
The problem is, setting the action_cooldown prevents the sound from playing until it has elapsed (ie it does not play on the first tick), and so if the lifetime of the smoke entity is less than that time, it never plays the sound. Additionally, this fails when there are multiple effects, some of which are supposed to be fired rapidly.
The code I am attempting to use is as follows:
It runs and plays the sound and deals the damage, but the sound is re-played every 10 ticks, which is a problem.
The problem is, setting the action_cooldown prevents the sound from playing until it has elapsed (ie it does not play on the first tick), and so if the lifetime of the smoke entity is less than that time, it never plays the sound. Additionally, this fails when there are multiple effects, some of which are supposed to be fired rapidly.
The code I am attempting to use is as follows:
Code: Select all
action =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
type = "nested-result",
action =
{
type = "area",
radius = size,
entity_flags = {"breaths-air"},
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "damage",
damage = { amount = damage, type = "poison"}
},
{
type = "play-sound",
sound = {
filename = "__NauvisDay__/sound/gasp.ogg",
aggregation =
{
max_count = 1,
remove = false
},
},
action_cooldown = 4*60
}
}
}
}
}
}
},
action_cooldown = 10