I want to do this via the data editor, as it's a lot cleaner than doing it through triggers. I tried to make an auto-cast ability for the bunker, which would trigger an "Issue Order" effect, targeting a random terran marine or marauder. The effect would make the bunker cast the load-unload ability command index 0 (as the "Load" part of the ability is indexed 0 in the command), but it doesn't work. Is there any way to make it work, or should I use a different method?
If you have the Bunker casting an ability targeting the units, with an issue order effect that commands unit to use the Bunker's ability... You could have the caster/target values switched up.
Sounds like you're having the Bunker issue a command to the Marines ordering the BUNKER itself to use an ability. But maybe you got it right. If you put the ability on the command card and use it manually, does it work? Also, Index 0 may be Load All not Load Unit. Not sure if that matters.
Does allowing Self-Cast on the Load/Unload ability under Commands - Flags do anything?
Now I've made an instant cast ability (auto-cast of course) with an Issue Order effect that targets the bunker itself with the Ability Command indexed 4 (since I now want it to load all units nearby). The bunker then casts the Transport ability, but still fails to work. I have done as you said, but I can't get it to work :/
You should not be using data for this anyway if it is for an AI...
First off check how your bunkers tactical AI (if any) operates. If using custom units or a custom bunker you might find the tactical AI does not know how to process them in which case you will need to write your own tactical AI functions. In the worst case what you can do is get your units, remove them from AI control (so the AI will ignore them) and then use a trigger implementation to order them explicitly to bunkers with space available.
Just to clarify, SC2 AI is nothing more than triggers with some data interfaces for the triggers to use/be used. It uses the exact same virtual machine as all triggers in SC2 maps do. There is no "magic" behind it with exception of GUI users cannot access all the natives with actions and functions (so they will need to not be lazy and use the odd line of custom script either directly or to make a GUI wrapper). In theory you can use GUI to make SC2 melee grade AI. It should even be possible to write tactical AI functions in GUI as long as you remember their name is prefixed.
This is completely different from WC3 where AI used a completely different JASS2 interpreter which runs AI scripts separate from the normal trigger space.
As such writing an AI actually is not difficult physically. Instead the difficulty comes from the logical implementation which is something even experts struggle with (why robots do not rule the world already). The first part of the problem is knowing how to structure the AI so that it does not break, always works, easy to maintain etc. Then comes the really hard part of actually deciding what the AI should do since often humans are unsure in a lot of circumstances.
Ok there is a looot of stuff in your post where I have no idea what you are talking about. I have never created a custom script on my own before and I have never played with the tactical AI on units and stuff. I've just never really looked into it, but do you say the best thing for me would be to create my own custom script? In that case, how am I going to go about it? And what do you mean by "remove them from AI control"? The computer units on my map are only controlled via triggers and I have deleted the melee AI from the Melee Initialization trigger, so the computer's units aren't even being controlled by anything in the first place.
I don't know if it will change anything, but you should probably active the Campaign AI. It does very little except sending workers to mine or use a handful of spells, but a number of actions don't work if literally nothing controls the units.
Rollback Post to RevisionRollBack
Hope begins in the dark, the stubborn thought that if you just show up and try to do the right thing, dawn will come.
As Telenil hinted, you need to turn on the AI for the computer player if you want it to do anything AI related at all. The campaign AI is basically an AI initialization with none of the periodic logic (found in melee AI) allowing you to fully customize your AI behaviour to suit your requirements. The key part of it is that it turns on the AI system for the player which means it will run ability and unit tactical AI functions as well as order units around. It is not possible to turn on the AI system for players that are not computer owned (eg you cannot turn it on for empty slots or humans who have dropped).
Ability use is controlled by tactical AI functions. As far as I know these are not really supported by GUI so although in theory possible to write them in GUI the only examples of how they are implemented are in pure Galaxy script.
And what do you mean by "remove them from AI control"?
You can instruct the AI to ignore certain units. This means they will not be subject to army grouping decisions (that you need to instruct separately as they do not happen automatically) and I think that they will not perform tactical AI decisions. In this situation it might be useful in case you order an attack wave of marines so it does not decide to remove the marines from the bunkers (if that is even possible, not sure).