Замена модели лайновых крипов на героев

Mirurin

Новичок
21 Дек 2020
6
0
Есть кастомка на основе обычной доты. Хочу заменить модели крипов на лайнах на модели героев (например: АМа, ЦМку). Пытался поменять в npc_units.txt, но там класс npc_dota_creep_lane в котором не пропишешь AttachWearables как в npc_dota_creature. Есть ли способ поменять модель крипов на героя?
 
Есть кастомка на основе обычной доты. Хочу заменить модели крипов на лайнах на модели героев (например: АМа, ЦМку). Пытался поменять в npc_units.txt, но там класс npc_dota_creep_lane в котором не пропишешь AttachWearables как в npc_dota_creature. Есть ли способ поменять модель крипов на героя?
Через скрипт найди всех юнитов класса npc_dota_creep_lane и по GetUnitName проверяешь милли или ренж крип, затем одеваешь на него prop_dynamic с нужной моделью
 
  • Нравится
Реакции: Mirurin
Через скрипт найди всех юнитов класса npc_dota_creep_lane и по GetUnitName проверяешь милли или ренж крип, затем одеваешь на него prop_dynamic с нужной моделью
А можно поподробней как это всё сделать? А то я ещё только учусь
 
А можно поподробней как это всё сделать? А то я ещё только учусь
[HIDE]
Lua:
function CustomGame:InitGameMode()
    ListenToGameEvent("npc_spawned", Dynamic_Wrap(CustomGame, "OnNPCSpawned"), self) -- делаем слушатель, который триггерится при спавне юнита
end
function CustomGame:OnNPCSpawned(keys)
    local npc = EntIndexToHScript(keys.entindex) -- записываем всех юнитов как NPC
    local creeps = "npc_dota_creep_lane" -- крипы
    local siege = "npc_dota_creep_siege" -- катапульта
    if npc:GetClassName() == creeps then -- если у юнита класс крипа
        if npc:GetAttackCapability() == DOTA_UNIT_CAP_MELEE_ATTACK then -- и если он милишник
            local AntimageWeapon = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "МОДЕЛЬКА_ДО_ТВОЕЙ_НУЖНОЙ_МОДЕЛИ.vmdl"}) -- заспавнить модель
            AntimageWeapon:FollowEntity(npc, true) -- привязать модель
        elseif npc:GetAttackCapability() == DOTA_UNIT_CAP_RANGED_ATTACK then -- но если он ренжевик
            local TechiesWeapon = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "models/heroes/techies/techies_spleen_weapon.vmdl"}) -- заспавнить модель
            TechiesWeapon:FollowEntity(npc, true) -- привязать модель
        end
    end
    if npc:GetClassName() == siege then -- если это катапульта
        local TechiesWeapon = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "models/heroes/techies/techies_spleen_weapon.vmdl"}) -- заспавнить модель
        TechiesWeapon:FollowEntity(npc, true) -- привязать модель
    end
end
[/HIDE]
 
  • Нравится
Реакции: Mirurin
Написал комментарий на 66 строке, что я изменил и зачем
[HIDE]
Lua:
_G.ADDON_FOLDER = debug.getinfo(1,"S").source:sub(2,-37)
_G.PUBLISH_DATA = LoadKeyValues(ADDON_FOLDER:sub(5,-16).."publish_data.txt") or {}
_G.WORKSHOP_TITLE = PUBLISH_DATA.title or "Таланты x10/Talents x10"-- LoadKeyValues(debug.getinfo(1,"S").source:sub(7,-53).."publish_data.txt").title
_G.MAX_LEVEL = 30

_G.GameMode = _G.GameMode or class({})

require("internal/utils/util")
require("internal/init")

require("internal/courier") -- EditFilterToCourier called from internal/filters

require("internal/utils/butt_api")
require("internal/utils/custom_gameevents")
require("internal/utils/particles")
require("internal/utils/timers")
-- require("internal/utils/notifications") -- will test it tomorrow

require("internal/events")
require("internal/filters")
require("internal/panorama")
require("internal/shortcuts")
require("internal/talents")
require("internal/thinker")
require("internal/xp_modifier")

softRequire("events")
softRequire("filters")
softRequire("settings_butt")
softRequire("settings_misc")
softRequire("startitems")
softRequire("thinker")

function Precache( context )
    FireGameEvent("addon_game_mode_precache",nil)
    PrecacheResource("soundfile", "soundevents/custom_sounds.vsndevts", context)
    --[[
        Precache things we know we'll use.  Possible file types include (but not limited to):
            PrecacheResource( "model", "*.vmdl", context )
            PrecacheResource( "particle", "*.vpcf", context )
            PrecacheResource( "particle_folder", "particles/folder", context )
    ]]
end

function Spawn()
    FireGameEvent("addon_game_mode_spawn",nil)
    local gmE = GameRules:GetGameModeEntity()

    gmE:SetUseDefaultDOTARuneSpawnLogic(true)
    gmE:SetTowerBackdoorProtectionEnabled(true)
    GameRules:SetShowcaseTime(0)

    FireGameEvent("created_game_mode_entity",{gameModeEntity = gmE})
end

function Activate()
    FireGameEvent("addon_game_mode_activate",nil)
    -- GameRules.GameMode = GameMode()
    -- FireGameEvent("init_game_mode",{})
end

ListenToGameEvent("addon_game_mode_activate", function()
    print( "Dota Butt Template is loaded." )
end, nil)

function GameMode:InitGameMode() -- По дефолту вместо GameMode стоит CAddonTemplateGameMode, но у тебя кастомка "по хорошему одолжена" у талантов х10, я написал CustomGame думая, что ты заменишь его на свой
    ListenToGameEvent("npc_spawned", Dynamic_Wrap(GameMode, "OnNPCSpawned"), self) -- делаем слушатель, который триггерится при спавне юнита
end

function GameMode:OnNPCSpawned(keys)
    local npc = EntIndexToHScript(keys.entindex)
    local creeps = "npc_dota_creep_lane"
    local siege = "npc_dota_creep_siege"
    if npc:GetClassName() == creeps then
        if npc:GetAttackCapability() == DOTA_UNIT_CAP_MELEE_ATTACK then
            local AntimageWeapon = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "models/heroes/antimage/antimage_weapon.vmdl"})
            AntimageWeapon:FollowEntity(npc, true)
        elseif npc:GetAttackCapability() == DOTA_UNIT_CAP_RANGED_ATTACK then
            local TechiesWeapon = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "models/heroes/techies/techies_spleen_weapon.vmdl"})
            TechiesWeapon:FollowEntity(npc, true)
        end
    end
    if npc:GetClassName() == siege then
        local TechiesWeapon = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "models/heroes/techies/techies_spleen_weapon.vmdl"})
        TechiesWeapon:FollowEntity(npc, true)
    end
end
[/HIDE]
 
Реклама: