Difference between revisions of "Buffs"
From Zenbot Wiki
Views
Actions
Namespaces
Variants
Tools
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
=== Obtaining buff.obj === | === Obtaining buff.obj === | ||
==== | ==== obj.buff ==== | ||
This is the recommended way to obtain buffs | This is the recommended way to obtain buffs | ||
| Line 23: | Line 23: | ||
if slow then | if slow then | ||
print("Player is slowed until ", slow.endTime) | print("Player is slowed until ", slow.endTime) | ||
end | |||
==== obj.buffManager ==== | |||
Alternative way to obtain buffs, not recommended | |||
for i = 0, player.buffManager.count - 1 do | |||
local buff = player.buffManager:get(i) | |||
if (buff.valid) then | |||
print(buff.name) | |||
end | |||
end | end | ||
Latest revision as of 16:51, 1 April 2023
Obtaining buff.obj
obj.buff
This is the recommended way to obtain buffs
Example 1 - hash
local DravenSpinningAttack = player.buff[`DravenSpinningAttack`]
print("Player has " .. (DravenSpinningAttack and "a spinning axe!" or "nothing?"))
Example 2 - string
local function getApheliosManager(t)
return player.buff["Aphelios" .. t .. "Manager"]
end
if getApheliosManager("Infernum") then
print("Player has ApheliosInfernumManager")
end
Example 3 - type
local slow = player.buff[Buff.Slow]
if slow then
print("Player is slowed until ", slow.endTime)
end
obj.buffManager
Alternative way to obtain buffs, not recommended
for i = 0, player.buffManager.count - 1 do
local buff = player.buffManager:get(i)
if (buff.valid) then
print(buff.name)
end
end