With a second version which does address such changes I can see why you don't want to bother with them for this one. If it's going to be soon then I'll just leave this here (assuming you plan to attach it to the same post, which would make sense). Otherwise, I'll approve it (just confirm which you plan on doing).
It's not going to be for at least several weeks, probably longer. Ideally it wouldn't be until after JassHelper finally gives us either optional library support with ifdef or better function hooking, that way I can make the system truly modular instead of having to provide instructions on how to add or remove modules from the core.
However, this version doesn't really need to be approved, either. It just needs a thread where some of the people already using it can go to look back at the unmodified code, redownload the Lua script, etc. I suppose it may be worth approving in case other people want to use this version for now.
Also, any way we can get .lua allowed as an attachment extension? I dug up the other version of the Evasion Module. The lua script is:
Lua
Code:
-- Generates Evasion abilities from 1 to 100% and places each in a spellbook.
setobjecttype("abilities")
CharFinder = [[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~]]
function CreateEvasionAbilities ()
for i = 1, 95 do
cha = string.sub(CharFinder, i, i)
raw = "eva"..cha
createobject("ACes", raw)
makechange(current, "Eev1", 1, i / 100.)
makechange(current, "arac", "Other")
makechange(current, "Name", "Evasion")
makechange(current, "ansf", "("..tostring(i).."%)")
createobject("Aspb", "bea"..cha)
makechange(current, "spb1", 1, raw)
makechange(current, "aite", 0)
makechange(current, "Name", "Evasion Spell Book")
makechange(current, "ansf", "("..tostring(i).."%)")
end
for i = 1, 5 do
cha = string.sub(CharFinder, i, i)
raw = "evb"..cha
createobject("ACes", raw)
makechange(current, "Eev1", 1, (i + 95) / 100.)
makechange(current, "arac", "Other")
makechange(current, "ansf", "("..tostring(i + 95).."%)")
makechange(current, "Name", "Evasion")
createobject("Aspb", "beb"..cha)
makechange(current, "spb1", 1, raw)
makechange(current, "aite", 0)
makechange(current, "Name", "Evasion Spell Book")
makechange(current, "ansf", "("..tostring(i + 95).."%)")
end
end
CreateEvasionAbilities()
And the (tiny) library is:
EvasionModule
library EvasionModule initializer Init
// //! external ObjectMerger EvasionGenerator.lua
globals privateinteger EvasionA = 'bea ' - 1 privateinteger EvasionB = 'beb ' - 1 privateintegerarray E privateintegerarray U endglobals
function UnitSetAttackEvasion takesunit u, integer e returnsnothing localinteger i = u:Id if U[i] != 0then call UnitRemoveAbility(u, E[U[i]]) endif set U[i] = e call UnitAddAbility(u, E[e]) endfunction
privatefunction Init takesnothingreturnsnothing localinteger i localinteger e localplayer p
set i = 1 loop exitwhen i == 101 if i < 96then set E[i] = EvasionA + i else set E[i] = EvasionB + i - 95 endif set i = i + 1 endloop
set i = 0 loop exitwhen i == 16 set p = Player(i) set e = 1 loop exitwhen e == 101 call SetPlayerAbilityAvailable(p, E[e], false) set e = e + 1 endloop set i = i + 1 endloop endfunction endlibrary
Wow, this is so cool.
I'm planning to make a tower defense,
and with this + xe dummy unit, I can create new unittypes dynamically, so I don't have to use the object editor.
Wow, this is so cool.
I'm planning to make a tower defense,
and with this + xe dummy unit, I can create new unittypes dynamically, so I don't have to use the object editor.
Have you thought about animations? Tooltips? Attack/defense types? Number of attacks? I didn't think so.
//For each of these functions, there is also a UnitSet and a UnitGet equivalent.
This is not entirely true. For example, there isn't a UnitSetLife/Mana or UnitGetLife/Mana. I know that I can get those simply by calling GetUnitState, but it would be cool if you added those as as wrappers.
That's one of the reasons I hated maintaining multiple versions of the library simultaneously. Silly inconsistencies are always popping up.
I removed those functions because there's just no point to them with the colon operator. States inline completely, unlike some other properties. Unless you just hate the syntax or something there's never a reason not to use setunit:Life = unit:Life + 200.
After seeing several people try and fail to copy my Widgetizer-enabled UnitState module though I may upload that separately here pretty soon, ahead of UP2, since neither requires the other. That version preserves all syntax options just for kicks [UnitSetLife/Mana(unit, value), UnitSetState(unit, state, value), and set unit:State = value)].
When I try to copy and paste the library for the UnitProperties, When I paste it to the trigger in my map, it goes on 1 line for some reason. Any Idea on how to fix? Or upload a map I can copy/paste?