Нужен хелп со скиллом предмета!

NeedWay

Активный
5 Сен 2017
128
9
steamcommunity.com
Проект
MIDDLE HERO WAR
Добречка всем, я честно не хотел сюда писать, но за час моих стараний я так и не нашел ошибку!
Объясняю в чем трабл:
Нужно написать предмет, который работал бы как 2 скилл бристлбэка, ну со своими плюшками(По типу доп армора за героя в радиусе и замедла на каждого героя, но не суть).
Я наверно очень криворукий, если не смог нормально присобачить обычный скилл бристла на айтем.
Коды снизу:
Код:
"immortal_dragon_armor"
    {
    "ID"                            "21422"    
        // General
        //-------------------------------------------------------------------------------------------------------------
        "BaseClass"                        "item_datadriven"
        "AbilityTextureName"             "items/IDA1"
        // Stats
        //-------------------------------------------------------------------------------------------------------------

        // Item Info
        //-------------------------------------------------------------------------------------------------------------
        "ItemCost"                        "400"
        "ItemShopTags"                    "int;armor;hard_to_tag"
        "ItemQuality"                    "epic"
        "ItemAliases"                    "Dragon Armor"
        "ItemDisassembleRule"            "DOTA_ITEM_DISASSEMBLE_ALWAYS"
        "ItemDeclarations"                "DECLARE_PURCHASES_TO_TEAMMATES | DECLARE_PURCHASES_IN_SPEECH | DECLARE_PURCHASES_TO_SPECTATORS"

    "AbilityBehavior"                "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IMMEDIATE"
    "AbilityUnitDamageType"            "DAMAGE_TYPE_PHYSICAL"    
    "SpellImmunityType"                "SPELL_IMMUNITY_ENEMIES_YES"
    
    // Casting
    //-------------------------------------------------------------------------------------------------------------
    "AbilityCastRange"                "625"
    "AbilityCastPoint"                "0.0"
        
    // Time        
    //-------------------------------------------------------------------------------------------------------------
    "AbilityCooldown"                "3.0"
    
    // Cost
    //-------------------------------------------------------------------------------------------------------------
    "AbilityManaCost"                "35"
    
    // Special
    //-------------------------------------------------------------------------------------------------------------
    "AbilitySpecial"
    {
        "01"
        {
            "var_type"                "FIELD_INTEGER"
            "radius"                "625"
        }
        "02"
        {
            "var_type"                "FIELD_FLOAT"
            "quill_base_damage"        "80.0"
        }
        "03"
        {
            "var_type"                "FIELD_FLOAT"
            "quill_stack_damage"    "30.0"
        }
        "04"
        {
            "var_type"                "FIELD_FLOAT"
            "quill_stack_duration"    "14.0"
        }
        "05"
        {
            "var_type"                "FIELD_FLOAT"
            "max_damage"            "400.0"
        }
    }

    "precache"
    {
        "particle"    "particles/units/heroes/hero_bristleback/bristleback_quill_spray.vpcf"
        "particle"    "particles/units/heroes/hero_bristleback/bristleback_quill_spray_impact.vpcf"
        "particle"    "particles/units/heroes/hero_bristleback/bristleback_quill_spray_hit.vpcf"
        "particle"    "particles/units/heroes/hero_bristleback/bristleback_quill_spray_hit_creep.vpcf"
        "soundfile"    "soundevents/game_sounds_heroes/game_sounds_bristleback.vsndevts"
    }

    "OnSpellStart"
    {
        "ApplyModifier"
        {
            "Target"
            {
                "Center"    "CASTER"
                "Radius"    "%radius"
                "Teams"        "DOTA_UNIT_TARGET_TEAM_ENEMY"
                "Types"        "DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_BASIC"
            }

            "ModifierName"    "modifier_quill_spray_datadriven_determiner"
        }

        "FireEffect"
        {
            "EffectName"        "particles/units/heroes/hero_bristleback/bristleback_quill_spray.vpcf"
            "EffectAttachType"    "attach_hitloc"
            "EffectRadius"        "%radius"
            "Target"            "CASTER"
        }

        "FireSound"
        {
            "EffectName"        "Hero_Bristleback.QuillSpray.Cast"
            "Target"            "CASTER"
        }

        "FireSound"
        {
            "EffectName"        "Hero_Bristleback.QuillSpray.Target"
            "Target"
            {
                "Center"    "CASTER"
                "Radius"    "%radius"
                "Teams"        "DOTA_UNIT_TARGET_TEAM_ENEMY"
                "Types"        "DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_BASIC"
            }
        }
    }

    "Modifiers"
    {
        "modifier_quill_spray_datadriven_user_display"
        {
            "IsDebuff"    "1"
        }

        "modifier_quill_spray_datadriven_stack_creep" // with thanks to BMD for explaining MODIFIER_ATTRIBUTE_MULTIPLE and telling me a good way to handle this
        {
            "IsHidden"        "1"
            "Attributes"    "MODIFIER_ATTRIBUTE_MULTIPLE"
            "Duration"        "%quill_stack_duration"

            "OnCreated"
            {
                "RunScript"
                {
                    "ScriptFile"        "scripts/vscripts/heroes/hero_bristleback/quill_spray.lua"
                    "Function"            "stack_created"
                    "stack_duration"    "%quill_stack_duration"
                    "base_damage"        "%quill_base_damage"
                    "stack_damage"        "%quill_stack_damage"
                    "max_damage"        "%max_damage"
                }

                "FireEffect"
                {
                    "EffectName"        "particles/units/heroes/hero_bristleback/bristleback_quill_spray_impact.vpcf"
                    "EffectAttachType"    "follow_hitloc"
                    "Target"            "TARGET"
                }

                "AttachEffect"
                {
                    "EffectName"        "particles/units/heroes/hero_bristleback/bristleback_quill_spray_hit_creep.vpcf"
                    "EffectAttachType"    "follow_hitloc"
                    "Target"            "TARGET"
                    "ControlPointEntities"
                    {
                        "TARGET"        "attach_hitloc"
                        "TARGET"        "attach_hitloc"
                        "TARGET"        "attach_hitloc"
                    }
                }
            }

            "OnDestroy"
            {
                "RunScript"
                {
                    "ScriptFile"    "scripts/vscripts/heroes/hero_bristleback/quill_spray.lua"
                    "Function"        "stack_destroyed"
                }
            }
        }

        "modifier_quill_spray_datadriven_stack_hero"
        {
            "IsHidden"        "1"
            "Attributes"    "MODIFIER_ATTRIBUTE_MULTIPLE"
            "Duration"        "%quill_stack_duration"

            "OnCreated"
            {
                "RunScript"
                {
                    "ScriptFile"        "scripts/vscripts/heroes/hero_bristleback/quill_spray.lua"
                    "Function"            "stack_created"
                    "stack_duration"    "%quill_stack_duration"
                    "base_damage"        "%quill_base_damage"
                    "stack_damage"        "%quill_stack_damage"
                    "max_damage"        "%max_damage"
                }

                "FireEffect"
                {
                    "EffectName"        "particles/units/heroes/hero_bristleback/bristleback_quill_spray_impact.vpcf"
                    "EffectAttachType"    "follow_hitloc"
                    "Target"            "TARGET"
                }

                "AttachEffect"
                {
                    "EffectName"        "particles/units/heroes/hero_bristleback/bristleback_quill_spray_hit.vpcf"
                    "EffectAttachType"    "follow_hitloc"
                    "Target"            "TARGET"
                    "ControlPointEntities"
                    {
                        "TARGET"        "attach_hitloc"
                        "TARGET"        "attach_hitloc"
                        "TARGET"        "attach_hitloc"
                        "TARGET"        "attach_hitloc"
                    }
                }
            }

            "OnDestroy"
            {
                "RunScript"
                {
                    "ScriptFile"    "scripts/vscripts/heroes/hero_bristleback/quill_spray.lua"
                    "Function"        "stack_destroyed"
                }
            }
        }

        "modifier_quill_spray_datadriven_determiner"
        {
            "IsHidden"        "1"
            "Duration"        "0.01"

            "OnCreated"
            {
                "RunScript"
                {
                    "ScriptFile"    "scripts/vscripts/heroes/hero_bristleback/quill_spray.lua"
                    "Function"        "determine_debuff"
                }
            }
        }
    }
}

lua файл стандартный, но я на всякий тоже кину:
Код:
--[[
Author: Ragnar Homsar
Date: July 12, 2015
Handles the functionality for creating new invisible Quill Spray debuffs and damaging the target based on the stack count.
]]

function stack_created(params)
    local parent = params.target
    local modifier_ui_handle = parent:FindModifierByName("modifier_quill_spray_datadriven_user_display")

    -- If the visual stack counter modifier doesn't exist on the parent unit, create it.
    if modifier_ui_handle == nil then
        params.ability:ApplyDataDrivenModifier(params.caster, parent, "modifier_quill_spray_datadriven_user_display", nil)
        modifier_ui_handle = parent:FindModifierByName("modifier_quill_spray_datadriven_user_display")
    end

    -- Determine the total damage by adding the base Quill Spray damage to the stack damage multiplied by the number of stacks.
    local final_damage = params.base_damage + (params.stack_damage * modifier_ui_handle:GetStackCount())

    -- If the total damage exceeds the defined maximum damage, clamp it.
    if final_damage > params.max_damage then
        final_damage = params.max_damage
    end

    -- The table containing the information needed for ApplyDamage.
    local damage_table =
    {
        victim = parent,
        attacker = params.caster,
        damage = final_damage,
        damage_type = params.ability:GetAbilityDamageType(),
        damage_flags = DOTA_DAMAGE_FLAG_NONE,
        ability = params.ability,
    }

    ApplyDamage(damage_table)

    -- Increase the visual stack counter debuff's stack count, and reset the duration. True for SetDuration refers to whether or not to inform clients of the duration reset; in this case, we very much want to inform them.
    modifier_ui_handle:IncrementStackCount()
    modifier_ui_handle:SetDuration(params.stack_duration, true)
end

function stack_destroyed(params)
    local parent = params.target
    local modifier_ui_handle = parent:FindModifierByName("modifier_quill_spray_datadriven_user_display")

    -- If a unit dies while still having quill stacks on them, stack_destroyed is called even though the stack counter buff has disappeared due to the unit dying.
    -- This causes an error if we don't check for if the stack counter is nil.
    if modifier_ui_handle ~= nil then
        -- If the unit still has Quill Spray stacks, just decrement the visual counter.
        if modifier_ui_handle:GetStackCount() > 1 then
            modifier_ui_handle:DecrementStackCount()
        -- If the unit has no more Quill Spray stacks, destroy the visual counter.
        elseif modifier_ui_handle:GetStackCount() == 1 then
            modifier_ui_handle:Destroy()
        end
    end
end

-- This is the first modifier that's applied to units hit by Quill Spray. It runs a simple check on the parent unit, and applies the appropriate debuff (for particle effect reasons).
function determine_debuff(params)
    if params.target:IsHero() then
        params.ability:ApplyDataDrivenModifier(params.caster, params.target, "modifier_quill_spray_datadriven_stack_hero", {duration = params.stack_duration})
    elseif params.target:IsCreep() then
        params.ability:ApplyDataDrivenModifier(params.caster, params.target, "modifier_quill_spray_datadriven_stack_creep", {duration = params.stack_duration})
    end
end
 

NeedWay

Активный
5 Сен 2017
128
9
steamcommunity.com
Проект
MIDDLE HERO WAR
Если каким-то образом поможет, то в консоли пишет ошибку об этом предмете: 1542385767816.png
 
Реклама: