• 🏆 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!

[JASS] Generating abilities with Sharpcraft WEX not working

Status
Not open for further replies.
Working on an older patch, 1.28.5. Object Merger seems to be failing to work and I am hopeful someone will remember whats wrong with this lua code.

Custom Cooldown (For Hero Units only)
The first one from this links system works but the one in this post aka second one fails always.
[jass=]
//! externalblock extension=lua ObjectMerger $FILENAME$
//set max number of abilities generated
//! i max =10
//! i lvl =5
//Make Real Hero Abilities
//! i setobjecttype("abilities")
//! i function code(i)
//! i return string.format("%03d",i)
//! i end
//! i for i=1, max do
//! i createobject("ANcl","A"..code(i))
//! i makechange(current,"anam","Ability "..i)
//! i makechange(current,"abpx",0)
//! i makechange(current,"abpy",2)
//! i makechange(current,"arpx",0)
//! i makechange(current,"arpy",0)
//! i makechange(current,"aubx",0)
//! i makechange(current,"auby",2)
//! i makechange(current,"acat","")
//! i makechange(current,"acap","")
//! i makechange(current,"aeat","")
//! i makechange(current,"arar","ReplaceableTextures\CommandButtons\BTNDeathPact.blp")
//! i makechange(current,"atat","")
//! i makechange(current,"ata0","")
//! i makechange(current,"aher",1)
//! i makechange(current,"alsk","2")
//! i makechange(current,"alev",lvl)
//! i makechange(current,"arac","human")
//! i makechange(current,"achd",0)
//! i makechange(current,"anam","Real Ability "..i)
//! i makechange(current,"aret","|cffff6317[Q]|r|cffffca95 Learn ABILITY - [|r|cffff6317Level %d|r|cffffca95]|r")
//! i makechange(current,"arut","|cffffca95Deals a Burst of Fire Damage.|r|n|n|cffff6317Targets:|r|cff8b94fe |r|cffffca95None/Point/Unit/Destructible|n|r|cffff6317Acquisition:|r|cffffca95 AoE - XXX / Missile - XXX width / Single Target / Cone - XXX end / Chain Lightning - Max XXX Targets|n|r|cffff6317Affects: |r|cffffca95Units - |r|cffff6317Air|r|cffffca95,|r|cffff6317Ground|r|cffffca95 / Destructables - |r|cffff6317Trees|r|cffffca95,|r|cffff6317Rocks|r|cff2d52ff|n|r|cffff6317Range: |r|cffffca95XXX|n|r|cffff6317Cooldown:|r|cffffca95 XXX seconds|n|r|cffff6317Effects |n• |r|cffffca95Deals |r|cffff631750/100/150/200/250|r|cffffca95 fire DMG|r|n|cffff6317• |r|cffffca95Applies |r|cffff6317Ignite|r|cffffca95 to affected units for |r|cffff63171/2/3/4/5 |r|cffffca95seconds|r|cffffff00¹|r|n|n|cffffff00¹|r|cffff6317Ignite|n|r|cffffca95 Deals |r|cffff631710|r|cffffca95 fire DPS |r|cffff6317+5|r|cffffca95 DPSPS|r")
//! i for j=1, lvl do
//! i makechange(current,"Ncl4",j,0)
//! i makechange(current,"Ncl5",j,0)
//! i makechange(current,"Ncl6",j,"charm")
//! i makechange(current,"Ncl1",j,0)
//! i makechange(current,"aran",j,0)
//! i makechange(current,"atp1",j,"|cffffca95Flare|r - [|cffff6317Level "..j.."|r]")
//! i makechange(current,"aub1",j,"|cffffca95Deals a Burst of Fire Damage.|r|n|n|cffff6317Targets:|r|cff8b94fe |r|cffffca95None/Point/Unit/Destructible|n|r|cffff6317Acquisition:|r|cffffca95 AoE - XXX / Missile - XXX width / Single Target / Cone - XXX end / Chain Lightning - Max XXX Targets|n|r|cffff6317Affects: |r|cffffca95Units - |r|cffff6317Air|r|cffffca95,|r|cffff6317Ground|r|cffffca95 / Destructables - |r|cffff6317Trees|r|cffffca95,|r|cffff6317Rocks|r|cff2d52ff|n|r|cffff6317Range: |r|cffffca95XXX|n|r|cffff6317Cooldown:|r|cffffca95 XXX seconds|n|r|cffff6317Effects |n• |r|cffffca95Deals |r|cffff631750|r|cffffca95 fire DMG|r|n|cffff6317• |r|cffffca95Applies |r|cffff6317Ignite|r|cffffca95 to affected units for |r|cffff63171 |r|cffffca95second|r|cffffff00¹|r|n|n|cffffff00¹|r|cffff6317Ignite|n|r|cffffca95 Deals |r|cffff631710|r|cffffca95 fire DPS |r|cffff6317+5|r|cffffca95 DPSPS|r")
//! i end
//! i end
//Make Dummy Hero Caster Ability
//! i setobjecttype("abilities")
//! i function code(i)
//! i return string.format("%03d",i)
//! i end
//! i for i=1, max do
//! i createobject("ANcl","B"..code(i))
//! i makechange(current,"anam","Ability "..i)
//! i makechange(current,"abpx",0)
//! i makechange(current,"abpy",2)
//! i makechange(current,"aubx",0)
//! i makechange(current,"auby",2)
//! i makechange(current,"acat","")
//! i makechange(current,"acap","")
//! i makechange(current,"aeat","")
//! i makechange(current,"arar","ReplaceableTextures\CommandButtons\BTNDeathPact.blp")
//! i makechange(current,"atat","")
//! i makechange(current,"ata0","")
//! i makechange(current,"aher",0)
//! i makechange(current,"alev",lvl+1)
//! i makechange(current,"arac","human")
//! i makechange(current,"achd",0)
//! i makechange(current,"anam","Caster Ability "..i)
//! i for j=1, lvl+1 do
//! i makechange(current,"Ncl4",j,0)
//! i makechange(current,"Ncl5",j,0)
//! i makechange(current,"Ncl6",j,"charm")
//! i makechange(current,"Ncl1",j,0)
//! i makechange(current,"aran",j,0)
//! i if j == 1 then
//! i makechange(current,"atp1",j,"|cffff6317[Q]|r|cffffca95 Flare|r |cffffca95- [|r|cffff6317On Cooldown|r|cffffca95]|r")
//! i makechange(current,"aub1",j,"|cffffca95Ability is on cooldown and cannot be recast yet.|r")
//! i else
//! i makechange(current,"atp1",j,"|cffffca95Flare|r - [|cffff6317Level "..j-1.."|r]")
//! i makechange(current,"aub1",j,"|cffffca95Deals a Burst of Fire Damage.|r|n|n|cffff6317Targets:|r|cff8b94fe |r|cffffca95None/Point/Unit/Destructible|n|r|cffff6317Acquisition:|r|cffffca95 AoE - XXX / Missile - XXX width / Single Target / Cone - XXX end / Chain Lightning - Max XXX Targets|n|r|cffff6317Affects: |r|cffffca95Units - |r|cffff6317Air|r|cffffca95,|r|cffff6317Ground|r|cffffca95 / Destructables - |r|cffff6317Trees|r|cffffca95,|r|cffff6317Rocks|r|cff2d52ff|n|r|cffff6317Range: |r|cffffca95XXX|n|r|cffff6317Cooldown:|r|cffffca95 XXX seconds|n|r|cffff6317Effects |n• |r|cffffca95Deals |r|cffff631750|r|cffffca95 fire DMG|r|n|cffff6317• |r|cffffca95Applies |r|cffff6317Ignite|r|cffffca95 to affected units for |r|cffff63171 |r|cffffca95second|r|cffffff00¹|r|n|n|cffffff00¹|r|cffff6317Ignite|n|r|cffffca95 Deals |r|cffff631710|r|cffffca95 fire DPS |r|cffff6317+5|r|cffffca95 DPSPS|r")
//! i end
//! i end
//! i end
//Make Dummy Hero Swapper Ability
//! i setobjecttype("abilities")
//! i function code(i)
//! i return string.format("%03d",i)
//! i end
//! i for i=1, max do
//! i createobject("ANeg","C"..code(i))
//! i makechange(current,"anam","Swap Ability "..i)
//! i makechange(current,"alev",1)
//! i makechange(current,"Neg3",1,"B"..code(i)..",0UBA")
//! i makechange(current,"Neg4",1,"C"..code(i)..",BCRR")
//! i makechange(current,"Neg1",1,0)
//! i makechange(current,"Neg2",1,0)
//! i makechange(current,"Neg5",1,"")
//! i makechange(current,"Neg6",1,"")
//! i makechange(current,"aret","")
//! i makechange(current,"arut","")
//! i makechange(current,"atp1",1,"")
//! i makechange(current,"aub1",1,"")
//! i makechange(current,"arac","other")
//! i end

//! endexternalblock
[/code]
 
Level 1
Joined
Apr 8, 2020
Messages
110
Tal0n, the j-1 in this line //! i makechange(current,"atp1",j,"|cffffca95Flare|r - [|cffff6317Level "..j-1.."|r]") causes an error called malformed number.

Put parentheses around that j-1 as you cannot be doing math operations while doing string operations.

When did you get Lua working for you? I recall that you could not get the Lua script for Custom Stat System working for you. Something about the code being commented out?

FYI, you can get JNGP working again by simply replacing the code in findpath.lua via notepad++ or any other program with the following:
JASS:
print "Grimoire 1.5 5/4/2008"

-- This should be the path to your WC3 directory that contains the game MPQs
path = "C:\\Users\\Tuyen\\Desktop\\iccup_war3_en"

-- This should be the path to the latest Warcraft III.exe
testmap_exe = "C:\\Program Files (x86)\\Warcraft III\\x86\\Warcraft III.exe"
Besides that, you will need the old MPQs (which are available in the link). That is it.

I recall that Sharpcraft WEX has the doodad limitation, so you might want to switch over to JNGP. Any version will do. I use this version.
 
Last edited:
Status
Not open for further replies.
Top