Всем привет! Я недавно начал заниматься разработкой карт, нашёл интересный скрипт в гайдах.
Хочу сделать так, что-бы когда герой входил в триггер, срабатывал этот скрипт
Лучше сразу, весь скрипт
Это должно быть вот так?
Или так?
Хочу сделать так, что-бы когда герой входил в триггер, срабатывал этот скрипт
Лучше сразу, весь скрипт
Код:
function ResetAllAbilitiesCooldown(table unit, bool refresh_items)
local abilities = unit:GetAbilityCount()
for i = 0, abilities-1 do
local ability = unit:GetAbilityByIndex(i)
if ability and not ability:IsCooldownReady() then
ability:EndCooldown()
end
end
if unit:HasInventory() and refresh_items then
for i = 0, 5 do
local item = unit:GetItemInSlot(i)
if item and not item:IsCooldownReady() then
item:EndCooldown()
end
end
end
end
Код:
function OnStartTouch(trigger)
print(trigger.activator)
print(trigger.caller)
end -- надо писать или нет?
function ResetAllAbilitiesCooldown(table unit, bool refresh_items)
local abilities = unit:GetAbilityCount()
for i = 0, abilities-1 do
local ability = unit:GetAbilityByIndex(i)
if ability and not ability:IsCooldownReady() then
ability:EndCooldown()
end
end
if unit:HasInventory() and refresh_items then
for i = 0, 5 do
local item = unit:GetItemInSlot(i)
if item and not item:IsCooldownReady() then
item:EndCooldown()
end
end
end
end
Код:
function ResetAllAbilitiesCooldown(trigger.activator,true)
local abilities = unit:GetAbilityCount()
for i = 0, abilities-1 do
local ability = unit:GetAbilityByIndex(i)
if ability and not ability:IsCooldownReady() then
ability:EndCooldown()
end
end
if unit:HasInventory() and refresh_items then
for i = 0, 5 do
local item = unit:GetItemInSlot(i)
if item and not item:IsCooldownReady() then
item:EndCooldown()
end
end
end
end
end