http://www.grimrock.net/modding/scripti ... nComponent
I was wondering if anyone tried doing something with it - looking through the option it should be possible to twist secondaryAction a bit to achieve something interesting (there's this getBuildUp() and so on) like the longer you hold the button the better the effect. Is this even possible

:EDIT:
I went a bit different way with:
Code: Select all
secondaryAction = {function()
local luck = math.random(10)
if luck > 2 then
return "doubleShot0"
else
return "doubleShot1"
end
end},
Here's whole item definition:
SpoilerShow
Code: Select all
defineObject{
name = "twostringbow",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/short_bow.fbx",
},
{
class ="Item",
uiName = "Two-String Bow",
gfxIndex = 13,
GfxIndexPowerAttack = 466,
secondaryAction = function()
local luck = math.random(10)
if luck > 2 then
return "doubleShot0"
else
return "doubleShot1"
end
end,
weight = 2.7,
impactSound = "impact_blade",
traits = { "bow", "missile_weapon" },
description = "Short Bow that can spit two arrows at a same time."
},
{
class = "RangedAttack",
attackPower = 5,
accuracy = 10,
Ammo = "arrow",
attackSound = "swipe_bow",
cooldown = 2.0,
baseDamageStat = "dexterity",
damageType = "physical",
},
{
class = "RangedAttack",
name = "doubleShot0",
uiName = "Tripple Shot",
Ammo = nil,
--repeatCount = 1,
attackPower = 10,
attackSound = "swipe_special",
baseDamageStat = "dexterity",
damageType = "physical",
chainAction = "doubleShot1",
chainActionDelay = 0.1,
cooldown = 4.0,
energyCost = 5,
onAttack = function(self, champion, slot, chainIndex)
hudPrint(champion.name.." shot one extra arrow out of nowhere !")
end,
},
{
class = "RangedAttack",
name = "doubleShot1",
uiName = "Double Shot",
Ammo = "arrow",
--repeatCount = 1,
attackPower = 10,
attackSound = "swipe_special",
baseDamageStat = "dexterity",
damageType = "physical",
chainAction = "doubleShot2",
chainActionDelay = 0.1,
cooldown = 3.0,
energyCost = 5,
},
{
class = "RangedAttack",
name = "doubleShot2",
-- uiName = "Double Shot",
Ammo = "arrow",
--repeatCount = 1,
attackPower = 10,
attackSound = "swipe_special",
baseDamageStat = "dexterity",
damageType = "physical",
-- cooldown = 3.0,
energyCost = 5,
},
},
}
