This requires a basic knowledge of scripting and how to add in units but otherwise not much else.
Note when I refer to .lua I am referring too abcc_con.lua or abcg_con.lua found in data_abc/common/scripts/abc abc=mod3 letter name
First download archer01's hero support script and read all the readmes and add in the hero support lines to your .lua
so now your script (relavent parts should look like this)
9- Now this is a VERY important part, the "SetHeroClass" function can only be used once for each team. If it is used a second time, nasty stuff will likely happen. Go through the script and remove all uses of the "SetHeroClass" function, except for the two you added earlier of course, so there won't be any problems. Your final script should have at most only two (2) mentions of "SetHeroClass". Don't forget about your text editor's search function when making sure this is so.
Now as of this point there should be AI controlled heroes running around your map but they should only be the ones that you called from the cis and rep side and put in the hero support script here
Now for the randomness...
If you take math or know math at all you are familiar with probability and the nCr (read n choose r) function defined as n!/r!(n-r)! anyway done with the math lesson we will be using a .lua function which does just this
it is called math.random now you need to decide how many random heroes you would like in your map for the sake of this tutorial we will have 3
this script will tell the game how many heros we want paste this into the .lua right under
this can be adapted for ALL and IMP just add this in instead
ie heroimpand = math.random(1, #) #=integer >1 and then add
elseif heroimpand == # then
heroImp = "imp_hero_heroname3" for the number of numbers you have (make it so it looks like the rest of the hero calls above it)
now this script isn't done yet you must call your heros with the hero support script
change these lines
this will tell the .lua to apply hero support on the hero that pops out of our random function
now we must make sure that the map will work in MP random heroes will crash multiplayer so we must add if not ScriptCB_InMultiplayer() then above where the hero support starts
all and all it should look like this
now since there are only heroes during SP how about adding them in MP (they will not be random)
copy these lines
if ScriptCB_InMultiplayer() then
heroCis = "cis_hero_heroname"
heroRep = "rep_hero_heroname"
you can pick any hero you want to be here it will just not be random
now lastly under where the setupteams section is add in the hero lines that you prieviously deleted for acher's script
all and all it should look like this under where the cis units are called
the final script will look like this
That is pretty much it just make sure that you have all 3 heroes called or however many you want.
Just a note this will cause the hero to appear below the last unit on the select screen so if you have 7 units it will appear somewhat off the screen this cannot be fixed.
If you have any questions email me at yankfan1950 at gmail dot com or just PM me here at GT if you use this credit Maveritchell for the TFU herosupport script which is what this is based of of Archer01 for his script and I would like credit as well for putting it all together