Пассивка сфа с SpellLibrary

NeedWay

Активный
5 Сен 2017
128
9
steamcommunity.com
Проект
MIDDLE HERO WAR
Хотел сделать скилл на основе пассивки сфа, а оказывается переписанный скрипт не рабочий(
1542532874375.png
Снизу коды(!Ничего не менял, взял с оригинала!):
Код:
"nevermore_necromastery_datadriven"
{
    // General
    //-------------------------------------------------------------------------------------------------------------
    "BaseClass"                "ability_datadriven"
    "AbilityBehavior"                "DOTA_ABILITY_BEHAVIOR_PASSIVE"
    "OnCastbar"                    "0"
    "AbilityTextureName"            "nevermore_necromastery"

    // Special
    //-------------------------------------------------------------------------------------------------------------
    "AbilitySpecial"
    {
        "01"
        {
            "var_type"                        "FIELD_INTEGER"
            "necromastery_damage_per_soul"    "2"
        }
        "02"
        {
            "var_type"                        "FIELD_INTEGER"
            "necromastery_max_souls"    "15 22 29 36"
        }
        "03"
        {
            "var_type"                        "FIELD_FLOAT"
            "necromastery_soul_release"        "0.5"
        }
        "04"
        {
            "var_type"                        "FIELD_INTEGER"
            "necromastery_souls_hero_bonus"    "11"
        }        
    }

    "precache"
    {
        "particle"  "particles/units/heroes/hero_nevermore/nevermore_souls.vpcf"
        "particle"  "particles/units/heroes/hero_nevermore/nevermore_necro_souls.vpcf"
        "soundfile" "soundevents/game_sounds_heroes/game_sounds_nevermore.vsndevts"
    }

    "OnOwnerDied"
    {
        "RunScript"
        {
            "ScriptFile"    "heroes/hero_nevermore/necromastery.lua"
            "Function"        "NecromasteryDeath"
            "modifier"        "modifier_necromastery"
        }
    }

    "Modifiers"
    {
        "modifier_soul_collector"
        {
            "Passive"            "1"
            "IsHidden"            "1"
    
            "EffectName"        "particle_name"
            "EffectAttachType"    "follow_origin"

            "OnKill"
            {
                "FireEffect"
                {
                    "EffectName"        "particles/units/heroes/hero_nevermore/nevermore_necro_souls.vpcf"
                    "EffectAttachType"  "follow_origin"
                    "Target"            "TARGET" //DEADFLAG?
                }

                "RunScript"
                {
                    "ScriptFile"    "heroes/hero_nevermore/necromastery.lua"
                    "Function"        "NecromasteryStack"
                    "modifier"        "modifier_necromastery"
                }
            }
        }

        "modifier_necromastery"
        {
            "Attributes"        "MODIFIER_ATTRIBUTE_MULTIPLE | MODIFIER_ATTRIBUTE_PERMANENT"

            "EffectName"        "particles/units/heroes/hero_nevermore/nevermore_souls.vpcf"
            "EffectAttachType"    "follow_origin"

            "Properties"
            {
                "MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE"        "%necromastery_damage_per_soul"
            }
        }
    }
}

vscript:
Код:
--[[
    Author: Noya
    Date: April 5, 2015
    Lose some of the modifier charges stored
    TODO: Check if floor or ceil
]]
function NecromasteryDeath( event )
    local caster = event.caster
    local ability = event.ability
    local modifier = event.modifier
    local necromastery_soul_release = ability:GetLevelSpecialValueFor( "necromastery_soul_release", ability:GetLevel() - 1 )

    local current_stack = caster:GetModifierStackCount( modifier, ability )
    if current_stack then
        target:SetModifierStackCount( modifierName, ability, math.ceil(current_stack * necromastery_soul_release) )
    end
end

--[[
    Author: Noya
    Date: April 5, 2015
    Adds to the modified stacks when a unit is killed, limited by a max_souls.
    TODO: Confirm that SetModifierStackCount adds the damage instances without the need to apply shit
]]
function NecromasteryStack( event )
    local caster = event.caster
    local target = event.unit
    local modifier = event.modifier
    local ability = event.ability
    
    local souls_hero_bonus = ability:GetLevelSpecialValueFor( "necromastery_souls_hero_bonus", ability:GetLevel() - 1 )
    local max_souls = ability:GetLevelSpecialValueFor( "necromastery_max_souls", ability:GetLevel() - 1 )

    -- Check how many stacks can be granted
    local souls_gained = 1
    if target:IsRealHero() then
        souls_gained = souls_gained + souls_hero_bonus
    end

    -- Check if the hero already has the modifier
    local current_stack = caster:GetModifierStackCount( modifier, ability )
    if not current_stack then
        ability:ApplyDataDrivenModifier(caster, caster, modifier, {})
        current_stack = 0
    end

    -- Set the stack up to max_souls
    if (current_stack + souls_gained) <= max_souls then
        caster:SetModifierStackCount( modifier, ability, current_stack + souls_gained )
    else
        caster:SetModifierStackCount( modifier, ability, max_souls )
    end
end
[/spoiler]

Я так понимаю, что он обращается к не заданной переменной target? Как тогда ее задать?
 

Вложения

  • 1542532862659.png
    1542532862659.png
    162.3 KB · Просмотры: 2

stranger568

Активный
7 Сен 2015
113
28
bmemov.ru
Проект
Birzha Memov
target:SetModifierStackCount( modifierName, ability, math.ceil(current_stack * necromastery_soul_release) )
Измени target на caster
 
Реклама: