Модификатор-LUA, действующий от модификаторов DataDriven

I_GRIN_I

Друзья CG
15 Мар 2016
1,335
105
EnDronist, сделай как я написал, это почти одно и тоже, только с проверкой.
 

EnDronist

Продвинутый
28 Апр 2016
231
0
Проект
Защитники Изобилия | Defenders of Abundance
[quote author=I_GRIN_I link=topic=922.msg4642#msg4642 date=1464622957]
EnDronist, сделай как я написал, это почти одно и тоже, только с проверкой.
[/quote]
Не, та же самая проблема.
Как стакать такие модификаторы? Срочно нужно.
Или мне делать 9 модификаторов?
 

I_GRIN_I

Друзья CG
15 Мар 2016
1,335
105
Я же написал тебе...

Вот так стакать:
Код:
function modifier_item_arcane_armlet_active_tick:GetAttributes ()
  return MODIFIER_ATTRIBUTE_MULTIPLE
end
 

EnDronist

Продвинутый
28 Апр 2016
231
0
Проект
Защитники Изобилия | Defenders of Abundance
А что у тебя произошло с репой?)
Вчера была -47, сейчас +430
 

EnDronist

Продвинутый
28 Апр 2016
231
0
Проект
Защитники Изобилия | Defenders of Abundance
[quote author=I_GRIN_I link=topic=922.msg4651#msg4651 date=1464684812]
Я же написал тебе...

Вот так стакать:
Код:
function modifier_item_arcane_armlet_active_tick:GetAttributes ()
  return MODIFIER_ATTRIBUTE_MULTIPLE
end
[/quote]
Теперь я понял, что это значит, сяп)
7xadvOKZ0_8.jpg

Хорошо, интеллект прибавляется, дальность каста способностей не прибавляется:
Код:
modifier_item_arcane_armlet_active_tick = class({})

if modifier_item_arcane_armlet_active_tick == nil then
	modifier_item_arcane_armlet_active_tick = class({})
end

function modifier_item_arcane_armlet_active_tick:IsHidden()
	return false
end

function modifier_item_arcane_armlet_active_tick:GetTexture()
  return "omniknight_repel"
end

function modifier_item_arcane_armlet_active_tick:DeclareFunctions()
	local funcs = {
		MODIFIER_PROPERTY_STATS_INTELLECT_BONUS ,
		MODIFIER_PROPERTY_CAST_RANGE_BONUS ,
	}
	return funcs
end

function modifier_item_arcane_armlet_active_tick:GetAttributes()
  return MODIFIER_ATTRIBUTE_MULTIPLE
end

function modifier_item_arcane_armlet_active_tick:GetModifierBonusStats_Intellect(params) 
	return 2.78
end

function modifier_item_arcane_armlet_active_tick:GetModifierCastRangeBonus(params) 
	return 13.89
end
Я так понял, эта та же проблема, что и с GetModifierSpellAmplify_Percentage ?)
 
Последнее редактирование модератором:

Adam Smith

Друзья CG
4 Окт 2014
473
2
[quote author=EnDronist link=topic=922.msg4653#msg4653 date=1464688861]
Теперь я понял, что это значит, сяп)
7xadvOKZ0_8.jpg

Хорошо, интеллект прибавляется, дальность каста способностей не прибавляется:
Код:
modifier_item_arcane_armlet_active_tick = class({})

if modifier_item_arcane_armlet_active_tick == nil then
	modifier_item_arcane_armlet_active_tick = class({})
end

function modifier_item_arcane_armlet_active_tick:IsHidden()
	return false
end

function modifier_item_arcane_armlet_active_tick:GetTexture()
  return "omniknight_repel"
end

function modifier_item_arcane_armlet_active_tick:DeclareFunctions()
	local funcs = {
		MODIFIER_PROPERTY_STATS_INTELLECT_BONUS ,
		MODIFIER_PROPERTY_CAST_RANGE_BONUS ,
	}
	return funcs
end

function modifier_item_arcane_armlet_active_tick:GetAttributes()
  return MODIFIER_ATTRIBUTE_MULTIPLE
end

function modifier_item_arcane_armlet_active_tick:GetModifierBonusStats_Intellect(params) 
	return 2.78
end

function modifier_item_arcane_armlet_active_tick:GetModifierCastRangeBonus(params) 
	return 13.89
end
Я так понял, эта та же проблема, что и с GetModifierSpellAmplify_Percentage ?)
[/quote]
Да, это не работает, однако я решил и эту проблему
Код:
function modifier_item_echoe_shield:OnCreated(params)
  if IsServer() then
    self:GetParent():AddNewModifier(self:GetParent(), self:GetAbility(), "modifier_item_aether_lens", nil)
  end
end

function modifier_item_echoe_shield:OnDestroy(params)
  if IsServer() then
    if self:GetParent():HasModifier("modifier_item_aether_lens") then
      self:GetParent():RemoveModifierByName("modifier_item_aether_lens")
    end
  end
end
 
Последнее редактирование модератором:

EnDronist

Продвинутый
28 Апр 2016
231
0
Проект
Защитники Изобилия | Defenders of Abundance
[quote author=Adam Smith link=topic=922.msg4654#msg4654 date=1464690296]
Да, это не работает, однако я решил и эту проблему
Код:
function modifier_item_echoe_shield:OnCreated(params)
  if IsServer() then
    self:GetParent():AddNewModifier(self:GetParent(), self:GetAbility(), "modifier_item_aether_lens", nil)
  end
end

function modifier_item_echoe_shield:OnDestroy(params)
  if IsServer() then
    if self:GetParent():HasModifier("modifier_item_aether_lens") then
      self:GetParent():RemoveModifierByName("modifier_item_aether_lens")
    end
  end
end
[/quote]
Получится дико некрасивое действие, но хоть рабочее.
Ещё одна проблемка, вот:
3HQ_aMUvRO8.jpg

Каждый раз после смены предмета он считается за новый и даёт возможность его разобрать или продать за фул цену, как исправить?
 
Последнее редактирование модератором:

EnDronist

Продвинутый
28 Апр 2016
231
0
Проект
Защитники Изобилия | Defenders of Abundance
[quote author=RecoveryIt link=topic=922.msg4656#msg4656 date=1464691544]
Код:
item:SetPurchaseTime(0)
[/quote]
Код:
function swap_to_item(keys, ItemName)
	for i=0, 5, 1 do --Fill all empty slots in the player's inventory with "dummy" items.
		local current_item = keys.caster:GetItemInSlot(i)
		if current_item == nil then
			keys.caster:AddItem(CreateItem("item_dummy_datadriven", keys.caster, keys.caster))
		end
	end

	keys.caster:RemoveItem(keys.ability)
	keys.caster:AddItem(CreateItem(ItemName, keys.caster, keys.caster)) --This should be put into the same slot that the removed item was in.

	for i=0, 5, 1 do --Remove all dummy items from the player's inventory.
		local current_item = keys.caster:GetItemInSlot(i)
		if current_item ~= nil then
			if current_item:GetName() == "item_dummy_datadriven" then
				keys.caster:RemoveItem(current_item)
			end
			if current_item:GetName() == ItemName then
				current_item:SetPurchaseTime(0)
			end
		end
	end
end
Код:
[ W VScript       ]: Script Runtime Error: ...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:20: This object has been deleted from C++ and no longer exists. (Use :IsNull() to detect this.)
[ W VScript       ]: stack traceback:
[ W VScript       ]: 	[C]: in function 'GetName'
[ W VScript       ]: 	...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:20: in function 'swap_to_item'
[ W VScript       ]: 	...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:34: in function <...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:33>
 
Последнее редактирование модератором:

RecoveryIt

Активный
7 Май 2016
75
0
[quote author=EnDronist link=topic=922.msg4657#msg4657 date=1464692080]
Код:
function swap_to_item(keys, ItemName)
	for i=0, 5, 1 do --Fill all empty slots in the player's inventory with "dummy" items.
		local current_item = keys.caster:GetItemInSlot(i)
		if current_item == nil then
			keys.caster:AddItem(CreateItem("item_dummy_datadriven", keys.caster, keys.caster))
		end
	end

	keys.caster:RemoveItem(keys.ability)
	keys.caster:AddItem(CreateItem(ItemName, keys.caster, keys.caster)) --This should be put into the same slot that the removed item was in.

	for i=0, 5, 1 do --Remove all dummy items from the player's inventory.
		local current_item = keys.caster:GetItemInSlot(i)
		if current_item ~= nil then
			if current_item:GetName() == "item_dummy_datadriven" then
				keys.caster:RemoveItem(current_item)
			end
			if current_item:GetName() == ItemName then
				current_item:SetPurchaseTime(0)
			end
		end
	end
end
Код:
[ W VScript       ]: Script Runtime Error: ...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:20: This object has been deleted from C++ and no longer exists. (Use :IsNull() to detect this.)
[ W VScript       ]: stack traceback:
[ W VScript       ]: 	[C]: in function 'GetName'
[ W VScript       ]: 	...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:20: in function 'swap_to_item'
[ W VScript       ]: 	...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:34: in function <...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:33>
[/quote]

у тебя в скрипте сначало удаляется предмет, потом ты пытаешься сделать ему время покупки 0, следовательно ошибка.
Заноси только что добавленный айтем в локалку, и сразу же устанавливай ей время покупки на 0, а потом делай все остальное, должно сработать.
 
Последнее редактирование модератором:

EnDronist

Продвинутый
28 Апр 2016
231
0
Проект
Защитники Изобилия | Defenders of Abundance
у тебя в скрипте сначало удаляется предмет, потом ты пытаешься сделать ему время покупки 0, следовательно ошибка.
Заноси только что добавленный айтем в локалку, и сразу же устанавливай ей время покупки на 0, а потом делай все остальное, должно сработать.
Там же видно, что сначала идёт AddItem, а потом уже SetPurchaseTime.
Ты мне код напиши, я разберусь
P.S. Вот код:
Код:
function item_arcane_armlet_sell(keys)
	if keys.caster:HasModifier("modifier_item_arcane_armlet_sell") then
		keys.ability:SetPurchaseTime(0)
		keys.ability:DisassembleItem(0) -- Проблема сейчас тут
	end
end
 
Последнее редактирование модератором:

RecoveryIt

Активный
7 Май 2016
75
0
[quote author=EnDronist link=topic=922.msg4677#msg4677 date=1464736684]
Там же видно, что сначала идёт AddItem, а потом уже SetPurchaseTime.
Ты мне код напиши, я разберусь
P.S. Вот код:
Код:
function item_arcane_armlet_sell(keys)
	if keys.caster:HasModifier("modifier_item_arcane_armlet_sell") then
		keys.ability:SetPurchaseTime(0)
		keys.ability:DisassembleItem(0) -- Проблема сейчас тут
	end
end
[/quote]

Код:
]: Script Runtime Error: ...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:20: This object has been deleted from C++ and no longer exists. (Use :IsNull() to detect this.)
Эта ошибка говорит тебе что ты пытаешься что-то сделать с объектом который был удален ранее.
Попробуй поменяй эту строчку
Код:
keys.caster:AddItem(CreateItem(ItemName, keys.caster, keys.caster)) --This should be put into the same slot that the removed item was in.
на две следующих:
Код:
local trueItem = CreateItem(ItemName, keys.caster, keys.caster) --This should be put into the same slot that the removed item was in.
keys.caster:AddItem(trueItem)
И сразу же устанавливай время покупки на 0
Код:
trueItem:SetPurchaseTime(0)
 
Последнее редактирование модератором:

EnDronist

Продвинутый
28 Апр 2016
231
0
Проект
Защитники Изобилия | Defenders of Abundance
[quote author=RecoveryIt link=topic=922.msg4684#msg4684 date=1464777867]
Код:
]: Script Runtime Error: ...dons\test1\scripts\vscripts\items\item_arcane_armlet.lua:20: This object has been deleted from C++ and no longer exists. (Use :IsNull() to detect this.)
Эта ошибка говорит тебе что ты пытаешься что-то сделать с объектом который был удален ранее.
Попробуй поменяй эту строчку
Код:
keys.caster:AddItem(CreateItem(ItemName, keys.caster, keys.caster)) --This should be put into the same slot that the removed item was in.
на две следующих:
Код:
local trueItem = CreateItem(ItemName, keys.caster, keys.caster) --This should be put into the same slot that the removed item was in.
keys.caster:AddItem(trueItem)
И сразу же устанавливай время покупки на 0
Код:
trueItem:SetPurchaseTime(0)
[/quote]
Да я уже без тебя разобрался, а что с временем разбирания на части? Оно не робит
Код:
keys.ability:DisassembleItem(0)
 

I_GRIN_I

Друзья CG
15 Мар 2016
1,335
105
EnDronist,
Код:
DisassembleItem(hItem)
В параметр нужно не 0 передавать, а айтем, который нельзя разбирать. Тоесть примерно так:
Код:
DisassembleItem(trueItem)
 

CryDeS

Друзья CG
14 Июл 2015
1,210
11
[quote author=I_GRIN_I link=topic=922.msg4688#msg4688 date=1464789235]
EnDronist,
Код:
DisassembleItem(hItem)
В параметр нужно не 0 передавать, а айтем, который нельзя разбирать. Тоесть примерно так:
Код:
DisassembleItem(trueItem)
[/quote]
А ничего что эта команда разберет предмет нахрен?
item:SetPurchaseTime(0) вам в помощь.
 
Реклама: