[Programming] Make AI build hero units

Post Reply
Stealthy
Terran Settler (Unemployed)
Terran Settler (Unemployed)
Posts: 1
Joined: Sat Mar 09, 2013 8:10 am

[Programming] Make AI build hero units

Post by Stealthy »

Hello everyone! I've been trying to reprogram the original campaign to make it a little more interesting. I've experimented with adding additional triggers, making the AI harder, etc. Recently I've reprogrammed a few maps so that the computer builds heroes instead of normal units. Desperate Alliance is a lot more exciting when you're facing a hoard of devouring ones instead of a hoard of zerglings! I did this by opening the level in the campaign editor, and editing the stats of the computer's units.

There's one obvious problem with this. Whenever I reach a level that's a mirrored match (TvT, ZvZ, PvP, etc), my units gain hero like strength too. In order to avoid this, I'm forced to reprogram the stats of the hero units (raynor, kerrigan, etc) to match that of the "normal" units in the original game. I then use triggers to remove any units I build, and replace them with their heroic copy.

The negative side effects of this are:

-Supply no longer matters
-It takes a lot of time to convert each map
-Some brood war units don't have hero versions that I can switch them with (lurker, medic, dark archon, etc)

Is there any way I can modify the AI so that it builds a devouring one instead of a zergling, etc? I'm perfectly comfortable with just opening up the AI's in iscript and changing all the variables, but it won't work if the AI's aren't capable of building the new units. At the same time, if I just reprogram what buildings make what, then my buildings will create the superunits instead of the normal units.

What's the best method to go about making the AI spawn hero strength units instead of normal ones, without changing what I spawn?
User avatar
Church
Zerg Ultralisk Waste Manager
Zerg Ultralisk Waste Manager
Posts: 697
Joined: Tue Jun 02, 2009 6:48 pm
Location: now here, nowhere

Re: [Programming] Make AI build hero units

Post by Church »

It's been a while since I've done much modding but if I remember right the units.dad entries include what building constructs it. So basically you'd just find the Jim Raynor marine and set it to be built by the Barracks. Don't change the firegraft button sets though, those affect the player. So now the barracks can build both, but the player doesn't have a button for building the hero. After that it's just simply the AI editing.
User avatar
IskatuMesk
Xel'naga World Shaper
Xel'naga World Shaper
Posts: 8328
Joined: Sat Feb 07, 2009 1:40 pm
Location: M͈̙̞͍͞ͅE̹H̨͇̰͈͕͇̫Ì̩̳CO̼̩̤͖͘ జ్ఞ‌ా

Re: [Programming] Make AI build hero units

Post by IskatuMesk »

Nothing you do in Starcraft is considered "programming" until you hit ASM.

The hero units will need Firegraft/Stargraft requirements. Basically the AI reads requirements and not buttons. Like Jim_Raynor explains, the players won't see these units, but the AI will. Just clone the base unit requirements, fairly trivial work.

Then you'll need to actually define those heroes in the AI and then replace all of their scripts with those related units, or just outright replace the ID definitions of their standard units with their hero variants. You'll need scaiedit for this, or py AI editor.
User avatar
mark_009_vn
Zerg Drone Masseur
Zerg Drone Masseur
Posts: 356
Joined: Fri Nov 04, 2011 5:56 am
Location: [[THIS USER, HE IS A CHAR]]

Re: [Programming] Make AI build hero units

Post by mark_009_vn »

Stealthy wrote: Is there any way I can modify the AI so that it builds a devouring one instead of a zergling, etc? I'm perfectly comfortable with just opening up the AI's in iscript and changing all the variables, but it won't work if the AI's aren't capable of building the new units. At the same time, if I just reprogram what buildings make what, then my buildings will create the superunits instead of the normal units.
Like Mesk said, AI only reads requirements and not buttons, this is the basis for the Armageddon Onslaught mod to denies the player access to the Armageddon race...
Image

"I'm begging you, let me work!" - Osamu Tezuka
User avatar
Taeradun
Protoss Khalai Missionary
Protoss Khalai Missionary
Posts: 1028
Joined: Thu Sep 07, 2006 6:08 pm
Location: AU
Contact:

Re: [Programming] Make AI build hero units

Post by Taeradun »

yeah what mesk said; you'll need firegraft and SC AI edit
Jim_Raynor wrote:units.dad
YOU'RE NOT MY REAL DAD
Image
bajadulce
Terran Dropship Flight Attendant
Terran Dropship Flight Attendant
Posts: 155
Joined: Mon Jun 25, 2007 2:30 pm
Location: Santa Cruz, CA

Re: [Programming] Make AI build hero units

Post by bajadulce »

Nice! :)
Creating a mod that specifically targets the internal campaign is a fun idea and something have had on the back burner for some time as well. Since this mod will be exclusively played in single player, you aren't bound to bnet checks nor worry have to deal w/ multiplayer desync issues etc. You'll have a lot of freedom such as hacking starcraft.exe directly.

Many years ago one of my earlier projects was called "BlizzHard". Basically all the non-rpg campaign maps were increased in difficulty via altering their campaign AI script (Broodwar only). Meaning they got a little more cash, created a few more buildings, produced more units, higher upgrades etc. None of the maps were changed, just the individual ai scripts. Posting about this + these links as it might be of some use to you:
You can find a little more info here @ bwai.com: http://www.broodwarai.com/forums/viewto ... =blizzhard
and here @ campaigncreations.org: viewtopic.php?f=4&t=1471&hilit=blizzhard

Blizzhard didn't include any grafting nor .dat editing and so the AI never trained heros nor other special units. Adding modding aspects such as what you are proposing would propel the idea to a new level to be sure!

@ requiring grafting:
You can use the "create unit" command in the ai script to spawn almost anything without any regards to graft requirements. This of course isn't as sexy as the units being "trained" at a building, but has its usefulness and can be used judiciously without becoming too overwhelming or unfair. Would hate to see an army narrowly destroy an AI base only to see the player's last remaining attacker have to suddenly face 10 hero units that just "spawned" out of thin air.

One thing to note about replacing units w/ hero counterparts, is that the AI won't be using any of their spells unfortunately. So while a player owned infested_kerrigan is pure awesomeness, the AI won't do much w/ her other than attack (this applies to any unit that uses a "spell" i.e. marines, fbats, ghosts, sci-vessel, bcruiser, defilers, templars, arbiters, corsairs, comsats..etc etc.). There are options such as giving your hero unit some "spell like" attacks via iscript, or "flipping" the 2 units via Firegraft button and .dat editing. This was done extensively in all those "...AI" mods such as ARAI, ORAI, AAAI, PEAI... etc. and makes for a super "spell casting" AI.

An oddity w/ UMS AI is that it behaves very differently from its Melee counterpart. We coined a term "WoDS" (Wheel of Death Syndrome) and something that was never quite resolved with UMS AI. Basically the AI "stages" in a very very odd manner to the point of being crippled. Sorry don't have a link (*video would be even better! note to self) handy that demonstrates/expands on this atm.

I don't mean to fill up an entire page w/ banter, but just wanted to share a few thoughts on the subject and offer any assistance/ideas/workarounds as am very interested in this sort of project. ... so gluck and get a hold of me if you need anything!

p.s.
Lav these smiles are horrible! They have no contrast in their features. They all look washed out and the same fuzzy emoticon. Just replace these w/ the standard yellow .gif images and move on! It's OK to have a little color other than all this BLUE in your forums. Image
User avatar
Lavarinth
Xel'naga Administrator
Xel'naga Administrator
Posts: 6539
Joined: Wed Aug 16, 2006 5:21 pm
Location: His Ashworld Planet

Re: [Programming] Make AI build hero units

Post by Lavarinth »

I KNOW, BAJA, I KNOW, TRUST ME I KNOW!! It's on my to-do list.
- - Lavarinth
Campaign Creations Administrator
User avatar
mark_009_vn
Zerg Drone Masseur
Zerg Drone Masseur
Posts: 356
Joined: Fri Nov 04, 2011 5:56 am
Location: [[THIS USER, HE IS A CHAR]]

Re: [Programming] Make AI build hero units

Post by mark_009_vn »

bajadulce wrote:p.s.
Lav these smiles are horrible! They have no contrast in their features. They all look washed out and the same fuzzy emoticon. Just replace these w/ the standard yellow .gif images and move on! It's OK to have a little color other than all this BLUE in your forums. Image
:) :] ;) :D ;D :lol: >:( :( :o :eegads: o_o 8) ??? ::) :P :-[ :{ :fear: :-X :-\ :S :frown: :-* :'( >:D ^-^ :bleh: @@ :F :gah: ^U^ :hah: :plz: :happy: :shock: :joy: D< :monocle: :nosebleed: :osnp: :ohh: :huwhaa: :raspberry: D: :durr: :sweat: :sup: :explain: :V

What do you mean? They're friggin hilarious to look at...
Image

"I'm begging you, let me work!" - Osamu Tezuka
User avatar
Taeradun
Protoss Khalai Missionary
Protoss Khalai Missionary
Posts: 1028
Joined: Thu Sep 07, 2006 6:08 pm
Location: AU
Contact:

Re: [Programming] Make AI build hero units

Post by Taeradun »

bring back the equally bizarre smilies from whatever that orange forum that wasn't CC was

i remember i loved :15:
Image
User avatar
Lavarinth
Xel'naga Administrator
Xel'naga Administrator
Posts: 6539
Joined: Wed Aug 16, 2006 5:21 pm
Location: His Ashworld Planet

Re: [Programming] Make AI build hero units

Post by Lavarinth »

Taeradun wrote:bring back the equally bizarre smilies from whatever that orange forum that wasn't CC was

i remember i loved :15:
How am I not recollecting this..
- - Lavarinth
Campaign Creations Administrator
User avatar
Lavarinth
Xel'naga Administrator
Xel'naga Administrator
Posts: 6539
Joined: Wed Aug 16, 2006 5:21 pm
Location: His Ashworld Planet

Re: [Programming] Make AI build hero units

Post by Lavarinth »

Lavarinth wrote:
Taeradun wrote:bring back the equally bizarre smilies from whatever that orange forum that wasn't CC was

i remember i loved :15:
How am I not recollecting this..
EDIT:

Hmm..

Image
- - Lavarinth
Campaign Creations Administrator
User avatar
IskatuMesk
Xel'naga World Shaper
Xel'naga World Shaper
Posts: 8328
Joined: Sat Feb 07, 2009 1:40 pm
Location: M͈̙̞͍͞ͅE̹H̨͇̰͈͕͇̫Ì̩̳CO̼̩̤͖͘ జ్ఞ‌ా

Re: [Programming] Make AI build hero units

Post by IskatuMesk »

They are all bizarre. Jesus christ.
User avatar
Taeradun
Protoss Khalai Missionary
Protoss Khalai Missionary
Posts: 1028
Joined: Thu Sep 07, 2006 6:08 pm
Location: AU
Contact:

Re: [Programming] Make AI build hero units

Post by Taeradun »

gameproc, that's what the site was called. with light-grey emoticons that i think might've been made by wargiant himself or something. i think the smilies were a bit larger than the ones we have here at the moment and they weren't perfectly circular, ie. the one i really liked (i think it was :15: or something, they were all/mostly just numbered) had a fairly narrow jaw under a wide head

anyway back on topic...
Stealthy wrote:-Supply no longer matters
nobody's noticed this one yet

you can fix this in your mod if you edit units.dat in PyMS or DatEdit - I think just set the supply requirement for the hero units to be the same as their normal versions. if that still doesn't work, also uncheck the "hero" flag or whatever it is (I don't think this is needed but idk)
Image
User avatar
IskatuMesk
Xel'naga World Shaper
Xel'naga World Shaper
Posts: 8328
Joined: Sat Feb 07, 2009 1:40 pm
Location: M͈̙̞͍͞ͅE̹H̨͇̰͈͕͇̫Ì̩̳CO̼̩̤͖͘ జ్ఞ‌ా

Re: [Programming] Make AI build hero units

Post by IskatuMesk »

I had problems in AO where some units without the hero flag were still getting hero bonuses, iirc.
Post Reply