Page 1 of 1

Weapon Definitions - component issues

Posted: Sat Nov 01, 2014 8:59 am
by akroma222
Hey all :)
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)
SpoilerShow

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",
		},
   }
}
Issues
-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 :D
SpoilerShow

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.",
          },
       }
    }
Akroma

Re: Weapon Definitions - component issues

Posted: Sat Nov 01, 2014 9:40 am
by Prozail
I made a few changes to your definition.
SpoilerShow

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.",
      },
   }
}

Re: Weapon Definitions - component issues

Posted: Sat Nov 01, 2014 10:45 am
by akroma222
Brilliant!! works as intended... Thank you Prozail :D

After work I will change up the original post to reflect your correct item definition
I will also post further work and Q&A with weapon definitions here

Thanks again!
Akroma

Re: Weapon Definitions - component issues

Posted: Sat Nov 01, 2014 1:22 pm
by Doridion
Thx Prozail ! Seen that little issues with coins gives you experience, gratz ^^ Sticked for help in the superthread ;)

Re: Weapon Definitions - component issues

Posted: Thu Jan 15, 2015 1:37 am
by THOM
Is there any way to exchange swipe = "horizontal", with the flurry swipe (the one, that does three hits)?

The only way I can see is to use powerAttackTemplate = "flurry", but with that you can't use your own attack-definitions (definitions seems to be hardcoded). If I knew the correct swipe-animation, it would be fine, I think. But something like swipe = "flurry", doesn't work...

Re: Weapon Definitions - component issues

Posted: Thu Jan 15, 2015 3:16 am
by minmay
swipe = "flurry" does give you the Flurry of Slashes swipe. The Flurry of Slashes swipe is simply a horizontal swipe for the first attack in the chain, a vertical swipe for the second attack in the chain, and a horizontal attack for every further attack in the chain. So if you're using it on a weapon without a chain attack it will be the same as a horizontal swipe. If you want alternating horizontal and vertical swipes, just call setSwipe() in the onAttack hook. For example, here's the LoG2 Whirlwind Blade's onAttack, which changes the swipe used on every attack:

Code: Select all

onAttack = function(self,champion,slot,chainIndex)
-- 50% chance of each of the two swipes that we didn't just do
if (math.random() > 0.5) then
	self:setSwipe((self:getSwipe() == "vertical") and "horizontal" or "vertical")
else
	self:setSwipe((self:getSwipe() == "thrust") and "horizontal" or "thrust")
end
	champion:modifyFood(0.5) -- food cost for this many attacks is annoyingly high so reduce it
end,

Re: Weapon Definitions - component issues

Posted: Thu Jan 15, 2015 12:55 pm
by THOM
Aha, okay. But what is an "attack in the chain"? Do I have to define an attack-chain if I want to have this 3time-slash?

Re: Weapon Definitions - component issues

Posted: Thu Jan 15, 2015 7:39 pm
by minmay
THOM wrote:Aha, okay. But what is an "attack in the chain"? Do I have to define an attack-chain if I want to have this 3time-slash?
The "repeatCount" field in the component definition, or ItemActionComponent:setRepeatCount(), makes the action repeat several times at an interval of repeatDelay. It's what Flurry of Slashes and the Repeater's special attack do.

Re: Weapon Definitions - component issues

Posted: Thu Jan 15, 2015 11:35 pm
by THOM
Ah - got it! Thanks a lot.