The author had "In order to change the Zealot's ability from Charge to Blink, I would call: CatalogFieldValueSet (c_gameCatalogUnit, "Zealot", "AbilArray.Link, 1, "Blink");" I changed the Zealot to a DarkTemplar.
However, I tried this and I got an error that says "ErrorCatalogFieldNotWritten" Does anyone else have this problem with this trigger?
"ErrorCatalogFieldNotWritten" simply means that the field path is not correct. Since the field path of ""AbilArray.Link" is actually correct the problem can only be due to one reason: the catalog function is meant to change an existing value. So, if the Dark Templar doesn't have a 5th ( = the 5th ability) there is nothing to change, right?
Try placing a dummy ability for the unit in that position, then the dummy ability would be turned into the "Blink" ability when your trigger worked.
Ahh, you're right. I didn't actually try it out myself, until now, I just knew that the format was correct. However, after actually trying it myself I see that everything works fine- you can perform the test yourself by printing the contents of that field in a message to show it's validity.
Then, I just looked at the link you provided and found this: "I'm sure you can only change what you can change through upgrades.". So basically, you can't change the ability list in this way during run time. This method would only be good for changing contents in some fields, while allowing you access to check the contents of other fields.
You're going to need a different method for this work, adding the blink ability and simply adding a requirement would be a good method. It kind of makes sense, I mean if you were able change this during the mid-cast of an ability you would totally screw the game.
The easiest way to add/remove abilities is to add all of the abilities to the unit, and then show/hide specific ones. There is a limit to 32 abilities this way though. Which makes for about 28 usable abilities (stop, walk, attack, learn, ect take up ability slots). If you need to pass the 32 limit, the best thing to do would to make 2 similar abilities out of the same one, and just use requirements the launch the correct events.