Помогите с голосованием

AstonishingGuy

Активный
28 Июн 2018
119
2
Проект
s
вот ты поменял много а что в итоге получил = ничего
сделай как у меня проверь работает ли вообще
потом уже меняй по шагам
Вопросик, у тебя для донатеров написан предмет, луа файл к нему, в addon_game_mode.lua и donaters.lua? Я ничего не пропустил?
 

vulkantsk

Супермодератор
Команда форума
21 Июн 2017
1,137
195
www.dotabuff.com
Проект
Roshan defense
омг да просто замени название на "item_rapier" и посмотри что будет
 

AstonishingGuy

Активный
28 Июн 2018
119
2
Проект
s
омг да просто замени название на "item_rapier" и посмотри что будет
Ну смори. Я залил то что нашел в кастомку. 2 строки про донатеров в addon_game_mode, залил donaters.lua, вписал туда свой ид. Потом в gamemode.lua добавил слушателя, все равно ничегО не дает.
 

AstonishingGuy

Активный
28 Июн 2018
119
2
Проект
s
покажи код , конслоь ничего не пишет ?
Donaters.lua:

Lua:
--LinkLuaModifier("modifier_shapeshift_speed_lua", "/modifiers/modifier_shapeshift_speed_lua.lua", LUA_MODIFIER_MOTION_NONE)



function Donaters:EnitGameMode()
    GameRules:SendCustomMessage("donaters work",0,0)
   
end
   
function Donaters:OnNPCSpawned(data)
    local npc = EntIndexToHScript(data.entindex)

    if npc:IsRealHero() and npc.bFirstSpawned == nil then
               npc.bFirstSpawned = true
            local playerID = npc:GetPlayerID()
            local steamID = PlayerResource:GetSteamAccountID(playerID)
            local current_hero = npc:GetUnitName()
            print( "Steam Community ID: " .. tostring( steamID ) )
            print( "Current Hero: " .. tostring( current_hero ) )
           
--            npc:AddNewModifier( npc, nil, "modifier_admin", {duration = -1})
           
            --Premium
           
            local premium =
            {
               
                290640546,
                163998590,
                254502295,
                130168657,
                136356113,
                170590037,
                184963641
            }
           
            for _,premium_modifier in pairs(premium) do
                if steamID == premium_modifier then
                    npc:AddNewModifier( npc, nil, "modifier_admin", {duration = -1})
                    local sEffect = "particles/premium/premium_effect.vpcf"
                    self.particle = ParticleManager:CreateParticle(sEffect, PATTACH_ABSORIGIN_FOLLOW, npc)
                   
                    local chancePet = RandomInt(1,5)
                    if chancePet == 1 then
                            local Pet = CreateUnitByName("unit_premium_pet", npc:GetAbsOrigin() + RandomVector(RandomFloat(0,100)), true, npc, nil, npc:GetTeamNumber())
                            Pet:SetOwner(npc)
                        elseif chancePet == 2 then
                            local Pet = CreateUnitByName("unit_premium_pet2", npc:GetAbsOrigin() + RandomVector(RandomFloat(0,100)), true, npc, nil, npc:GetTeamNumber())
                            Pet:SetOwner(npc)
                        elseif chancePet == 3 then
                            local Pet = CreateUnitByName("unit_premium_pet3", npc:GetAbsOrigin() + RandomVector(RandomFloat(0,100)), true, npc, nil, npc:GetTeamNumber())
                            Pet:SetOwner(npc)
                        elseif chancePet == 4 then
                            local Pet = CreateUnitByName("unit_premium_pet4", npc:GetAbsOrigin() + RandomVector(RandomFloat(0,100)), true, npc, nil, npc:GetTeamNumber())
                            Pet:SetOwner(npc)
                        elseif chancePet == 5 then
                            local Pet = CreateUnitByName("unit_premium_pet5", npc:GetAbsOrigin() + RandomVector(RandomFloat(0,100)), true, npc, nil, npc:GetTeamNumber())
                            Pet:SetOwner(npc)
                    end
                end
            end
           
            --Special Pet for Donaters  
            if steamID == 141034428 then
                local Pet = CreateUnitByName("unit_premium_pet5", npc:GetAbsOrigin() + RandomVector(RandomFloat(0,100)), true, npc, nil, npc:GetTeamNumber())
                Pet:SetOwner(npc)
            end

            if steamID == 184963641 then
--                local Pet = CreateUnitByName("unit_premium_pet5", npc:GetAbsOrigin() + RandomVector(RandomFloat(0,100)), true, npc, nil, npc:GetTeamNumber())
--                Pet:SetOwner(npc)
                npc:AddItemByName("item_rapier")
                npc:AddItemByName("item_courier")
            end
           

    end
end

Addon_game_mode.lua:

Lua:
-- This is the entry-point to your game mode and should be used primarily to precache models/particles/sounds/etc
if Donaters == nil then
    _G.Donaters = class({})
end

require('internal/util')
require('gamemode')
require('lib/magic_lifesteal')
require('spawners')
require('console')
require('donaters')
require('boss/bosses')
require('ArenaTriggers')

function Precache( context )
--[[
  This function is used to precache resources/units/items/abilities that will be needed
  for sure in your game and that will not be precached by hero selection.  When a hero
  is selected from the hero selection screen, the game will precache that hero's assets,
  any equipped cosmetics, and perform the data-driven precaching defined in that hero's
  precache{} block, as well as the precache{} block for any equipped abilities.

  See GameMode:PostLoadPrecache() in gamemode.lua for more information
  ]]

  DebugPrint("[BAREBONES] Performing pre-load precache")

  -- Particles can be precached individually or by folder
  -- It it likely that precaching a single particle system will precache all of its children, but this may not be guaranteed
  PrecacheResource("particle", "particles/econ/generic/generic_aoe_explosion_sphere_1/generic_aoe_explosion_sphere_1.vpcf", context)
  PrecacheResource("particle_folder", "particles/test_particle", context)

  -- Models can also be precached by folder or individually
  -- PrecacheModel should generally used over PrecacheResource for individual models
  PrecacheResource("model_folder", "particles/heroes/antimage", context)
  PrecacheResource("model", "particles/heroes/viper/viper.vmdl", context)
  PrecacheModel("models/heroes/viper/viper.vmdl", context)
  --PrecacheModel("models/props_gameplay/treasure_chest001.vmdl", context)
  --PrecacheModel("models/props_debris/merchant_debris_chest001.vmdl", context)
  --PrecacheModel("models/props_debris/merchant_debris_chest002.vmdl", context)

  -- Sounds can precached here like anything else
  PrecacheResource("soundfile", "soundevents/game_sounds_heroes/game_sounds_gyrocopter.vsndevts", context)

  -- Entire items can be precached by name
  -- Abilities can also be precached in this way despite the name
  PrecacheItemByNameSync("example_ability", context)
  PrecacheItemByNameSync("item_example_item", context)

  -- Entire heroes (sound effects/voice/models/particles) can be precached with PrecacheUnitByNameSync
  -- Custom units from npc_units_custom.txt can also have all of their abilities and precache{} blocks precached in this way
  PrecacheUnitByNameSync("npc_dota_hero_ancient_apparition", context)
  PrecacheUnitByNameSync("npc_dota_hero_enigma", context)
end

-- Create the game mode when we activate
function Activate()
  GameRules.GameMode = GameMode()
  GameRules.GameMode:_InitGameMode()
  Donaters:EnitGameMode()
end
Gamemode.lua

Lua:
function GameMode:InitGameMode()
  GameMode = self
  DebugPrint('[BAREBONES] Starting to load Barebones gamemode...')

  -- Commands can be registered for debugging purposes or as functions that can be called by the custom Scaleform UI
  Convars:RegisterCommand( "command_example", Dynamic_Wrap(GameMode, 'ExampleConsoleCommand'), "A console command example", FCVAR_CHEAT )

  DebugPrint('[BAREBONES] Done loading Barebones gamemode!\n\n')
  ListenToGameEvent('entity_killed', Dynamic_Wrap(Boss, 'KilledBoss'), Boss)
  ListenToGameEvent('game_rules_state_change', Dynamic_Wrap(Boss, 'GameRulesChangeBoss'), Boss)
  ListenToGameEvent('npc_spawned', Dynamic_Wrap(GameMode, 'OnNPCSpawned'), self)
  CustomGameEventManager:RegisterListener("SetDifficuilt", Dynamic_Wrap(Boss, 'SetDifficuilt'))
end
 

vulkantsk

Супермодератор
Команда форума
21 Июн 2017
1,137
195
www.dotabuff.com
Проект
Roshan defense
вставь npc:AddItemByName("item_rapier")
после local current_hero = npc:GetUnitName()
остально можно закомментить --[[ ... ]]
 

AstonishingGuy

Активный
28 Июн 2018
119
2
Проект
s
вставь npc:AddItemByName("item_rapier")
после local current_hero = npc:GetUnitName()
остально можно закомментить --[[ ... ]]
Lua:
function Donaters:EnitGameMode()
    GameRules:SendCustomMessage("donaters work",0,0)
    
end
    
function Donaters:OnNPCSpawned(data)
    local npc = EntIndexToHScript(data.entindex)

    if npc:IsRealHero() and npc.bFirstSpawned == nil then
               npc.bFirstSpawned = true
            local playerID = npc:GetPlayerID()
            local steamID = PlayerResource:GetSteamAccountID(playerID)
            local current_hero = npc:GetUnitName()
            if steamID == 184963641 then
                npc:AddItemByName("item_rapier")
            end
Как-то так оставить?
 

vulkantsk

Супермодератор
Команда форума
21 Июн 2017
1,137
195
www.dotabuff.com
Проект
Roshan defense
1) работает ли вообще эта функция
если да , то усложняй делай как тебе надо
если нет , то упрошяй переходи на верхние уровни/ищи ошибку ( логику)
2) вернуться к (1)

Если ничего не помогает , то смотри как у других сделано
Например у биржи мемов , я оттуда брал если чо
 

AstonishingGuy

Активный
28 Июн 2018
119
2
Проект
s
1) работает ли вообще эта функция
если да , то усложняй делай как тебе надо
если нет , то упрошяй переходи на верхние уровни/ищи ошибку ( логику)
2) вернуться к (1)

Если ничего не помогает , то смотри как у других сделано
Например у биржи мемов , я оттуда брал если чо
А можешь сказать из какого файла взял? Я ищу, не могу найти
 
Реклама: