Nestharus
o-o
- Reaction score
- 84
Retrieves a proc that can be attached to units on index or w/e you want really. This creates 1 buff for each level associated with the dummy ability so that you can create special effects or w/e for each level ([ljass]if GetUnitAbilityLevel(target, buff) > 0) then[/ljass])
Demo
LUA_GET_VAR_OBJECT
LUA_FILE_HEADER
Demo
JASS:
//this will create an ability called RANDOM_ABIL and one called RANDOM_ABIL_2 with 10 levels each
//it will have 10 buffs associated with it (1 per level)
//! i local object = getdummyphysicalability("RANDOM_ABIL", 10, false)
//object.ability and object.ability2 refer to the ids of the abilities (in case you didn't want to import it)
//object.buffs refers to an array containing the buff ids associated with each level
//buffs[1] would be level 1
//buffs[10] would be level 10
//buff ids are never imported
LUA_GET_VAR_OBJECT
LUA_FILE_HEADER
JASS:
//function getdummyphysicalability(name, levels, import)
//name: the name of the dummy ability (used in buffs and ability)
//levels: how big the dummy ability should be (1 buff created for each level)
//import: whether to import to map as variable or not (imports only the ability)
//imported as
//"ABILITIES_" .. name .. "_DUMMY"
//"ABILITIES_" .. name .. "_DUMMY_2"
//returns a table containing 3 values in it
//buffs: an array of all the buffs (level 1 through total levels)
//ability,ability2: contains the id of the created ability (2)
//DummyPhysicalAbility v3.0.0.0
//! externalblock extension=lua FileExporter $FILENAME$
//! runtextmacro LUA_FILE_HEADER()
//! i writelua("DummyPhysicalAbility", [[
//////////////////////////////////////////////////////////////////
//code
//! i dofile("GetVarObject")
//! i function getdummyphysicalability(name, levels, import)
//! i local buffs = {}
//! i local buffcount = 0
//! i do
//! i local cur = levels
//! i local curstr
//! i while (cur > 0) do
//! i curstr = tostring(cur)
//! i buffs[cur] = getvarobject("BNva", "buffs", "BUFFS_" .. name .. curstr .. "_DUMMY", false)
//! i createobject("BNva", buffs[cur])
//! i makechange(current, "fnam", name .. "_DUMMY" .. curstr)
//! i cur = cur - 1
//! i end
//! i end
//! i local ability = getvarobject("AIob", "abilities", "ABILITIES_" .. name .. "_DUMMY", import)
//! i createobject("AIob", ability)
//! i makechange(current, "anam", name .. "_DUMMY")
//! i makechange(current, "amat", "")
//! i makechange(current, "asat", "")
//! i makechange(current, "aspt", "")
//! i makechange(current, "atat", "")
//! i makechange(current, "ata0", "")
//! i makechange(current, "alev", tostring(levels))
//! i makechange(current, "Idam", "1", "0")
//! i makechange(current, "ahdu", "1", "0")
//! i makechange(current, "adur", "1", "0")
//! i makechange(current, "atar", "1", "")
//! i do
//! i local cur = levels
//! i local curstr
//! i while (cur > 0) do
//! i curstr = tostring(cur)
//! i makechange(current, "abuf", curstr, buffs[cur])
//! i makechange(current, "Iob5", curstr, "2")
//! i cur = cur - 1
//! i end
//! i end
//! i local ability2 = getvarobject("Afrb", "abilities", "ABILITIES_" .. name .. "_DUMMY_2", import)
//! i createobject("Afrb", ability2)
//! i makechange(current, "anam", name .. "_DUMMY_2")
//! i makechange(current, "amat", "")
//! i makechange(current, "amho", "1")
//! i makechange(current, "achd", "0")
//! i makechange(current, "alev", tostring(levels))
//! i makechange(current, "atar", "1", "")
//! i makechange(current, "ahdu", "1", "0")
//! i makechange(current, "adur", "1", "0")
//! i do
//! i local cur = levels
//! i local curstr
//! i while (cur > 0) do
//! i curstr = tostring(cur)
//! i makechange(current, "abuf", curstr, buffs[cur])
//! i cur = cur - 1
//! i end
//! i end
//! i return {buffs = buffs, ability = ability, ability2 = ability2}
//! i end
//end code
//////////////////////////////////////////////////////////////////
//! i ]])
//! endexternalblock