
So now that the WIP scripting ref has been released Ive decided to start converting custom content over to the new system.
I have started with a basic knife and I am having problems with a couple of the component properties.
I have tried to redefine the LoG2 throwing knife as a melee attack knife (as in LoG1)
Code: Select all
defineObject{
name = "knife",
baseObject = "throwing_knife",
components = {
{
class = "Model",
model = "mod_assets/models/knife.fbx",
},
{
class ="Item",
uiName = "Knife",
gfxAtlas = "mod_assets/textures/items.tga",
gfxIndex = 47,
weight = 0.7,
--primaryAction = "MeleeAttack",
impactSound = "impact_blade",
traits = { "daggers" },
description = "A blunt, rusty knife probably used for scaling fish."
},
{
class = "ItemAction",
requirements = {"light_weapons",2},
requirementsText = "Light Weapons 2 (Daggers)",
coolDownTime = 3.0
},
{
class = "MeleeAttack",
attackPower = 5,
accuracy = 0,
swipe = "horizontal",
attackSound = "swipe",
baseDamageStat = "dexterity",
damageType = "physical",
},
}
}
-With primaryAction commented out, the knife will perform an attack - but will do nothing if primary action is not commented out.
-the editor doesnt mind requirements = {"light_weapons",2}, but I can still attack with the knife even with light weapons skill =1.
-the editor does not like requirementsText (and will not list the weapon requirements under the weapon name at the top .... http://ge.tt/6BvSvH32/v/0)
-the editor does not like coolDownTime either... and cool down time is not affected when I change its value.
Prozail has corrected the code! Thank you

Code: Select all
defineObject{
name = "knife",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/knife.fbx",
},
{
class ="Item",
uiName = "Knife",
--gfxAtlas = "you can set your own",
gfxIndex = 47,
weight = 0.7,
impactSound = "impact_blade",
traits = { "daggers", "light_weapon" },
description = "A blunt, rusty knife probably used for scaling fish."
},
{
class = "MeleeAttack",
attackPower = 5,
accuracy = 0,
swipe = "horizontal",
attackSound = "swipe",
cooldown = 3.0,
baseDamageStat = "dexterity",
damageType = "physical",
requirements = {"light_weapons" ,2},
gameEffect = "A test text you can set.",
},
}
}