Помогите с кодом

GooDDarK

Активный
27 Окт 2017
102
2
steamcommunity.com
Проект
Naruto Wars Reborn
Есть такой код:

Код:
function ModelSwapStart( keys )
	local caster = keys.caster
	local model = keys.model
	local ability = keys.ability
	local projectile_model = keys.projectile_model

	-- Saves the original model and attack capability
	if caster.caster_model == nil then 
		caster.caster_model = caster:GetModelName()
	end
	-- caster.caster_attack = caster:GetAttackCapability()

	-- Sets the new model and projectile
	caster:SetOriginalModel(model)
	-- caster:SetRangedProjectileName(projectile_model)

	-- Sets the new attack type
	-- caster:SetAttackCapability(DOTA_UNIT_CAP_RANGED_ATTACK)
	caster:SwapAbilities("Скилл #1", "Скилл #2", true, false) 
	caster:SwapAbilities("Скилл #3", "Скилл #4", true, false)
end

function ModelSwapEnd( keys )
	local caster = keys.caster

	caster:SwapAbilities("Скилл #1", "Скилл #2", false, true) 
	caster:SwapAbilities("Скилл #3", "Скилл #4", false, true)
	-- caster:SetAttackCapability(caster.caster_attack)
end

function HideWearables( event )
	local hero = event.caster
	local ability = event.ability

	hero.hiddenWearables = {} -- Keep every wearable handle in a table to show them later
  local model = hero:FirstMoveChild()
  while model ~= nil do
    if model:GetClassname() == "dota_item_wearable" then
      model:AddEffects(EF_NODRAW) -- Set model hidden
      table.insert(hero.hiddenWearables, model)
    end
    model = model:NextMovePeer()
  end
end

function ShowWearables( event )
	local hero = event.caster

	for i,v in pairs(hero.hiddenWearables) do
		v:RemoveEffects(EF_NODRAW)
	end
end


function sasunochange( event )
	local caster = event.caster
	local ability = event.ability

	 if caster:HasModifier("modifier_sasuke_talent_3") then
	  local duration = ability:GetLevelSpecialValueFor("talent_duration", ability:GetLevel() -1)
	  ability:ApplyDataDrivenModifier(caster, caster, "modifier_metamorphosis", { duration = duration })
	  else
    local duration = ability:GetLevelSpecialValueFor("duration", ability:GetLevel() -1)
	  ability:ApplyDataDrivenModifier(caster, caster, "modifier_metamorphosis", { duration = duration })
	 end
end

Вроде все правильно, но дота выдает такую ошибку bad argument #1 to 'pairs' (table expected, got nil), в чем может быть проблема?
 
Последнее редактирование модератором:
GooDDarK, у тебя функция HideWearables нигде не вызывается и таблица в герое не инициализируется
 
Заменить все это говно на один модификатор с MODIFIER_PROPERTY_MODEL_CHANGE
 
Реклама: