how to define an item that play a sound (like the horn) when normally used ?
the secondary option works great, the primary don't:
SpoilerShow
Code: Select all
defineObject{
name = "charming_flute",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/flute.fbx",
},
{
class = "Item",
uiName = "Charming Flute",
gfxIndex = 316,
weight = 0.3,
description = "A sharpened flute made of unknown material.",
-- sound primary
onUse = function(self) -- wrong definition?
playSound("flute01")
end,
secondaryAction = "fear",
impactSound = "impact_blunt",
},
{
class = "CastSpell",
name = "fear",
uiName = "Cause Fear",
charges = 12,
buildup = 2,
energyCost = 10,
spell = "cause_fear",
requirements = { "concentration", 3 },
onAttack = function(self)
playSound("flute02")
end,
},
},
}