Magical Melee weapon code
Posted: Sun Dec 04, 2016 9:40 pm
Here is code for magical melee weapons. It will do physical and magic damage both.
Fireburst can be change to what ever spell.
GfxIndex and Gfx Atlas will have to be changed to your own.
Party will not be awareded exp though if monster is killed by the spell effect on the melee weapon.
defineObject{
name = "fflail",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/flail.fbx",
},
{
class = "Item",
uiName = "Fire Knight Flail",
gfxIndex = 34,
gfxAtlas = "mod_assets/textures/ikons2.tga",
gfxIndexPowerAttack = 423,
impactSound = "impact_blunt",
weight = 6.5,
traits = { "heavy_weapon", "mace" },
},
{
class = "MeleeAttack",
attackPower = 52,
pierce = 10,
accuracy = 10,
cooldown = 5,
swipe = "vertical",
attackSound = "swipe_heavy",
reachWeapon = true,
requirements = { "heavy_weapons", 2 },
powerAttackTemplate = "stun",
onAttack = function(self)
local obj = spawn("fireburst")
end,
},
},
tags = { "weapon" },
}
Fireburst can be change to what ever spell.
GfxIndex and Gfx Atlas will have to be changed to your own.
Party will not be awareded exp though if monster is killed by the spell effect on the melee weapon.
defineObject{
name = "fflail",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/flail.fbx",
},
{
class = "Item",
uiName = "Fire Knight Flail",
gfxIndex = 34,
gfxAtlas = "mod_assets/textures/ikons2.tga",
gfxIndexPowerAttack = 423,
impactSound = "impact_blunt",
weight = 6.5,
traits = { "heavy_weapon", "mace" },
},
{
class = "MeleeAttack",
attackPower = 52,
pierce = 10,
accuracy = 10,
cooldown = 5,
swipe = "vertical",
attackSound = "swipe_heavy",
reachWeapon = true,
requirements = { "heavy_weapons", 2 },
powerAttackTemplate = "stun",
onAttack = function(self)
local obj = spawn("fireburst")
end,
},
},
tags = { "weapon" },
}