Решено Не респавнится юнит (раньше всё было норм)

Setinder

Пользователь
23 Авг 2022
28
1
Хотел продолжить делать кастомку, скачал обнову с бп и патчем. Захожу в хамер, а там нету моделей у крипов(npc_dota_base) и листа с доступными юнитами (подумал ладно ничо страшного). Настроил своего кастомного юнита до конца, и заметил что после смерти он не ресается, но до этого (до обнов крупных) возрождался. CanRespawn 1 писал. Изменил в юните только модель (поставил другие скины). Возможно я дебич, но прошу помочь.​
KV:
"npc_dota_Boss"
    {
        "BaseClass" "npc_dota_creature"
        "Model" "models/heroes/earth_spirit/earth_spirit.vmdl"
        "ModelScale"      "2" //размер модели
        "SoundSet"                    "Creep_Bad_Melee"                    // Name of sound set.
       
        "Level"                        "50"
        "IsAncient"          "1"
        // Abilities
        //----------------------------------------------------------------
       
        "Ability1"                    ""            // Ability 1.
        "Ability2"                    ""            // Ability 2.
        "Ability3"                    ""            // Ability 3.
        "Ability4"                    ""            // Ability 4.
        "Ability5"                    ""            // Ability 5.
        "Ability6"                    ""            // Ability 6 - Extra.
        "Ability7"                    ""            // Ability 7 - Extra.
        "Ability8"                    ""            // Ability 8 - Extra.
        "MinimapIcon"        "minimap_candybucket"

        "MinimapIconSize"      "1000"

        // Armor
        //----------------------------------------------------------------
        "ArmorPhysical"                "20"            // Physical protection.
        "MagicalResistance"                "50"            // Magical protection.

        // Attack
        //----------------------------------------------------------------
        "AttackCapabilities"        "DOTA_UNIT_CAP_MELEE_ATTACK"
        "AttackDamageMin"            "190"        // Damage range min.
        "AttackDamageMax"            "230"        // Damage range max.
        "AttackDamageType"            "DAMAGE_TYPE_ArmorPhysical"
        "AttackRate"                "1"            // Speed of attack.
        "AttackAnimationPoint"        "0.467"        // Normalized time in animation cycle to attack.
        "AttackAcquisitionRange"    "500"        // Range within a target can be acquired.
        "AttackRange"                "100"        // Range within a target can be attacked.
        "ProjectileModel"            ""            // Particle system model for projectile.
        "ProjectileSpeed"            ""            // Speed of projectile.

        // Attributes
        //----------------------------------------------------------------
        "AttributePrimary"            "DOTA_ATTRIBUTE_STRENGTH"
        "AttributeBaseStrength"        "0"            // Base strength
        "AttributeStrengthGain"        "0"            // Strength bonus per level.
        "AttributeBaseIntelligence"    "0"            // Base intelligence
        "AttributeIntelligenceGain"    "0"            // Intelligence bonus per level.
        "AttributeBaseAgility"        "0"            // Base agility
        "AttributeAgilityGain"        "0"            // Agility bonus per level.

        // Bounty
        //----------------------------------------------------------------
        "BountyXP"                    "3000"        // Experience earn.
        "BountyGoldMin"                "1000"        // Gold earned min.
        "BountyGoldMax"                "1200"        // Gold earned max.

        // Bounds
        //----------------------------------------------------------------
        "BoundsHullName"            "DOTA_HULL_SIZE_REGULAR"            // Hull type used for navigation/locomotion.
        "RingRadius"                "45"
        "HealthBarOffset"            "130"

        // Movement
        //----------------------------------------------------------------
        "MovementCapabilities"        "DOTA_UNIT_CAP_MOVE_GROUND"            // Type of locomotion - ground, air
        "MovementSpeed"                "270"        // Speed
        "MovementTurnRate"            "0.5"        // Turning rate.

        // Status
        //----------------------------------------------------------------
        "StatusHealth"                "11000"        // Base health.
        "StatusHealthRegen"            "0.5"        // Health regeneration rate.
        "StatusMana"                "1000"            // Base mana.
        "StatusManaRegen"            "0"            // Mana regeneration rate.

        // Team
        //----------------------------------------------------------------
        "TeamName"                    "DOTA_TEAM_NEUTRALS"            // Team name.
        "CombatClassAttack"            "DOTA_COMBAT_CLASS_ATTACK_BASIC"
        "CombatClassDefend"            "DOTA_COMBAT_CLASS_DEFEND_SOFT"
        "UnitRelationshipClass"        "DOTA_NPC_UNIT_RELATIONSHIP_TYPE_DEFAULT"
       
        // Vision
        //----------------------------------------------------------------
        "VisionDaytimeRange"        "850"        // Range of vision during day light.
        "VisionNighttimeRange"        "800"        // Range of vision at night time.
       "CanRespawn"                "1"
        "TeamName"                                    "DOTA_TEAM_NEUTRALS"
        "CombatClassAttack"                           "DOTA_COMBAT_CLASS_ATTACK_HERO"
        "CombatClassDefend"                           "DOTA_COMBAT_CLASS_DEFEND_HERO"
        "UnitRelationshipClass"                       "DOTA_NPC_UNIT_RELATIONSHIP_TYPE_HERO"
        //Inventory
        "HasInventory"        "1"
        "Creature"
        {
           
            "DisableClumpingBehavior"    "1"  
             "DisableWearables"    "1"
        "AttachWearables"//Bindings of the Battleranger // Шмотки, опишу ниже
        {
        "Wearable1" {"ItemDef" "13393"}//("Bow of the Battleranger")
        "Wearable2" {"ItemDef" "13390"}//offhand_weapon("Quiver of the Battleranger")
        "Wearable3" {"ItemDef" "13389"}//head("Style of the Battleranger")
        "Wearable4" {"ItemDef" "13391"}//back("Cloak of the Battleranger")
        "Wearable5" {"ItemDef" "13392"}//shoulder("Pauldrons of the Battleranger")
        "Wearable6" {"ItemDef" "0"}//head
        }
        }
    }
 
Насчёт невидимости юнитов в хаммере я сам незнаю(такая-же проблема).
А насчёт респавна можешь скрипт от вулкана взять на респавн там всё точно работает.
Ок,( если не сложно скинь скрипт). Буду ждать фиксов от валв.
 
мне лень искать крч
делаешь файл units.lua
Lua:
function Respoint (keys )
    Timers:CreateTimer(0.1,function()          

        local caster = keys.caster     --пробиваем IP усопшего
        caster.respoint = caster:GetAbsOrigin() -- определяем точку спавна
    end)
end

function Respawn (keys )
    local caster= keys.caster                --пробиваем IP усопшего
    local point = caster.respoint            -- пробиваем адрес дома
    local team= caster:GetTeamNumber()      --пробиваем команду терпилы
    local name= caster:GetUnitName()         --Пробиваем имя покойного
    Timers:CreateTimer(5,function()              --Через сколько секунд появится новый фраер(5)
    local unit = CreateUnitByName(name, point + RandomVector( RandomFloat( 0, 50)), true, nil, nil, team)
-- создаем нового пацыка по трем аргументам ( имя покойного ,адрес дома ,true,nil,nil,команда терпилы)
    end)
end
кидаешь в vscripts
Посмотреть вложение 1650
берёшь timers от брм
Lua:
TIMERS_THINK = 0.01

if Timers == nil then
    print ( '[Timers] creating Timers' )
    Timers = {}
    Timers.__index = Timers
end

function Timers:new( o )
    o = o or {}
    setmetatable( o, Timers )
    return o
end

function Timers:start()
    Timers = self
    self.timers = {}

    local ent = Entities:CreateByClassname("info_target") -- Entities:FindByClassname(nil, 'CWorld')
    ent:SetThink("Think", self, "timers", TIMERS_THINK)
end

function Timers:Think()
    if GameRules:State_Get() >= DOTA_GAMERULES_STATE_POST_GAME then
        return
    end

    -- Track game time, since the dt passed in to think is actually wall-clock time not simulation time.
    local now = GameRules:GetGameTime()

    -- Process timers
    for k,v in pairs(Timers.timers) do
        local bUseGameTime = true
        if v.useGameTime ~= nil and v.useGameTime == false then
            bUseGameTime = false
        end
        local bOldStyle = false
        if v.useOldStyle ~= nil and v.useOldStyle == true then
            bOldStyle = true
        end

        local now = GameRules:GetGameTime()
        if not bUseGameTime then
            now = Time()
        end

        if v.endTime == nil then
            v.endTime = now
        end
        -- Check if the timer has finished
        if now >= v.endTime then
            -- Remove from timers list
            Timers.timers[k] = nil

            -- Run the callback
            local status, nextCall = pcall(v.callback, GameRules:GetGameModeEntity(), v)

            -- Make sure it worked
            if status then
                -- Check if it needs to loop
                if nextCall then
                    -- Change its end time

                    if bOldStyle then
                        v.endTime = v.endTime + nextCall - now
                    else
                        v.endTime = v.endTime + nextCall
                    end

                    Timers.timers[k] = v
                end

                -- Update timer data
                --self:UpdateTimerData()
            else
                -- Nope, handle the error
                Timers:HandleEventError('Timer', k, nextCall)
            end
        end
    end

    return TIMERS_THINK
end

function Timers:HandleEventError(name, event, err)
    print(err)

    -- Ensure we have data
    name = tostring(name or 'unknown')
    event = tostring(event or 'unknown')
    err = tostring(err or 'unknown')

    -- Tell everyone there was an error
    --Say(nil, name .. ' threw an error on event '..event, false)
    --Say(nil, err, false)

    -- Prevent loop arounds
    if not self.errorHandled then
        -- Store that we handled an error
        self.errorHandled = true
    end
end

function Timers:CreateTimer(name, args)
    if type(name) == "function" then
        args = {callback = name}
        name = DoUniqueString("timer")
    elseif type(name) == "table" then
        args = name
        name = DoUniqueString("timer")
    elseif type(name) == "number" then
        args = {endTime = name, callback = args}
        name = DoUniqueString("timer")
    end
    if not args.callback then
        print("Invalid timer created: "..name)
        return
    end


    local now = GameRules:GetGameTime()
    if args.useGameTime ~= nil and args.useGameTime == false then
        now = Time()
    end

    if args.endTime == nil then
        args.endTime = now
    elseif args.useOldStyle == nil or args.useOldStyle == false then
        args.endTime = now + args.endTime
    end

    Timers.timers[name] = args

    return name
end

function Timers:RemoveTimer(name)
    Timers.timers[name] = nil
end

function Timers:RemoveTimers(killAll)
    local timers = {}

    if not killAll then
        for k,v in pairs(Timers.timers) do
            if v.persist then
                timers[k] = v
            end
        end
    end

    Timers.timers = timers
end

Timers:start()

ну в аддон луа подключаешь этот timers
require ("timers")
и дальше просто создаешь абилку
Lua:
    "Respawn"
    {
        "BaseClass" "ability_datadriven"
        "AbilityTextureName"    "ability_name"
        "AbilityBehavior"    "DOTA_ABILITY_BEHAVIOR_PASSIVE|DOTA_ABILITY_BEHAVIOR_HIDDEN"
   
        "OnCreated" //Когда юнит появляется
        {
            "RunScript" //Запускается скрипт
            {
                "ScriptFile"    "scripts/vscripts/units.lua"
                "Function"    "Respoint"
            }
        }
   
        "OnOwnerDied" //Когда юнит умирает
        {
            "RunScript" //Запускается скрипт
            {
                "ScriptFile"    "scripts/vscripts/units.lua"
                "Function"    "Respawn"
            }
        }
   
    }
Ну и вставляешь эту абилку своему юниту
спс
 
Реклама: