#Consumable moonshard
1 messages · Page 1 of 1 (latest)
That should actually be really easy to do.
Stackable moonshard as an item can be done by adjusting the KV to allow stacks. You can look at the KV of any item that can be stacked like Clarity or Healing Salve.
You will set up a moonshard speed modifier, which returns a value of attack speed per stack * self:GetStackCount(), so it will accumulate attack speed based on stacks.
In OnSpellStart() of the item, you check if the moonshard speed modifier exists. If it does, then you increment its stack count by 1; if not, you create it and set its stack count as 1.
This is a pretty good example of a similar modifier:
https://github.com/Elfansoer/dota-2-lua-abilities/wiki/Ability-Lua-Tutorial-4%3A-Troll-Warlord's-Fervor
Stackable item example:
https://github.com/EarthSalamander42/dota_imba/blob/master/game/scripts/vscripts/components/items/item_clarity.lua
Repo for the development of Dota IMBA, a mod for Valve's Dota 2. - EarthSalamander42/dota_imba
@sweet bridge
Hi, thank you for reaching out. I just read about the modifier in Valve Software, then looked at the source code for the Moon Shard item in Dota Imba, and also took a quick look at the Clarity item.
In Dota Imba, why create two modifiers? The first one for stackable, and the second for the active modifier?
According to Dota rules at the time it was written (I cannot remember if it changed), you can either:
- Hold onto the item, keeping it equipped, but not use (cast) it - this gives you a passive attack speed bonus and a night vision bonus
- Use the item, sacrificing it and getting a small attack speed bonus as a tradeoff for the item slot which is now free.
For instance, you could hold 3 Moon Shards or use some/all of them
So the first modifier is for the item itself (bonuses gained by holding the item), the second modifier is for when the item is sacrificed and becomes a permanent bonus
i see, okay, got it
i have another question, its out of topic. how to add sound like in dota imba when hero cast his specific spell like darude sand storm, i will survive "dazzle". Do i need to implement all lua logic? i just need to place this code
if USE_MEME_SOUNDS and RollPercentage(MEME_SOUNDS_CHANCE) then
EmitSoundOn(sound_darude, caster)
else
EmitSoundOn(sound_loop, caster)
end
all i must implement all the logic, like dmg etc
Just to make sure I understand the question. You're asking whether you can use the original Dota's Sandstorm ability, but use a different sound instead of the one it actually uses?
The answer is yes, you can, but it's a little bit of hacking around. You have to listen to ability casts, make sure it's Sandstorm, then decide whether to stop the Sandstorm sound being emitted and instead play your own sound instead. Depending on how Valve did it (which we cannot know), it might not work as well as you'd want.
Additionally, you'll have to know when to stop it, since Sandstorm can be stopped prematurely or essentially last for a long time