• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

AI Lua Coding + Showcase of AI code.

Level 7
Joined
May 8, 2012
Messages
127
Hey! not sure if this has been discussed before much - I searched but didn't find many results.

So about two weeks ago I tried to use ChatGPT for some lua code, simple things - just to get going with my project as I don't know Lua.
Over the course of two weeks, I discovered it is rather powerful, especially coupled with lua debug utils - the visual feedback ingame with errors is a quick screenshot feed to the AI that always leads to a quick solution.
Feeding it logic = gets good results. Not really "make me a spell" but hammering down and breaking down your spell into parts, stitching it together etc.

I think the process is actually not that far from using triggers - You break down some logic, stitch it together.
I have learned more Lua in two weeks than if I had tried to just learn Lua, in my opinion - because I am more of a visual learner, seeing things happen fast made me hungry to read the code and see whats happening - and with GPT help, plus asking it to actually document the code and explain what is what - I kinda got somewhere.
And since I am doing this within a project and constantly improving the work flow - Chatgpt is getting better and better - for example we are now adding hard comments in the code to prevent future gpts from changing certain things or adding where it is not needed.
Slowly we are building a bible of rules, wc3 natives etc and each spell begins with the same "bible foundation"

I tried to get it to use Antares alice and gizmos - Antares had a look at the code, and indeed - it is full of unnecessary stuff, fallbacks etc - But it works, and that is what matters to me - on the map maker side - I had an idea for a hero and I managed to make it happen almost 100% the way I wanted.

I understand some people hate AI - and some people might see this and think Ï dont own this or this isn't mine or whatever - and to all that I say, this is an almost 30 year old hobby - and if I can get an idea from my head on the table efficiently after not touching the editor since 2012 - this is good.
Reforged might have well been an editor update and instead of triggers you'd have a Peon GPT :P

Without further delay! I present my Necromancer.
ALMOST COMPLETE! one spell right now is not finished and can be ignored :D its just a visual.
also ignore the spell names ingame and button position - didnt really get to that, probably should've since I post it here - Tranquility is the only spell that doesnt do anything.
Also I dont know why I put so many grunts and raiders - goodluck trying to kill all that :D!! possible though.

There are 5 spells
Soulkeeper - Instead of mana, you use souls - Souls gather around the necromancer to be used for spells. This scales with the necromancers level and can be adjusted in the script very easily (how many souls etc)

Necrosurge - A channeling spell, summons undead using souls. they attack nearby enemies and if there are none they go to the skeleton - can be scaled in the script to have different units spawn per level, more units per level, more range etc)

Tombsworn Calling - Binds souls to undead you summon to make wights - the souls are bound to the skeletons, when they unbind - the skeletons slowly become less etheral and eventually die. In this sample map there is also an anti-necromancer hero with a Repel ability that basically banishes souls - he can use it to "disenchant" the wights.
The necromancer has to keep channeling - if he stops, after 5 seconds the souls unbind and the units will survive for another D10 seconds. While channeling this no new souls spawn for the necromancer.
can be level scaled, which units spawn - how much it blocks soul spawning (can also make it spawn more souls - instead of blocking it) - you can make this an ultimate spell or make it have 10 levels.
Ossuary Retreat - souls carry the necromancer underground and away from enemies - level scaling how many souls are used, distance (i think, i forgot but very easy to add)

Soulsiphon - currently just a visual, I am changing it alltogether - it will use the souls to deal damage.


Then you have the anti necro guy - the Justicar, he has one ability - Repel the Wicked, it deals double damage to undead, demons and "evill" (using naga for this) and currently it repels souls - it banishes them - he can use it to cancel necromancer summons if he catches the soul in the right time - he can banish wights, etc.

Credits for models:
Greedy Martyrdom, johnwar, Vinz - and I am very sorry I cannot find for the life of me who made the green effect im using for Tombsworn.
Big thanks to mighty Antares too.


Disclaimer: I am not pretending I made this code, I am showing what can be done with AI today. I enjoyed the process, I enjoy the result and I am happy to see my idea "come to life" - if you just wanna be negative about AI keep it out of this thread, make your own - this is here to show people who want to use AI, who cant code - who want to make something come to life but struggle getting it out there - that it is possible :)


P.S - theres some other stuff in the map so the initial bump is probably alice/rpg minimaps and all that loading, I use them in my bigger map!
 

Attachments

Last edited:
Since I don't know Jass (have touched Lua a liiitle in the past), but want to make maps that are compatible with older game versions like 1.27b (so that I can avoid what happened before where Reforged got updated and broke everything that only worked w/v1.36, which unlike 1.31.1 and earlier can't rly be downloaded anymore, which is a huge blow for preservation),
I'd be interested in AI's potential to eg translate Lua into Jass.

Since I've also never used Lua w/Warcraft before, I'd also be interested in doing what you did in order to get started in general, since I have some ideas that are apparently nontrivial to implement (tbh idk if they're even possible lol)...

Anyway, reading your post gives me hope for getting my feet wet. Ofc my hope is to move past vibe coding, but, since I don't really like investing a lot of time in something without knowing whether it's possible first, having a (more chill?) time doing it, via AI, is appealing.

Jw tho, in my experience chatgpt is often wrong about stuff and you have to waste a lot of time yelling at it for using the wrong API function names and all sorts of things that end up require a lot of digging on your own. Has that been a problem for you? How have you gotten around it?

P.S., is the rule bible you've been building up something that might be useful to others desiring to go this route, that you might be interested in publishing in the Advanced Scripting section of the site or something in the future?
 
I don't think there is anything worth publishing really as it's down to personal interaction with your AI, the rules I put are there so that everything is connected within my map and how I talk with the AI.

I did try it for one small Jass thing for a friend and it worked fine so I'm sure it can help with Jass, give it a go - just don't expect plug and play, I don't think anything I did would be possible if I didn't have debug utils in my map and I only had that because I wanted to use RPG Minimaps, so it is perchance that I found a smooth way to do it as a non-coder but it worked with a lua setup.
 
Heres an example of how I'm slowly making something with AI.
I want to have a "baked in" naval battle as part of the terrain, with units on ships and all that - so we are testing how to get units on ships and how it looks.
I don't expect to build a whole system for naval battle - but for sure the "animation" vibe of it will be doable.
As far as making this into a system - I'm sure AI can do that to an extent - but to have this as a system on a multiplayer map, I would probably only use the AI code as a backbone or a concept.

Disclaimer - I know there is a no-AI content on the hive, and I completely agree with it as far as models, skins and icons go - but much like using AI for making sound for your units, using AI for making code - an easy way to visualize fast and more accessible to the public.
So please keep that in mind when judging what is happening here - I don't claim to make original code with AI, but my ideas are original and they are coming to life - is it the same as making art? I don't know.

but very useful :)


Edit - Yes I am fully aware this looks very unpolished - this is about 30 minutes of work, just starting to get the feel.
From here - fixing how the units looks, maybe adding a bit of sway to them up and down, managing how they acquire targets and all is steps I take - one by one - It wont make something useful unless you break it down to tasks - In this video it is right after getting the positioning right and anchoring the units - later we print this data, reuse it to make the system start this way - next fix the movement, add dynamics etc.
This is how to use AI.
 

Attachments

  • Warcraft III 2026-05-13 14-27-07.mp4
    39.5 MB
Back
Top