• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Create Channel based ability through lua

Status
Not open for further replies.
Level 24
Joined
Aug 1, 2013
Messages
4,657
Hya.

I am trying to make an ability based of Channel.
Now I know that I cannot use the "Auto Fill Levels" option for "Data - Options" and "Data - Target Type" and decided to not waste any time and create the ability using lua.

I tried to create an ability equal to this:
tzlnsRO.png

The remaining part is all standard.

The lua script that I use to make it is this:
JASS:
//! externalblock extension=lua ObjectMerger $FILENAME$
//! i   local var = 0
//! i   local range = 0
//! i   setobjecttype("abilities")
//! i   createobject("ANcl","ABAA")
//! i   makechange(current, "aani", "attack")
//! i   makechange(current, "acat", "")
//! i   makechange(current, "acap", "")
//! i   makechange(current, "aeat", "")
//! i   makechange(current, "atat", "")
//! i   makechange(current, "aher", "0")
//! i   makechange(current, "alev", "301")
//! i   makechange(current, "arac", "other")
//! i   makechange(current, "ahky", "")
//! i   makechange(current, "aord", "attackonce")
//! i   var = 1
//! i   range = 100
//! i   while (var < 302) do
//! i       makechange(current, "Ncl4", var, "0.00")
//! i       makechange(current, "Ncl6", var, "attackonce")
//! i       makechange(current, "Ncl5", var, "0")
//! i       makechange(current, "Ncl1", var, "100.00")
//! i       makechange(current, "Ncl3", var, "8")
//! i       makechange(current, "Ncl2", var, "1")
//! i       makechange(current, "aran", var, range)
//! i       var = var +1
//! i       range = range +5
//! i   end

//! i   createobject("ANcl","ABAC")
//! i   makechange(current, "aani", "stand,ready")
//! i   makechange(current, "acat", "")
//! i   makechange(current, "acap", "")
//! i   makechange(current, "aeat", "")
//! i   makechange(current, "atat", "")
//! i   makechange(current, "aher", "0")
//! i   makechange(current, "alev", "301")
//! i   makechange(current, "arac", "other")
//! i   makechange(current, "ahky", "")
//! i   makechange(current, "aord", "attackonce")
//! i   var = 1
//! i   range = 100
//! i   while (var < 302) do
//! i       makechange(current, "Ncl4", var, "0.00")
//! i       makechange(current, "Ncl6", var, "attackonce")
//! i       makechange(current, "Ncl5", var, "0")
//! i       makechange(current, "Ncl1", var, "100.00")
//! i       makechange(current, "Ncl3", var, "8")
//! i       makechange(current, "Ncl2", var, "1")
//! i       makechange(current, "aran", var, range)
//! i       var = var +1
//! i       range = range +5
//! i   end
//! endexternalblock
You can see that with two of these abilities (which will be 3) and 2 fields that dont work and 301 levels (for now) will have to make me click 3612 times...
It will be lua for sure.

However, the abilities created from lua dont work.
The unit does succeed the order (which is done via triggers) as in it returns true for IssueTargetOrderById() but the unit doesnt use the ability.

So what do I do wrong and how can I fix it?


Also small question...
What am I supposed to do with $FILENAME$?

EDIT:
Ok I just tried to make the generated objects into real objects and it seems that the Data - Options (which is 8 when only Universal Spell is turned on) turn both Universal Spell and Unique Cast on... which would be 24 instead of 8.
The Target Type which I set to 1 in lua became 49 for some weird reason.
All levels are the same in those two fields.
All other fields do exactly what they were supposed to do.
 
Status
Not open for further replies.
Top