Uncle
Warcraft Moderator
- Joined
- Aug 10, 2018
- Messages
- 7,866
Edit: I figured out my problem and managed to get the global variables and multi-dimensional array to work.
However, this brings up a new question. Is there a way to set the default values of these Arrays to be 0 instead of having to manually set every single one to 0 like I do below? I don't really want to loop from 1 to 32,000.
This doesn't work either. When my unit attacks I want to pick every unit with 300 range of the attacked unit and kill them:
How do I properly loop through every unit?
However, this brings up a new question. Is there a way to set the default values of these Arrays to be 0 instead of having to manually set every single one to 0 like I do below? I don't really want to loop from 1 to 32,000.
Code:
function Variables()
mt = {}
for i=1,10 do
mt[i] = {}
for j=1,10 do
mt[i][j] = 0
end
end
end
This doesn't work either. When my unit attacks I want to pick every unit with 300 range of the attacked unit and kill them:
Code:
function GroupKill()
local u = GetAttacker()
local p = GetUnitLoc(GetAttackedUnitBJ())
local g = CreateGroup()
GroupEnumUnitsInRangeOfLoc(g, p, 300, nil)
local t = GetEnumUnit()
KillUnit(t)
end
Last edited: